Organizing tutorial data/instructions

Posts: 832
Joined: 2002.09
Post: #1
Long time, no post. While I'm digging myself out of the card house that collapsed over me during the last month, I'm trying to find a way back to the project that I left off.

At the time, I was working on the tutorial system for my game. I have a pretty good manuscript for it, but I'm not sure if I can find a decent way of setting it up programmatically. Any and all ideas are welcome.

The game is a puzzler - you have a board state and you have a number of moves at your disposal. Each tutorial "step" is a text string (describes the situation, or is an instruction.) This is setup through a plain struct - step index, text, additional data. However, my main problem is how to encode the conditions for moving on to the next step. I'm not going to hammer Lua in just to be able to script these things, so assume full C++ force behind it.

My approach is the following:
I create an observer class that is notified of the moves the player makes. It holds a copy of the board and performs the same moves as the player, so the board is kept in synch. The class has an array of "step structs" with the text. For each step in the tutorial that is more interesting than "move on after the next move", I write a separate function and embed a function pointer in the "step struct". This function acts as a sort of delegate - when the player makes a move, the move description gets sent to it. The function looks at the moves, checks to see if it fulfils the criteria for moving on, and if it does, it returns true.

The downside here is that I'm going to write a real boatload of functions - upwards of 20-25. It's not a real problem, but it feels extremely inelegant and bloated. Does anyone have a better way to go about it? Experience? Powers of divination?
Quote this message in a reply
Post: #2
the tutorial is fixed right? can you model this using an Extended Finite State Machine (EFSM), then implement it using the State Design Pattern.

Quote this message in a reply
Post Reply