What are the characters that get inserted using the SaveGame gem?


It’s working fine. It has been working fine for years. But there’s a bug I’m trying to track down: Some of my pawns are getting saved/loaded twice and I want to find out where exactly they’re getting saved. I thought parsing the JSON would tell me where they’re getting saved, but nothing I’m using can make sense of the JSON. It seems that when UDK saves the file, it puts in a bunch of characters that only make sense to UDK.

Any idea what these characters are supposed to be, or how I can parse through them?

I don’t think you’ll get much valuable information even if you can parse them. the human-readable stuff is really indicative of what is in the save file (i.e. the weird characters arent hiding more pawns)

I’ve had a similar problem (my companions/followers would get loaded twice) and for me what worked was to just debug my save/load functions (it was a logic error in my code)

it’s probably easier if you `log every character that you serialize while you’re saving it (when the savegame happens), than to try to parse the file

Thanks Chosker. I ended up being able to parse the JSON file after using some regular expressions to replace anything that wasn’t a regular character. But in the end, like you said, it wasn’t all that informative. The pawns were just getting saved twice, but I did at least have some idea of where they were getting saved. It was a problem in my save logic too.

Chances are it is something to do with either how the SaveGameState you created is setup or the serialization function in your game framework code.
I had a similar issue working on my first game that was easily fixed by eliminating a duplicate set in my gametype class.

It would help if you can show us how you fixed the problem (presuming you did).

I’m afraid my fix was very specific to my own game.

When I save the game state, first I serialize all the team controllers. The team controllers save a json object that holds all of their squads. The squads have a json object that holds all of their pawns. Then the team controllers create a json object for holding all of the pawns that are not assigned to squads. And then finally, the game state saves a json object for all of the pawns that are not assigned to a team. My problem was that my unassigned pawns weren’t aware of which team they were on, so although their respective team controllers saved them, when the game looked for pawns not on a team, it saved them again.

That actually makes sense. You needed to have those pawns serialize their teams. Have the Save Game State check if those pawns have a team controller (or team info if necessary) and exclude those that do.