blocking a player out of their turn

What’s your best method to block a player from doing anything when it’s another player’s turn ?
I know how to use the Restrict Commands trait, but how would you make it simple to prevent unwanted moves, again, out of a player’s turn ?
And by the way, how do you track player’s turn ?

I think Restrict Commands and global properties are the fundamental ingredients for the vast majority of games, helped perhaps by action buttons, layers and dynamic properties on pieces.

Tracking… I use a global property that is switched on turn change. Turn change is a button press that deals with other turn end admin as well.

I then reference the global property in Restrict Commands that check player turn status to stop players inadvertently clicking on the action buttons that I have overlaying the pieces. I do the same to shorten command lists to valid / useful commands and prevent inadvertent use of commands on pieces out of turn.

However, I don’t prevent the any player consciously interacting with the game, eg moving pieces or using valid right click commands. I figure there is no need and a player might want to act on behalf of their opponent in some circumstances.

I use a dynamic property on cards to track whose hand a card comes from if it is played. I can control what cards are playable at any point in the game using this and similar methods.

You can do things like Mark mentioned, but ultimately I think you’d spent a great deal of time chasing your tail on an effort like this. It’ll take extraordinary effort to stop simple drag-and-drop outside of a player’s turn.

To clarify, I agree with Joel on drag and drop. I would not prevent drag and drop except in very well defined circumstances and for then only for a good reason, e,g, to protect a critical automated feature.

On the other hand, I have commands that initiate certain piece movements, where the movement itself triggers further logic (e.g. Play Card). I then focus on filtering those initial commands. Players can still override the filter by drag and drop, but I assume they will only do so when allowed by the game rules and that most will prefer the convenience of click to play or right click commands.

Thanks for the ideas.
Indeed, I would not prevent a player from touching their own board, assuming I log everything in the main window.
But some buttons should not be available out of one’s turn, especially if this sends a lot of end of turn moves.
I also want player to feel reponsible for what they do :

  • it’s your turn ; you clicked on a button. Assume it. Don’t undo every other move becaus eyou didn’t plan.
    This comes with the couterpart:
  • it’s not yoru turn ; you can’t click by error on these buttons

I tried to handle the player’s turn with a very complex mechanic last time. I had to abandon it. It was useless, and I indeed chased my tail for a great deal of time :smiley:.

Specifically, for tool bar buttons, you can prevent off-phase use by including the appropriate condition into the search within the button’s associated Global Key Command. e.g. appropriately set up, the example {gActiveSide == PlayerSide && PieceType==“EndTurnPiece”} where “gActiveSide” is a global tracking the active player, would prevent the end turn piece from getting the “end turn” key command. I optimistically put this first in the condition, thinking that then a negative will complete quickly and prevent a search of the pieces and would also include map and zone criteria to further limit the search.

Also, you could put the same player check into the report field of the GKC (using beanshell) to put some warning into the chat or an alert on to the player’s screen. e.g {gActiveSide== PlayerSide ? “End turn pressed” : Alert(“You can’t use this button at the moment!”)}

Or you could let the GKC send through to a piece that then does the equivalent check and maybe does more for the off-turn case.

Hope that helps.

Mark