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