Right now the order of players is always set. But in different rounds, you want a different order for players, and you might want to swap it based on roles, etc.
This can get really complex if you allow the order to change lots of thing.
The best way to do it is likely just have a GameDelegate.CustomPlayerOrder() []PlayerIndex .
That must return either nil (default) or each player index from 0 to len(players) -1, in whatever order it wants. The only effect it has is that PlayerIndex.Next() and Prev() will have their order changed. Now those will look up the current player's index in that, then increment the index within THAT and see which player that means is now active.
And you can imagine a behavior for GameState that you can embed that has the player Index slice and that GameDelegate's CustomPlayerOrder uses if it exists.
Ideally this player order and grouping would show up in the player roster rendering. That's probably better handled in e.g. #749
Related to #752 .
Right now the order of players is always set. But in different rounds, you want a different order for players, and you might want to swap it based on roles, etc.
This can get really complex if you allow the order to change lots of thing.
The best way to do it is likely just have a GameDelegate.CustomPlayerOrder() []PlayerIndex .
That must return either nil (default) or each player index from 0 to len(players) -1, in whatever order it wants. The only effect it has is that PlayerIndex.Next() and Prev() will have their order changed. Now those will look up the current player's index in that, then increment the index within THAT and see which player that means is now active.
And you can imagine a behavior for GameState that you can embed that has the player Index slice and that GameDelegate's CustomPlayerOrder uses if it exists.
Ideally this player order and grouping would show up in the player roster rendering. That's probably better handled in e.g. #749