play card out of turn

Game development with Board Game Arena Studio
Post Reply
User avatar
jeffdi
Posts: 4
Joined: 18 April 2020, 07:02

play card out of turn

Post by jeffdi »

I'm working through how to enable players to play a Special Action card at any time (out of turn). I've looked at using 'multipleactiveplayer' states, but that seems suboptimal as you lose track of who's turn it actually is (all players with special action cards look active). checkPossibleActions doesn't seem to allow a non-active player to take an action.

Any suggestions?
User avatar
jeffdi
Posts: 4
Joined: 18 April 2020, 07:02

Re: play card out of turn

Post by jeffdi »

Sorry. I think I actually figured this out. I wasn't using the correct check on the server side [ e.g. $this->gamestate->checkPossibleAction() ]

This seems to work the best. Playing a special card moves to a 'multipleactiveplayer' state where I enable only the requesting player to respond. Completion of the action returns back to a single 'activeplayer' state, again allowing a player with another special card to jump in. This also means I don't need an extra 'game' state just to change the activePlayer or logic to keep track of the original one.

Let me know if you have any other suggestions.

This logic is for Forbidden Island. Should be close to getting an alpha release out.
User avatar
Benoit314
Posts: 82
Joined: 02 April 2020, 22:12

Re: play card out of turn

Post by Benoit314 »

I had a similar issue in Hellapagos. In that game, all the cards can be play at any moment (almost).

I don't know Forbidden Island rules very well, but I'm not sure you need a multipleactiveplayer state.
You should activate only the player who has to play because otherwise time will decrease for all active players. Meaning a player who is active and can't play will be penalized if the other player take too much time.

I would use a visual indication to show whose 'turn' it is.
User avatar
Lymon Flowers
Posts: 195
Joined: 01 April 2020, 21:14

Re: play card out of turn

Post by Lymon Flowers »

You can still change active players back and forth in the same "activeplayer" state and use ajaxcalls, notifications...

In downforce, some cards give other players the possibility to play a move then the active player continues. So server-side, I save the active player into a state variable activate the other player and when they have finished their move, I come back to the previous player.

But in your case, you could create an ajax action that specifies where a player wants to put a sandbag (assuming the choice has been made client-side already even without the player being active) and the server-side action does all the job of modifying the board and sending notifications to players so that they see the action. No need to implement states or even to change active player I think.
User avatar
Benoit314
Posts: 82
Joined: 02 April 2020, 22:12

Re: play card out of turn

Post by Benoit314 »

That what I would do too. That is actually what I do in my game for almost all the cards, except a few exceptions that cannot work like this (killing a player that can defend themselves).
Post Reply

Return to “Developers”