Project Description
Simplifies task of creating and managing variables used to describe the state of the game world - story progression, task states, NPCs states and other consequences of player's actions. It uses visual diagrams that let you visualize the states, dependecies between variables, thus - the whole outline of the game's plot.

Features
  • Variables described as sets of states with transitions
    • Transition is a condition evaluated either using scripts, or by checking states of other variables
  • Scripts:
    • Each state can have an action (script) attached to it which is called when state becomes active
    • Conditions can use scripts also
    • Scripting and connecting with the engine is done via Reflection. Scripts are just static methods passed by MethodInfo class
  • It also will include library with controls for the editor that will allow to create these variables, visualize everything:
    • Creating variables and states
    • Attaching transitions
    • Displaying dependencies between variables
  • Debugging:
    • Undoing/redoing state changes
    • Setting arbitrary values to all variables

Idea
The idea is to have all the variables that are used to describe the state of the game world in one place. It aims especially games that are story-driven: these variables should be used to describe story dependencies with regard to the player actions and other events.

These variables are here called "State Variables", and are used to describe everything which change may be important somehow:
  • Story variables which describe the state of the storyline after the player's actions
  • Task/quest variables
  • AI:
    • Directly - just like others FSM-s used in AI
    • Indirectly - by scripts which can control various implementations of AI(setting the story phase variable which can then be used by the underlying AI)
  • Dialogs:
    • Directly: current state is the NPC text, player responses are used in conditions to determine next state - the NPC response
    • Indirectly: by controlling NPC state
The indirect approaches are preferred because they aren't making this system one-for-all, but rather place it on the top of the others.

It also uses simplified scripting, where the designer is restricted to only use provided scripts, and not any code he could write - it lowers the change of introducing bugs, thus making the process of creation of the big worlds easier.

FAQ

Q: How these variables relates to the variables existing in an engine?
A: There is no 'direct mapping' of these variables. All you can do is to write some scripts that will check the value of some 'engine variable' and make transitions basing on these scripts. This will allow you to somehow map such variable into this notion of states.

Q: How can I define AI states?
A: You can make variable that will correspond to some AI variable from engine and make state machine for it using various scripts. But it's not recommended. This system is designed as an aid in the creating the outline of the plot, the dependencies between various actions and events. The AI should be maintained by some internal methods/structures. Of course you are allowed to give some orders to that AI/set some values via scripts.

Q: How should I design a dialog system to work properly with these variables?
A: You can do it as you would normally, but instead of checking/setting the values of global story variables, you should resort to the NPC data which then will be base for the conditions and the state variables. For example you can create state variable that will describe some quest, and then, in dialog you want to initiate that quest. But how can you set that state variable if it doesn't exist in the engine? You must instead of it set some field that belongs to the NPC, and then create condition in that state variable that checks this field.

Q: Isn't that(this dialogs integration approach) too much work? Are there some real benefits from that?
A: It may look as an additional, redundant work, but it will make the NPC dialog and its other data isolated and standalone, waiting to be connected to the world. It will let us to create the world from this little pieces.

Q: So how can I integrate this in a proper way?
A: You need good set of scripts which you can use to check conditions, perform actions and manipulate real engine variables. This set of scripts is what connects the engine with the state variables.

Q: OK, and what are these scripts anyway?
A: These are just methods of your engine that you write in C# and expose them via Reflection. In the editor you attach parameters to them and that way they can be easily called from within this system.


For further info you may want to read those ramblings: Gameworld state variables and scripts.doc
(note that it's not documentation, it's a little bit messy it may even contain factual errors... but it was helpful for me to create this concept).
Last edited Sep 1 2008 at 5:05 PM by scypior, version 28
Comments
No comments yet.

Updating...
© 2006-2009 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | CodePlex Blog | Version 2008.12.9.14291