Skip to content

Development Tips and Tricks

Aika edited this page Jan 2, 2019 · 5 revisions

Navigating the source

Trap Quest is split up into smaller files (referred to in Inform as Extensions). To access different parts of the code, go to File > Open Extension > [Category] > [Extension]. Here are some guidelines for the less obvious categories:

  • Actions - Definitions of player inputs that are understood, validated and then performed.
  • Collectibles - Items that you can find and pick up but that have no immediate use.
  • Consumables - Items that you can find and pick up and can be activated in some way, usually making the item disappear afterwards.
  • Every Turn - Anything that gets calculated or executed every single turn goes here. Essentially this is the main game engine.
  • Graham Nelson - This is the basic game universe code that the platform comes with. This shouldn't be removed.
  • Miscellaneous Backend - Anything that doesn't fit into 'Every Turn' which isn't about outputting information to the User Interface.
  • Miscellaneous Frontend - Anything that is mainly about accepting user input or printing stuff to the screen.
  • Objects - Anything in the game universe that doesn't fit into any of the main other groups (the main other groups are Body Parts, Clothing, Collectibles, Consumables, Furniture, Monsters, Traps)
  • Third Party Extensions - The game uses lots of third party extensions written by others and publicly available online. These have been consolidated into one category in order to not fill up this menu with random coders' names.

Often you'll want to search the entire codebase for something, for example a function name or a variable name. Inform 7 can't do this itself, so you'll want to use a third party text editor. I personally use and recommend Notepad++. The keyboard shortcut for Find in Files is Ctrl+Shift+F (you'll want to have your Extensions folder as the base folder it searches from) and you can even do a 'Replace in Files' from here (but of course be careful because this is often irreversible, consider making a commit before you do this so you can use GitHub to reverse it if it doesn't work out as you expected).

You can use the 'Index' tab to some usefulness, it essentially tries to create a nice library of everything in the game. My most used tab is the 'Kinds' tab which at the top has a tree of all the objects in the game and what they inherit from. I find this really useful when I need to debug something that isn't working, it's often because I've not defined an object's kind correctly or forgot to tell the game that any of that kind of object actually exist in the game universe.

To add a brand new extension into the game, you'll need to add an "Include" line somewhere in the code. To see where is best to list it, and the extra phrasing of the line, search the code for the name of an existing similar extension and find the line that says something like (for example) Include Buttslut Tattoo by Tattoos.

Switching between Trap Quest and Diaper Quest

In Miscellaneous Frontend > No Graphics, the top function looks like this:

To decide which number is diaper quest: decide on 0.

You can change the second line to decide on 1. to enable diaper quest.

Testing Settings

When compiling to test I strongly recommend ticking the 'Make random outcomes predictable' option in the settings tab. This allows you to meaningfully use the 'Replay' button next to the 'Go!' button which re-enters all the same commands you did last time (not including hyperlink clicks, doesn't work with hyperlinks). Make sure you only use this with Quick Start and not when you change any settings, because otherwise it won't have the same behaviour each time (since the starting state with the settings file will be different!)

Make a new branch!!!

Instead of always working into your master branch, it is a good idea to make a new branch for each project you're working on. This really helps you make sure that your master branch always compiles and works properly and also helps you work on more than one idea at a time.

Old GitHub Desktop

TODO

New GitHub Desktop

Click on Branch at the top and then New branch...

Then go and read about pull requests to learn about how to merge that back into your master branch.

Making Changes and Compiling

You need to make sure you are working into your Documents\Inform\... directory. If you work into a different copy of the code, including whatever is saved within your GitHub\... directory, Inform7.exe will not be looking at your new files and so your changes will not be compiled.

Make sure you have saved all your changes to the various extensions you have modified before you hit 'Go!' because Inform 7 won't do this automatically and won't read any unsaved changes.

Generally I find that the compiler finds any compile errors within the first 2 minutes and so if it's still compiling at this point you can be confident that there are no issues and continue working.

Testing the Code

When the internal interpreter starts, you must make sure that you go into the image & layout settings and turn loading screens off as otherwise they will crash the internal interpreter as soon as the dungeon loading screen appears. You will only need to do this once since it will create a settings file which it will read in future runs, just like other interpreters.

It's also strongly recommended to disable hyperlinks because, as mentioned earlier on this page, the 'replay' button won't remember any hyperlink presses. Also the internal interpreter is slow as balls, and hyperlinks slow it down even further.

Testing the specific thing you just made

For most things I just made and want to quickly test, this tends to be how:

  • Add any changes needed to the starting gamestate to the To set up debug stuff: function at the top of the main code.
    • e.g. now the raw sex addiction of the player is 20.
  • Hit Go!
  • Quick start
  • Optionally type debug if I need to see some specific debug-only text
  • Either...
    • Jump to the relevant item/trap/NPC/whatever with gonear alive [noun]
      • alive makes sure that the noun it chooses is on-stage.
    • OR pull the (portable) item to my inventory with purloin [noun].
  • Interact with the object and use undo and repeat until I get the outcome I want