Design and documentation journal for my interactive fiction (text games); also reviews and other miscellaneous stuff.

Thursday, May 5, 2011

Better Design Practice: Scene Start/End Conditions in Inform 7

One of the things that's really been hammered home to me lately is that is a terrible, terrible idea to have single-fire scene starters.  There are numerous, hideous ways they can go wrong, unless the game starts and stays very simple and constant in design, and rooting out the bugs can be incredibly irritating.

Consider the difference between Scene A, which starts when the time of day is 9:01 pm and ends when the time of day is 10:00 pm, and Scene B, which starts when the time of day is after 9:00 pm and the time of day is before 10:01 pm.

Under normal circumstances, where there's no time breaks, no bugs, no testing circumstances, etc., these will function identically.  But if you want to start testing at 9:15 pm to make sure the end game is running smoothly, Scene A won't fire.  You could start testing at 9:00 pm, of course - assuming there's no other scenes using similar start conditions that would be interrupted.  If you've got a multi-scene end-game, you could very well need to start dozens or hundreds of turns earlier.

You can, of course, always set up a testing string of commands or a skein to get you to the necessary point, but it's really nice to have the additional flexibility of just jumping in.  

I'm going through now and trying to make sure that scenes rigorously begin not only during the first turn they apply, but every turn they apply.  (The language in Inform is a bit misleading - I anticipated there might be an issue with "starting" a scene every turn, especially if there are conditions that fire when it begins.  I think it might be better to talk about when scenes are acted out, or continue, or go on, or happen - some verb that doesn't imply simple on/off conditions.)

No comments:

Post a Comment