Question About Game State

Started by
0 comments, last by MrSkullz 10 years, 9 months ago

Nevermind.

Advertisement

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?

This topic is closed to new replies.

Advertisement