Instead of doing all the diffing in each class, maybe make a UiState class which represents what the UI should look like for a given player.
At the end of each frame, recalculate the current UiState and compare it to the previous UiState served to the player.
Fields which haven't changed should be treated similarly to MaybeChange.
Convert the UiState to JSON and send it to the client.
Instead of doing all the diffing in each class, maybe make a
UiState
class which represents what the UI should look like for a given player. At the end of each frame, recalculate the currentUiState
and compare it to the previousUiState
served to the player. Fields which haven't changed should be treated similarly toMaybeChange
. Convert theUiState
to JSON and send it to the client.