Asking for advice on an issue I'm sure other Studios or developers have faced.
I have a problem. In my game, I have a very large player state. It's contains a global state for an RPG game. It contains arrays of state objects for everything like dialogue tree read counts, quests, simple ints, bools, and strings, and AI schedules.
It's large enough that simply serializing the data causes a hiccup in the game.
My first thought was that I should move this work to another thread. I cannot guarantee that the game state will not change on the main thread while the worker thread is serializing. The player is free to interact with the game world during this time. The worker thread that handles serialization will need to operate on a copy of my game state for the reasons of thread safety and data integrity.
My concern is this: the game state is complicated enough that making a deep-copy is not an easy task. As a experienced dev, I have confidence I can make a perfect deep-copy of my game state, but my concern is that I will end up making my project 'brittle' and hard to maintain for the rest of the team. If a junior dev adds a field to a game state class, but forgets to update the clone method, I now have a very hard to spot bug in my code.
So how do other studios or developers handle this catch-22? I have to believe that this is a solved problem in Game Development, but I haven't come across any literature on it.