State machines are very useful for creating games, implementing advanced game logic and player actions, enemy AI, menu commands....
And there are verious ways to implement them (already stated on other posts), my "problem" or question is what about Hierarchical State Machines.
A machine where a given state is a state machine itself... this could be very useful for example the main state machine is has the states:
Playing, Menu, Pause.
When Playing state is active:
you have the player state machine running and the enemy state machine running
When Menu state is active:
you have the menu state machine running with various states (MAIN MENU, ITEM MENU, EQUIPMENT MENU, SETTINGS MENU... as you can see I'm talking about RPG here xD) (...the other state machines are not running).
When Pause state is active:
you have all other state machines are stopped.
I know you can do this "hacking" and with workarounds.... but what about a clean Hierarchical State Machines? Any ideas how to implement one? I would like to here from the advanced coders here, maybe some brainstorming!
EDIT: Adding to the theme!! For example each state having an input... and the other input check would be put on hold... if you a in a menu state-machine a the arrows move the cursors and space selects (for the ITEM menu) ... page up and page down would switch characters but only in the PARTY menu sate.. if you are in playing state.. arrows move player, space jumps and shift attacks, if in pause.. space removes from pause. input could be added to states, and have their hierarchy too.
Edited by xDGameStudios, 08 March 2016 - 09:03 PM.