Page 1 of 1

state transitions

Posted: 28 March 2013, 03:02
by ddyer
It seems like the state transition engine requires redundant "next player" states, ie

"play" -> "nextplayer" -> "play" is the sample state transition, where "nextplayer" is
completely automatic. But if I remove the "nextplayer" state, (and invoke the logic from nextplayer )
something complains "Impossible to change active player during activeplayer type state "

I want to get rid of the "nextplayer" state because state after "nextplayer"
is the next interesting state.

Re: state transitions

Posted: 28 March 2013, 08:57
by Alkazar
There are two types of states : player (or action) states, and game states.
Modifying the active player cannot be made during the player state , and you have to use a special state (or game state) to be able to do this modification.

Why don't you want to use two states, any particular reason ?

Re: state transitions

Posted: 28 March 2013, 16:41
by sourisdudesert
Hello,

This is it: you can't change active player during a "activeplayer" or "multipleactiveplayer" state.

Cheers,

Re: state transitions

Posted: 28 March 2013, 17:41
by ddyer
Alkazar wrote: Why don't you want to use two states, any particular reason ?
Suppose I have 5 choices for "next state" and I've identified one. Instead of
transitioning directly to the next state, I have to go to an intermediate game
state next, so either I have to have 5 intermediate states, or I have to somehow
re-determine what the next state should be after transitioning through a game
state.

I suppose as a matter of style, I could immediately transition from the active
player state to a game state, so when the next state determination was made,
I would already be in a game state. -- but then I have the problem of remembering
what the previous state was.

Anyway, it seems like an arbitrary structure imposed on the state engine. It would
help if you could identify the benefit.

Re: state transitions

Posted: 28 March 2013, 18:38
by Rudolf
I think you will understand better why there are this sort of states if you compute complicate games...
sometimes you need to do extra actions in some cases, sometimes you need to pass through a states but need to cover some actions instead, sometimes you need to loop (execute directly wihtout waiting for a click), but you need a step to choose the next step (loop or not)... many cases...

hope it will help
§Rudolf§

Re: state transitions

Posted: 28 March 2013, 18:44
by sourisdudesert
Hello,

The benefit is: we ensure that during one game state where player can do some action, the active player won't change.

If this would be possible, it would mean for example that the active player could change, and your "onEnteringState" function is not called again for the new player (the same for onUpdateActionButton).

Cheers,

Re: state transitions

Posted: 28 March 2013, 20:49
by ddyer
as long as the "leaving state" message was called, before re-entering the same state,
there would be no problem.

Unlike some of the things I've mentioned, relaxing this restriction would be backward
compatible, since it's currently impossible to go from state a to state a.