WelcomeWhat's NewsORLibraryDownloadsLinks
This site
produced
517522
pageviews since
8/19/2004
Today's date:
9/8/2010
REPLAYing command scripts A game's development process involves a great deal of highly-focused testing. As you create each new room, object, NPC, verb and so on, you give it lots and lots of exercise, both to confirm that it does what it's supposed to, and to ensure that it doesn't fail in unusual circumstances. Doing this carefully as you go along is common sense: it's much easier to thrash the hell out of some new code while you can still clearly remember just how you intended it to behave. As the game grows, it becomes harder and harder to check it thoroughly. Sure, it's still easy to test the new stuff: the problem is regression testing, verifying that what you've just done hasn't broken what you did yesterday, or last week, or last month... One excellent way of minimizing the hassle is to create command scripts which you can replay to ensure that the whole game still hangs together after each set of changes. Inform includes the verbs RECORDING ON and RECORDING OFF which create a script by capturing commands as you type them, and REPLAY which reruns (some or all of) a game by reading commands from a script file. These verbs are described in §7.1 of the Inform Designer's Manual (Edition 4/1). RECORDING and REPLAY are available only when debugging is enabled, which isn't normally a problem while you're developing: Strict mode (and thence Debug mode) is the default compiler setting. However, when you release a game to beta testers, as a competition entry, or simply for general enjoyment, you'll want to turn off Debug mode -- by compiling with the -~S flag -- in order to prevent unscrupulous cheating. This means that these verbs now don't work; a bit annoying, since you'd really like to REPLAY your regression tests in regular mode as well as in Debug mode. Here's the very simple way to make RECORDING and (especially) REPLAY available at all times. In addition, it also implements ! as a comment verb, so that you can embed remarks in your script files to remind yourself of what's being tested. Just add this code to the end of your game, after the Include "Grammar"; line: #Ifndef DEBUG; In fact, you might find it convenient to place the code in a file Replay.h which you can then easily Include in all of your games. Finally, by way of example, here's a script file which exercises my example game "Cloak of Darkness": ! Command script to exercise "Cloak of Darkness" (Cloak.inf) |
Would you