Skip to content
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

Turn like play order within a stage? #1017

Closed
pardahlman opened this issue Oct 14, 2021 · 4 comments
Closed

Turn like play order within a stage? #1017

pardahlman opened this issue Oct 14, 2021 · 4 comments

Comments

@pardahlman
Copy link
Contributor

In my game, the main portion is played concurrently by all players. This is achieved by setting all players in the main stage where they can carry out their moves. When a turn is coming to an end, bonus moves (defined in a bonus stage) can be made once per turn for eligible player. These actions should be carried out in sequence with the player closes to the currentPlayer going first.

Is it possible to get a turn like play order for the bonus stage? I know this can be solved by using phases and turns, but conceptually it all happens within a turn so it would be fitting to model it as such.

@delucis
Copy link
Member

delucis commented Oct 14, 2021

You can use the next option to setActivePlayers to queue up a sequence of stage configurations:

setActivePlayers({
  value: { '0': 'bonus' },
  next: {
    value: { '1': 'bonus' },
    next: {
      // etc.
    },
  },
});

So in this example, when player 0 ends their stage, active players will move on to the next value, placing player 1 in the bonus stage and so on.

This nested next syntax should work, but it’s not super nice to generate dynamically, so changing it is on the to-do list. The idea would be to support an array of arguments to queue up future values, which would be much cleaner to work with, e.g.

setActivePlayers([
  { value: { '0': 'bonus' } },
  { value: { '1': 'bonus' } },
]);

@pardahlman
Copy link
Contributor Author

I didn't realize that nested next arguments were supported, perhaps that is will suffice for me 👍 Thanks for pointing that out and for the quick reply 🙏 I can think of scenarios where you would like to do turn-like moves up until a point where all players have ended the stage (perhaps a sequential buying phase where you can buy one item each "turn")

@delucis
Copy link
Member

delucis commented Oct 15, 2021

I can think of scenarios where you would like to do turn-like moves up until a point where all players have ended the stage

Yeah exactly. That's the kind of scenario #478 is looking to make easier by providing a helper method for generating those sequences.

@delucis
Copy link
Member

delucis commented Oct 15, 2021

I’ll close this as a duplicate of #478, but feel free to re-open if you think there’s something here that isn’t covered in that issue.

@delucis delucis closed this as completed Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants