Create account / Log in

blocking a player out of their turn

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

blocking a player out of their turn

Postby kerkael » October 13th, 2020, 8:19 pm

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 ?
Module I developed: Terraforming Mars
Module I'm working on: Trismegistus
kerkael
 
Posts: 173
Joined: December 1st, 2017, 3:03 pm

Re: blocking a player out of their turn

Postby marktb1961 » October 14th, 2020, 7:39 am

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.
Platform used:
Vassal 3.4.10
MacOS Big Sur
iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 328
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England

Re: blocking a player out of their turn

Postby JoelCFC25 » October 14th, 2020, 1:02 pm

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.
JoelCFC25
 
Posts: 748
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN

Re: blocking a player out of their turn

Postby marktb1961 » October 14th, 2020, 4:13 pm

JoelCFC25 wrote: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.
Platform used:
Vassal 3.4.10
MacOS Big Sur
iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 328
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England

Re: blocking a player out of their turn

Postby kerkael » October 14th, 2020, 4:40 pm

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 :D.
Module I developed: Terraforming Mars
Module I'm working on: Trismegistus
kerkael
 
Posts: 173
Joined: December 1st, 2017, 3:03 pm

Re: blocking a player out of their turn

Postby marktb1961 » October 14th, 2020, 10:31 pm

- it's not your turn ; you can't click by error on these buttons


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
Platform used:
Vassal 3.4.10
MacOS Big Sur
iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 328
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England


Return to Module Design

Who is online

Users browsing this forum: No registered users and 2 guests