state transitions

Game development with Board Game Arena Studio
Post Reply
User avatar
ddyer
Posts: 67
Joined: 01 April 2011, 19:55

state transitions

Post 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.
User avatar
Alkazar
Posts: 22
Joined: 16 August 2011, 14:52

Re: state transitions

Post 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 ?
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: state transitions

Post by sourisdudesert »

Hello,

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

Cheers,
User avatar
ddyer
Posts: 67
Joined: 01 April 2011, 19:55

Re: state transitions

Post 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.
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: state transitions

Post 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§
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: state transitions

Post 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,
User avatar
ddyer
Posts: 67
Joined: 01 April 2011, 19:55

Re: state transitions

Post 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.
Post Reply

Return to “Developers”