Forgot your password?
Or sign in with one of these services
, June 22, 2013 in General and Gameplay Programming
This topic is 1662 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.
If you intended to correct an error in the post then please contact us.
Could you tell me a little bit more about the context of these functions? Are they part of a class such as a Player class? Is this multi user or single user? Also, can the current user have more than one UserState or is it basically a singleton for the current session? Can a user be in both the PublicState and the UserState at the same time, meaning one deals with public things such as location, name, and UserState deals with the interface?
What I do when I need multiple state machines is to ensure that they are modeling different things. I have a global GameStateMachine which would be in a BUILDING, COMBAT, etc state but then a CastSpellMachine which could be WATER_STATE, EARTH_STATE, etc. The GameStateMachine doesn't care about the CastSpellMachine but the CastSpellMachine can't be started unless the GameStateMachine is in the COMBAT state.
In version 1 you have both a public_state and a user_state. Do those make sense to coexist? In version 2 you are essentially switching state from PublicState to UserState.
There is nothing really magical about state machines, they are just a way to pull the game logic out of the presentation logic and simplify the if-then-else a bit. An int = 0 is a state machine with it's current state being zero. States are the model of the model view controller design pattern and the controller is the "if in UserState then ..." logic.
So do you want a public_state && a user_state or are you switching from public to user modes?
Started Sunday at 07:53 AM
Started Sunday at 06:40 AM
Started Saturday at 07:51 AM
Started Friday at 01:55 PM
Started Friday at 08:54 AM
Create an account with GameDev.net and join the game development conversation on our forums, blogs, articles, and more!