joshuaauerbachwatson / anyCards

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

[Bug] Nearby-only mode is too chatty #25

Closed joshuaauerbachwatson closed 1 year ago

joshuaauerbachwatson commented 1 year ago

Looking at the trace during a game it appears that there is constant receipt of 161 bytes of data and constant sending of gamestate

joshuaauerbachwatson commented 1 year ago

Although this is observable using MPC I think it probably occurred in server mode too. It was due to the fact that we echo an incoming game state when the player list changes, but we were (erroneously) setting the changed flag just because an incoming game state had the numPlayers value set. A non-leader player echoing the game state will leave numPlayers as received, so this 'change' keeps on being observed. The fix was simply to not set the changed flag in that context but only if there was an actual change to the contents of the player list.