most of the state machine/game engine