Replies: 1 (Who?), Viewed: 4701 times.
#1 6th Sep 2014 at 12:19 AM Last edited by clown : 6th Sep 2014 at 12:58 AM.
Thanks: 2993 in 122 Posts
Protocol buffer (aka the game save format) reverse engineeringSims 4's python code includes protocol buffers, a library from google to perform binary serialization of structured data, as well as a bunch of python serialization classes (in Game/Bin/Python/generated.zip) generated using that system.
protocol buffers works using a compiler that reads text files describing the data structures to serialize and generate classes that implement those.
It turns out that a serialized form of those descriptions are included as strings within the generated classes, so I have written a quick and dirty program to extract them, then I was able to simply use the protobuf library to deserialize those descriptions and regenerate the corresponding .proto files.
Those files are in the attached ts4-protocolbuffers.zip file.
Those files can therefore be used to regenerate serialization classes for in any programming language to read, manipulate and write whatever data sims 4 stores using this.
I don't know all the places where this type of binary serialization is used, but so far at least it seems used to store most of the game save data. .sav files from My Documents/The Sims 4/Saves can be opened with s4pe and contain one resource of type 0x0000000D, which contains a serialized SaveGameData message (whose definition is in FileSerialization.proto). This is basically the state of every lot/object/sim/game options and such, in a structured format.
I have been able to browse the content of a save as a big tree view using those .proto files and an extremely unwieldy protobuf data editing tool (http://protobufeditor.sourceforge.net/), but it should be relatively easy to build a dedicated save editing tool from those .proto files.
[Edit: I had attached the wrong file which included more crap than necessary, fixed now]
Pettifogging Legalist!retired moderator