Parallel tasks
One feature which has been implemented in the Hierarchical State Machine we are using is the ability to support parallel states. Parallel states are usually drawn on a standard state chart diagram such as UML state charts inside one state, separated by dashed lines. A fork would be necessary to divide the incoming transition into two parallel tasks. Leaving any of these states would cause a transition from the parallel state.
An example for using parallel states in the AI of the main character would be a jump state where it would be possible to move forward during jump if the player presses the navigation keys. In this case, the jump itself is composed of a few sub states and a parallel state. Moving or not moving are the sub states for one of the parallel states. Pressing any navigation key would cause the player to move, change to moving state, not pressing causes a transition to stationary state. These change of states happen in parallel to the rest of the states related to jumping action.
This way it would be possible to add more dimensions to the behaviors of the PCs or NPCs.
Since we currently have a symbol definition system in order to store and evaluate variable values in the scripting system, it would be possible to simulate the join feature after a parallel state also. A join would mean that the process would stop continuing until both of the parallel sub states have made the exit transition. The two praralle states set a symbol upon exit, this join state would check for the two symbols, if they are both set, it would make the exit transition. Haven’t used this feature yet.