How to handle a few optional turn actions?

Game development with Board Game Arena Studio
Post Reply
sparr
Posts: 65
Joined: 08 April 2014, 02:12

How to handle a few optional turn actions?

Post by sparr »

For my first game I'm trying a simple card game. On a player's turn they can play a card to the middle of the table, to their own area of the table, or both, or pass. I've got a few ideas for how to handle this, and would appreciate guidance or advice.

Idea 1: multiple game states. state1 has no cards played, and the player can take either action, leading to state2 or state3. state2 and state3 have one of the two actions taken, with the other action available. all three states have a 'pass' action, which leads to the same state as taking an action in state2 or state3.

Idea 2: one game state for the player's turn, which can loop back to itself as many times as they make legal plays (which will be 0, 1, or 2 times)

Idea 3: a more dynamic user interface, so that the player only takes one action, and that action can include 0 or 1 cards played to each of the two locations.

Idea 4: ???
User avatar
Quinarbre
Posts: 140
Joined: 15 December 2013, 23:26

Re: How to handle a few optional turn actions?

Post by Quinarbre »

All three should work. I'd recommend the 1st option.

Idea 2 allows you to code for a single state, but then you'll need globals to check whether an action has already been taken.
Idea 1 requires a little bit more PHP coding, but will make it easier for you to check that no action is taken twice.
Idea 3 makes less server requests but will require significantly more JS coding, which could be tedious.
Post Reply

Return to “Developers”