So, I'm making a text adventure game for a competition. i want the game (which you just lost) to
- take player choices as input and store them
- depending on player choices, move throughout the story
- have unique responses to certain inputs for comic effect, including a catch-all for unrecognized inputs ("what does [input] even mean?")
heres a basic example using my (incomplete)!game path so far. (etc means thats the farthest ive programmed in that path)
start > look > look > look > death for annoying the narrator
start > look > look > west > death for annoying the narrator
start > east > death by boredom
start > west > pet the goat > etc
start > west > attack the goat > death by goat attack
start > west > feed the goat > death by goat bite
basically, there is only one correct path through the game. all other paths inevitably lead to death and end the program.
my question is, how can i do this without drowning in if/else if/else/while loops? is there a library that could make my life easier? im using c++, but i can switch to java if that means more efficiency.
i have about a month for the competition.
- take player choices as input and store them
- depending on player choices, move throughout the story
- have unique responses to certain inputs for comic effect, including a catch-all for unrecognized inputs ("what does [input] even mean?")
heres a basic example using my (incomplete)!game path so far. (etc means thats the farthest ive programmed in that path)
start > look > look > look > death for annoying the narrator
start > look > look > west > death for annoying the narrator
start > east > death by boredom
start > west > pet the goat > etc
start > west > attack the goat > death by goat attack
start > west > feed the goat > death by goat bite
basically, there is only one correct path through the game. all other paths inevitably lead to death and end the program.
my question is, how can i do this without drowning in if/else if/else/while loops? is there a library that could make my life easier? im using c++, but i can switch to java if that means more efficiency.
i have about a month for the competition.