Making a text based game (Zuul style), changing game state

Started by
2 comments, last by Photonman 18 years, 1 month ago
Hi I've been given the task of making a text based game much like the world of zuul game (1970's) if anyone remembers. If anyone knows about this it will be alot easier. But the game is basically just about navigating through a series of rooms. What I want to ask is, If I want to make the game sort of story based, with characters and interacting items, what is the best approach? When I say story based, I mean that after certain goals and criteria are met then the game appears to 'progress'. For instance I have a dialog that prints to the terminal upon entry to a new room. What I'd like to do is have the standard dialog for a room change if an action has been completed. To show some type of difference in status. ATM I'm thinking of just having boolean expressions to define when things change (e.g. when x = true then the dialog for RoomA is "blah blah", otherwise it is "abc" or something) Is this a good way to do it? Or should I have a numerical representation of the state of the game (Using a load of if statements referring to a 'state' variable to determine which dialog to print to the terminal? This is using JAVA btw... Thanks for any help. [Edited by - Souljah on March 5, 2006 5:42:28 AM]
Advertisement
You will want to use OOP based concepts and I would define the rooms via XML. Your game engine would read the "current" room, process the input and then move to the next room. The system would also handle any items gained or lost probally with an inventory vector/flags.

Stay away from a linear approach where you have to define everything with thousands of if statements. A key to remember is to design the system so eventually you can add to the game without adding anymore code. Keep your game engine and logic seperate and you should be fine.
This post is strangely similar to this.
Wow...that *was* eerily similar.

but anyway....I did a text based game on a whim to show a friend how to do it because he was having a tough time. Definitely have a class for a room and use XML or some such to load room states for each particular room, which would be an object of your room class. If I had known XML at the time I made my demo game, I *definitely* would have used it instead of writing all sorts of code to set the members for each room. XML also makes it easy to take the same engine and completely rewrite the game with different objects, puzzles, and objectives for the rooms.

Also a class for the player would be a good idea so that an item can be moved from the room to the player's inventory and vice versa.

I've got lots more ideas, but you'll need to specify how you want the game's framework to be laid out so I can give you ideas that would actually be relevant.
______________________________Stranger things have happened...The Following Sentence is True. The Above Sentence is False.

This topic is closed to new replies.

Advertisement