Skip to content

Metro '84 documentation

Stefan Vogt edited this page Jun 28, 2020 · 9 revisions

Features

metro_scenery

Version 3 of the Z-Machine has a total object limit of 255. That's not much considering everything in Inform is an object. One of the most common scenarios where you're sacrificing objects without adding much functionality is when describing scenery. Metrocenter '84 has a library function that enables you to add flexible scenery with a low memory footprint, that doesn't sacrifice any objects. You explicitly need to import the feature and it'll cost you 334 bytes but it will give you so much in return.

metro_scenery source screenshot

There is a sample game in the demo folder that properly explains how to implement and use metro_scenery.

Flags

Metrocenter '84 comes with a simple system to provide on/off flags that only take up one bit of memory; thus, there's no need to waste memory (and global variables) by declaring a variable such as "doneflag" or some such, allocating an entire sixteen bits to a variable that will never be anything other than 0 or 1.

Here's how to use it in your adventures: After inclusing Parser set the constant FLAG_COUNT to the number of flags you need, then include Flags. When you start using a new flag, create a constant with a descriptive name. You may also want to add a comment, or keep a list on the side regarding the meaning of each flag.

metro flags declaration screenshot

You get the idea. Note that the first flag is flag #0.

Setting a flag on or off means calling the routine SetFlag(flag#) or ClearFlag(flag#). To indicate that the player has saved the cat, call SetFlag(F_SAVED_CAT);, and to turn off that flag, call ClearFlag(F_SAVED_CAT);.

Testing a flag is accomplished by calling FlagIsSet or FlagIsClear. So if you have a piece of code that should only be run if the parrot has been fed, you would enclose it in an if (FlagIsSet(F_FED_PARROT)) { ... } statement. Naturally, you can test if a flag is clear by calling FlagIsClear instead.

metro flags testing source screenshot

Clothing

By default, clothing is deactivated. You can enable the feature by setting Constant ENABLE_WEAR. If you keep it disabled, you save 500 bytes.

Number Parsing

Recognition of numerals explicitly needs to be activated with Constant ENABLE_NUMBERPARSING, which will cost you 738 bytes.

Inference

Inform has a special feature called "inference". So let's assume you're holding the right key and you're in front of the right door. By entering > open door, the parser tries to assume what you want, adds his assumption to your command >open door (with the key) and executes your order accordingly. In most cases this works well, and it's definitely a nice feature, but in some cases inference goes either wrong or feels awkward. You can always fix weird behavior by adding your own code, but in a constrained environment, you might want to deactivate it, which you can. Just set Constant DISABLE_INFERENCE.

Compass directions

The parser defines a standard compass object with corresponding directions. In case you want to override this and define your own compass definition, you can set Constant WITHOUT_DIRECTIONS. Metrocenter '84 replies with a well suited response in case the player wants for example to EXAMINE NORTH: "A look in this direction does not bring new insights." With that you're not forced to work on directions in every room and you don't have the problem of the standard parser response "There is nothing special about the north".

Abbreviations

Metrocenter '84 comes with a standard set of abbreviations that work pretty well and offer a good text compression ratio. Make sure you always compile with flag -e as seen in the demo files. In case you want to provide your own optimized abbreviations, just set Consant CUSTOM_ABBREVIATIONS and then import your file as described in the Inform Designer's Manual.

Inform 6 runtime error messages

By default, the runtime error messages inheriting from Veneer are disabled as that saves 1694 bytes. That's not trivial when targeting retro systems. You could enable the feature by setting Consant ENABLE_INFORM_RT_ERR, but we recommend not to do so. The library has a set of built-in runtime errors which are not affected by this setting.

Things that were cut

One of the strenghts of Metro '84 is that it pretty much retains what you know and expect from Inform. But a few things were cut of course to make the library perform well on 8-bit machines: multiple object handling (take all, take three coins, etc), plurals, darkness, reduced look modes, reduced inventory list management, clock support, oops/undo processing, compound commands (open chest and take all from it), some lesser used verbs (but not many), he/she/it processing and a huge reduction of library responses (mostly by combining similar ones). Timers are limited to 4 and text input to 64 characters.

Hint: even though darkness handling was taken away from the library, you still can have dark rooms. See the Cloak of Darkness demo game as an example how to do it.