Is it common for IF authors to use a standard library they have accumulated from their own and other's source code?

Thanks for the response, I normally shy away from forums in favour of discord due to how long it sometimes takes to get a response but looking at this forum I’ve been really impressed by how much valuable information there is and how overwhelmingly helpful the community is to newcomers.

I think i will begin to experiment with extension soon. My initial thought was to try and learn each thing from scratch to help familiarise myself, however I feel that it’s quite easy to get stuck on one thing and lose track of your direction.

I use both mac and windows and occaisionally linux. There is a strange bug that affects my mac version of I7 which doesn’t allow me to see the curser, meaning i have to guess where my next input will land on the screen. Not as bad as it sounds, its almost like its in white and not black which I don’t have happen on windows.

Thanks again.
Cheers

2 Likes

Yes, this forum tends to have very quick turnaround on technical questions.

One unfortunate thing is that the built-in search panel is really hopeless. But!.. this is easily overcome by doing a google site search. You know, “site:intfiction.org how do i create a moveable locked door”. As a lot of questions do get asked repeatedly over time. Nothing wrong with that, but it’s good to be able to get at old answers quickly, too.

-Wade

7 Likes

Thanks for the tip.

1 Like

Notwithstanding the strong competition from more generalist sites, the IF archive still has a sizeable collection of IF sources, library contribuitions & alternate libraries, and remain the main, centralised repository for the IF community, mantained by IF community members.

Tangentially, I think that, aside the few philosophical differences with some standard and/or alternate libraries (ex. implementing a READ separated from EXAMINE in inform 5/6/7), I don’t feel much need of having a “personal skeleton/shell”, so I still start from the generic shells/skeleton provided by practically all the IF languages.

Best regards from Italy,
dott. Piergiorgio.

4 Likes

I don’t know if you’ve already seen it, but “The Inform Recipe Book” is built into the I7 app. It’s very useful in that it tackles coding from the point of view of “How do I do X” – e.g. How do I code an NPC who is referred to as “the conductor” at the start of the game, but after being introduced at the after concert party becomes “Stanislav Popovitch”?

The code can be copied over to the sourcecode panel with one click, so it’s easy to whip up a tiny practice game so you can experiment with ideas. Because it’s part of the app, it’s more likely that the code is up to date, too. One of the problems with extensions is that some of them don’t compile anymore.

But anyway, welcome aboard!

5 Likes

Hi, welcome!

In addition to extensions as mentioned above, I’ve found myself re-using some rules in several projects, but I haven’t yet bothered to pull out everything that’s common to them, because when I start a new project, I’m usually more focused on laying out some rooms, rules and NPCs specific to that scenario; whereas the common aspects are sometimes more for player convenience or for polish at a later stage. For example, making sure there’s a good default response for actions like SMELL for those objects which don’t have a specific response – that’s good to have in every project, but it’s not necessary to get started on a new game.

The role of a standard common base to jump-start the creation process is more or less filled by the automatically-included “Standard Rules”, which provide the material to let you hit the ground running (in this sense, I7 is more “batteries included” than some general-purpose game engines).

About source code, here’s another well-organized example (by Juhana Leinonen): Juhana Leinonen - Sparkle — 1 of 108

And there’s this useful post about organization: Structuring Inform 7 code | Undo Restart Restore

A list of games with available I7 source code: https://ifdb.org/search?searchfor=tag:I7+source+available

As for the general learning process, the manual “Writing with Inform” is a great place to start. Don’t forget to also look at the included Recipe Book, which organizes the examples by topic.

There’s also this big post: Inform 7 documentation and resources

(You don’t need to read all that now, just skim over it in order to know what’s there.)

Have fun, and don’t hesitate to ask questions in the forum. :slight_smile:

4 Likes

Thank you for that.

2 Likes

I’m not sure if it’s common practice but modular reusable code is a design I’m very fond of. I’m also very fond simulation oriented design and I think they go well together. Typically having generalized code that you can reuse can be really helpful when you’re working on future projects (once you’ve done a general dialog system once it’s already ready for your next game) but it can mean added complexity in the short term since you have to generalize/abstract the specific thing you’re trying to do. Having something general can also help others as others have mentioned with extentions, these are often generalized approaches to different systems or tools one could use in a lot of different projects. This gdc talk on Modular AI while about modular AI specifically also covers a lot of the core ideas of modular reusable design and covers a lot of the benefits of it as well as the things to avoid.

4 Likes

Wow thanks for these wonderful resources. I’ll be sure to start looking at them tonight, these are the exact sort of things I’ve been looking for to establish good habits.

I started playing around with extensions last night which was a lot of fun. There are definitely quite a few that seem like that would be very useful and help to enrich a game world.

I’ve begun creating a tutorial game for myself which is more of a sandbox approach which I can then refer back to my own source code in the future if I need to. Each night I ask myself what a couple of interesting and challenging things I could try and implement in the game world and then debug it to see how well it works. Overall this seems like a good way to learn but lacks any real direction or structure so these resources will be really valuable in building on those concepts I’ve been experimenting with.

Cheers

4 Likes

That looks really interesting, I really enjoy those sorts of GDC talks. I think I will co to ue to accumulate some of my own ‘libraries’ of modular code as a way of cataloging what I have learned. At some point this will become redundant but for the next few weeks or months I think it will help to commit things to memory.

2 Likes

I am quite new to coding in general and Inform in specific, and I try not to reuse chunks of code, because I need to know that I can remember how to do it. Also, each time I recode something, I find ways to make it more streamlined and sensible, and I get a better understanding of why it’s working. So it’s tempting to just plug and play things I already have, but I don’t. Something to think about if you don’t have much coding background!

3 Likes

One thing I’ve found helpful in learning to code is to avoid using cut & paste, and typing out the code myself, even when I’m directly copying an example.

4 Likes

I find having snippets of code around handy - even, in some cases, code that’s in languges I don’t technically know and am not using for my IF. It gives good structural clues for how to do the thing that needs to be done, and there’s usually enough thinking that has to be done in conversion to remind me to take the context I’m putting it into consideration.

3 Likes

I have an enormous library of code and world model tweaks that I’ve built up over the past year. And it’s pretty conspicuous that a difference between me and the people who have been saying no is that they’ve written games and I’ve still only written Inform extensions. So if your aim is writing a game, maybe my example should serve as a cautionary tale…

4 Likes

Your question is about “IF authors” and then all your references are to Inform 7.

Everyone in the thread has responded eloquently to the I7 portion of your question, so I’ll just add that no, it’s extremely uncommon to a) have publicly accessible libraries and b) reuse code except in very limited circumstances for other IF authoring platforms.

Sorry I may have mispoke by bundling i7 and IF authors in the same boat. I was primarily referencing IF Authors using i7 although I didn’t explicity say that.

I think that between extensions, recipe book and people simply referring back to their previous works this kind of answered my question, at the time of writing I hadn’t explored extensions in any meaningful way. It would also seem that there are some very fine examples of publicily available code from games which are useful to reference for a new author.

as for part b) of your response, I don’t fully understand. Are you referring to other software such as Twine/tads/inkle etc. ?

3 Likes

Not much to add to the observations others have already made, but one thing that’s come up for me is that each of the games I’ve written and the ones I’m currently working on have been pretty different, so the upsides to code reuse have been pretty minimal (I use Inform 7). With different conversation approaches, major interaction mechanics, gameplay structures, and even just varying tone and style, I’ve usually found it easier to just modify the standard rules to do what I want than to go back to what I did last time and modify it again.

If your projects tend to be more self-similar, maybe code reuse is more efficient - and there are a couple places where I’ve definitely found some reuse to be useful (I have a list of rules that modify the most common standard responses that I cut and paste into each project, since hunting them all down is kind of annoying) but so far I’ve done it less than maybe I thought I would when I first started out.

3 Likes

Hello @BubbaBobba ! Welcome to the Intfiction forums! :smiley:

What I’ve found to be more helpful than accumulating code or creating start templates, is heavily notating the code used in your projects. You may want to do something in a later project similar to something you did before. Naturally, you will think of times you did something similar, and will go back to take a look at how you accomplished that. This beats searching the manual or forums to rediscovery something you already solved. No sense in recreating the wheel each time.

However, being able to, months or years later, even find that relevant piece of code amongst the whole source, let alone interpret it once you do find it, is often easier said than done.

This is why I often signpost where certain code segments start and end, what they do, what variables are involved, how they work (if I understand that), and sometimes even SEO tags to help me find it later if I think it’s valuable enough. I want to be able to bring up the source on any of my projects, search with “find on page” and immediately find what I’m looking for. This is the same reason I don’t delete old projects, even if I decide the premise isn’t worth pursuing any longer; I’ll scavenge from my own code for years as long as I took the time to make it accessible and intelligible.

If you take the time to do this, then everything you ever wrote becomes a searchable reference for future work. This is what I’ve found to be most helpful.

6 Likes

Hello BubbaErik!

When I first started working with Inform 7, I would look at the source code for Bronze constantly for inspiration and for ideas about what might be “best practice” when using the language. My own source code (unlike my desk, and my home) tends to be quite organised!

To date I have made four released and two unreleased I7 games. Nowadays when I start a game I begin by copying over large chunks of code from my previous games. Over time I’ve developed ways of handling things like NPC descriptions (and the way they’re described in rooms) that are very flexible and work just as well in one game as another. Other pieces of code I reuse include exactly the things you’ve listed, smells, sounds, staircases, floors, windows, distant objects (things that are too far away to touch) and things that exist in one location but which can be seen from another. I also reuse code for actions like throwing things and emptying containers. Lots of clever forum members including Matt Weiner, OtisTDog and the very modest Zed Lopez have posted useful bits of I7 code on the forum which have found their way into my recent games, and it’s always worth asking if you can’t work something out. Nobody will mind and somebody will enjoy the challenge.

In terms of extensions, I regularly use Locksmith and Basic Screen Effects by Emily Short, Scheduled Activities by John Clemens and Epistemology by Eric Eve. Several of my games include Eric Eve’s Conversational Responses and one uses his entire conversational package.

My games are quite self-similar. They tend to be focused on object-manipulation puzzles (what have been called ‘medium-sized dry goods’) because that’s the way my mind works. I’m also quite NPC focused, so I have a fair bit of code for handling NPC interactions which can be adapted from one game to another. If I were to try to write something in the style of, say, Arthur DiBianca, Mike Spivey or Andrew Schultz - not that I’d ever try! - a lot of my reusable code would probably be irrelevant, because those authors write very different styles of game. Inform 7 is a very versatile language, and even to an experienced author, other people’s games can seem like magic!

8 Likes

This is how I’ve been approaching my tutorial game I’ve been making for myself. I make a comment before each piece of code briefly describing what it is trying to do.

The other thing I’ve also found interesting is that often with a clever description of what a player is doing after that complete an action it can circumvent the need to write any code at all that modifies the game world. The more I look at other games I have noticed that often times clever writing is a more elegant solution than clever coding.

I’m actually really surprised at how many games have their source code available now that I started actively searching. It’s fascinating to see how authors build their game worlds.

5 Likes