It would be fairly easy to do automatically once a game ends but maybe not for the before case because there is not really a "before the game starts" state, I would probably need to check the game state to make sure no one has any scores yet. In other words a rule like:
Shuffle players only works if all players have no score events following a "game over" event
This is because the "game over" events are added to the history array and not cleared at the end of the game.
Perhaps I need to filter out old games from the history array at read time so:
History (scored, etc.) from old games are not displayed to the user
The number of won games can still be displayed
This could be done in two places:
When reading the history array (split on "game over" and take the last one)
In the reducer, so the history array is only the current game and add a "number of wins" key
Alternatively I could allow it at any point throughout the game, but that could potentially disadvantage players who get swapped to follow an aggressive player. The system should probably keep this to luck of the draw.
This feature was traditionally used in two cases:
It would be fairly easy to do automatically once a game ends but maybe not for the before case because there is not really a "before the game starts" state, I would probably need to check the game state to make sure no one has any scores yet. In other words a rule like:
This is because the "game over" events are added to the history array and not cleared at the end of the game.
Perhaps I need to filter out old games from the history array at read time so:
This could be done in two places:
Alternatively I could allow it at any point throughout the game, but that could potentially disadvantage players who get swapped to follow an aggressive player. The system should probably keep this to luck of the draw.