Since my project involves a fixed number of tokens that can be in several potential locations, I decided early on to update this.gamedatas to reflect the current and previous location of every object so that all of the animation can be centrally coordinated by a single function whenever a notification moves things around.
This has been great for keeping the project organized, but where it has become an issue is in the in-game replay whenever a user undoes their turn. At that point, the interface is reloaded and reflects the final location of all of the objects based on the current gamestate. Then, historic notifications try to run against that state, which either moves tokens back to previous locations or produces errors from functions trying to reference objects that don't exist any more. I haven't seen this occur with post-game replays.
All my undo function does is call $this->undoRestorePoint() on the server side and this.restoreServerGameState() on the client side. This hasn't caused a problem anywhere else. Is there something I can do to make sure that this.gamedatas reflects the correct historic state of the board in this situation?
Edit: important detail about what my undo function was doing on the PHP side.
This has been great for keeping the project organized, but where it has become an issue is in the in-game replay whenever a user undoes their turn. At that point, the interface is reloaded and reflects the final location of all of the objects based on the current gamestate. Then, historic notifications try to run against that state, which either moves tokens back to previous locations or produces errors from functions trying to reference objects that don't exist any more. I haven't seen this occur with post-game replays.
All my undo function does is call $this->undoRestorePoint() on the server side and this.restoreServerGameState() on the client side. This hasn't caused a problem anywhere else. Is there something I can do to make sure that this.gamedatas reflects the correct historic state of the board in this situation?
Edit: important detail about what my undo function was doing on the PHP side.