Using Rooms For Other Things

Rooms as data structures

It can often be useful to use the Quest world model as a way to hold data. You can add any number of attributes of any type to a room, making it as flexible as a Dictionary, but you can also define complex relationships between rooms using exits.

Here are some examples to illustrate.

A Computer System

This is a way to model a computer system that gives the user a set number of options in a menu. When the player makes a selection, she is presented with a new screen, and a new set of options. What we have, then, is a set of nodes, each of which has a set of options leading to other nodes...

So basically the same as a Quest game world, except we have nodes rather than rooms. So why not use rooms and disguise them as nodes? What you could do is set up a number of rooms, with exits between them, and then track where the player is with a new attribute on the player object. In each node/room, list the exits as the options.

More here:


You could do pretty much the same thing to handle conversations; at each point in the conversation, the player can select an option based on the exits from there.

NPC Mood

As well as tracking the conversation, you could track the mood of NPCs. You could have a set of rooms, one for each mood. Each NPC could have his own attribute pointing to his current mood, and when the player interacts you could check the current mood against the interact, and see if his mood has changed; if it has, follow the exit to the new mood. This would not be trivial, but if you do want to track moods, this would be a good way to do it.


We could even track the weather the same way. Each turn there is a small chance of change, and if it does change, randomly pick one of the exits to go to a new weather type. You could add a message to the exit, such as "The rain is getting heavier".

This topic is now closed. Topics are closed after 60 days of inactivity.