-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to change currentPlayer without ending turn #141
Comments
Maybe create the concept of a sub-turn, phases could have possible sub-turns as they have moves |
If we can do it without an additional concept, that would be even better, though. It's less cognitive overload when you only have to think about phases, turns and moves. A move is already essentially a sub-turn. Right now all the moves in a turn have to be made by the same player. This feature request will enable a turn to contain moves from different players. |
This way it will also need a way of blocking and requesting moves from other players. |
We could have an active player that is the owner of the current turn, and a action player that is supposed to make a move. It would be beneficial to allow multiple action players. The logic for this should reside in |
I like that idea. |
I also imagine that #142 will be relevant here. |
We'd have to modifiy the server, where the behaviour ( |
So the I like it. |
I'd like to rename currentPlayer to turnOwner. The intention is to reduce potential confusion with the player that is supposed to make a move. Since this is a breaking change, we could defer that for now. Thoughts? @philihp good idea about the default state of activePlayer. As stated above, when modifying this, we could just as well allow multiple active players, to enable games that require action from multiple "other" players. The default then is an array with only the currentPlayer. |
Yes, let's add no additional burden to users that don't care about separating these two concepts, i.e. activePlayer should default to an array with currentPlayer (turnOwner) in it. Don't worry about making a breaking change. This is still an alpha release after all. I'll just document what's breaking in the changelog when I do a release. |
@Stefan-Hanke not sure if the proposed solution can manage a usual board game turn scenario like this: Seems to be more a phase into an existing phase, but you have to retain the main phase passOrder, playerOrder and currentPlayer. |
@rzulian The scenario you describe can be modelled like this: Phase A: Build mine On your turn, as soon as you build a mine in Phase A, the game moves to Phase B, and then reverts back to Phase A once everyone has had their chance. The turn does not end even if the phase gets passed around, so all of this happens in the context of a single turn (assuming that we just rotate the actionPlayer in Phase B). |
Ok, but we need to store Phase A status (currentPlayer, playerOrder and passOrder), so you can run phase B with its properties and the restart from when you were. Or am I missing something of the proposed actionPlayer implementation? |
@rzulian I am referring to your scenario from above.
I'd like to get terminology straight. For me, this is on a turn level, not on the phase level. A phase consists of turns, but not the other way round. This is reflected inside The proposed solution is not the be-all-and-end-all of flow-related problems. The framework had mechanisms in place to disallow players to make moves when they are not the current player. The PR just relaxes this by allowing the game to state that other players are in control now, inside of a single turn of the current player. Nothing more, nothing less. |
@Stefan-Hanke ok, understood. So currentPlayer (turnOwner) it's only about who is in charge of the current turn. Usually activePlayer is the same user, but you can modify the activePlayer through Events, controlling the available moves through canMakeMoves, but still in the same turn. Right? |
@Stefan-Hanke you cleared a little confusion I had. For me was the exact opposite.
For me this subturn would be more phase-like then turn-like. It could have allowed moves, endPhaseIf... |
Just to clarify a few things:
|
I think if we just store currentPlayer, actionPlayers and phase in previousPlayer, previousActionPlayers and previousPhase every time one of these values changes, that should facilitate easy restores? We can even have API support for this via |
Looks good. |
Something like:
We could also do the following instead (in order to have a single API call with options):
We might also want to provide the ability to set a snapshot point to restore to (rather than just saving the most recent value and restoring to that). |
It could have a config for saving the state automatically or with another event:
Or with the snapshot:
One question, do players have a secret state? Like the G.secret? |
If you'd like to hide a field like |
Thanks for the clarification, nicolo. I'd just like to point out that despite being correct about phases/turns, the order of eventing is such that a phase contains turns (the turn end event always comes before the phase end event). I'd like to have one consistent notion. I kind of feel I'm loosing the overall picture of this all. |
Yes, but we could actually go the other way around and I don't think it would make a material difference to games (really what's happening is that they're ending together, but we still need to pick an order because they can't happen in parallel). We could provide an option to configure phase-before-turn or turn-before-phase, but I think that's overkill. We should just clarify (in the docs) that phases and turns are independent concepts. |
I would be more comfortable with the overkill solution but I don't see a case where it's strictly necessary. Anyway it needs to be very clear in the docs, I didn't understand the phase-before-turn this way until @Stefan-Hanke said that. |
me neither, for me it was clearly btw: I am actually changing |
Closing this in favor of #154 to keep the implementation plan more focused. Feel free to continue discussions on this thread. |
There is currently no way to change the current player without ending the turn. However, sometimes you might need other players to execute an action as part of your turn.
The text was updated successfully, but these errors were encountered: