joshuaauerbachwatson / anyCards

Multi-person card game with no built-in rules
Apache License 2.0
0 stars 0 forks source link

Fix player list management #3

Closed joshuaauerbachwatson closed 1 year ago

joshuaauerbachwatson commented 1 year ago

In the present state of the app, there are actually two player lists: one is inside the Swift GameState structure understood only by clients (for now) and the other is shared with the server (mimicking the low level "connected devices" management that exists in the peer communication package). For now I'm keeping this. Since I am, it is important to use the lostPlayer upcall when the server-based list loses a player. Once making that change I have to verify that it fixes the problem with duplicate entries in the visible list of players.

joshuaauerbachwatson commented 1 year ago

It does not appear that adding the lostPlayer call will actually fix the problem. It appears that the player list gradually grows with duplicate entries when the game is repeatedly started (pressing the FindPlayers button) and ended (pressing the EndGame button or responding "End Game" to a communications error popup). This can happen even if no remote players are ever found (the duplicate entries are duplicates of the one local player that is configured to the game, probably with different order numbers).

joshuaauerbachwatson commented 1 year ago

Accumulated fixes, both under this issue and others, have fixed the problem. It is now possible to start and end games with matching and stable player lists.