Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I've already asked this on gamedev at http://gamedev.stackexchange.com/questions/15161/avoiding-impossible-states-in-an-adventure-game, but I think I'm after more of a mathematical answer than a programming one. Here is the question:

I'm looking at creating a fairly complex choose-your-own adventure style of game, but I'm looking for a technique or method to help with the game design.

It will be a multi-branching story, and at times the branches will fold back in on themselves, and your major actions will be remembered and items will be collected. For example, if the player goes to the swamp and the forest before going to the castle he has picked up a dinosaur bone, killed a unicorn and grown an extra arm. If a player gets to the castle via the caves and the crypt he has picked up a bicycle and a strange smell. Now when developing puzzles for the castle I don't want to create a situation where two impossibilities are requires, for example - an extra arm and the smell are needed to kill an ogre.

Other than documenting the events and items very very carefully is there a process, a technique I can use in a spreadsheet or a piece of software that can help me?

share|improve this question

2 Answers 2

You obviously know you're writing a state engine. In this situation, I'd probably consider the castle multiple states instead of one.

That is to say, the "swamp forest castle" and the "crypt castle" are different castles. In your code, you may render them the same, but the states are distinct because they've resulted in arriving at a destination with different assets.

Another way to think of it is to say, "at the castle isn't really my state . . . at the castle with a bone and a smell are my state."

share|improve this answer

If there are $n$ locations and $m$ items/qualities that one can either have or not have, there are (a priori) $n\cdot2^m$ possible states. If that total isn't too large—or even if the reachable part of it isn't—it should be possible to write a program to walk through all of the possible states.

Then you can simply see if after traversing all possible states if the node in question has been reached.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.