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

Hi everyone,

I have just begun learning inform 7 and have been thoroughly enjoying the learning process of thinking of a scenario and then trying to implement this basic idea in inform 7. So far in just a handful of evenings i have tought myself the very basics of the program and am gradually learning some of the more complex concepts.

I figured now was a good time to start looking at available source code online of existing works as a way to learn good formatting along with general good practices.

The first search came up with Bronze by Emily Short and I was immediately struck by how well laid out and organised the code was. I also realised that many of the rules of the world that she outlines in the first few chapters seem like things that would apply to many ‘standard’ game worlds.

Things like smells, staircases and floors etc. all seem like very flexible and common things to include in a game.

Getting to my point, do many of the IF authors here have their own libraries of rules etc. they have accumulated over the years that they like to draw from when beginning a new game to help speed up the process of establishing the world, or do you generally prefer to just start with a clean slate and write up all these things from scratch each time you start a new game.

Just wanting to get a bit of insight into the processes that people like to use and if there are any handy resources that might help a new I7 user (besides the manual). Perhaps other games with available source code that is well structured and can be used as a good learning example.

Thanks everyone and I look forward to learning more in the coming days and years with this wonderful community and program.

4 Likes

Welcome BE, if I may call you that.

I probably reach for some of the same extensions repeatedly. Less so a library of my own code; my own code always ends up being too specific to each game.

Extensions are quite a big deal in that there are tons, and it’s simply not possible to keep them all in mind when you’re starting out. But it’s worth browsing them at random occasionally (if you’re on the Mac, just click the Extensions tab on the bottom-right corner of the IDE, and have a browse. If some other platform, uh, someone else will probably chime in for me) because they show ways to do things, or use Inform, you probably haven’t thought of. And the ones that do things in a way you really like may end up becoming your staples.

This is potentially a lot to think of when starting out, so if you look at them and feel overwhelmed or like ‘I don’t even know what this extension is trying to do,’ don’t worry about it. If you end up staying the course, they’ll start to make sense and help later. And the one thing I’ve learned about extensions is, it’s better to have them in mind earlier than later. Otherwise you can end up reinventing too many wheels.

-Wade

4 Likes

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