Not sure where to put this info, so I'll put it here. It's also scattered in Kanban and comments.
In the map-tile-overhaul branch I have somewhat out of necessity combined:
- Migrating to the Civ3Map (renamed from LegacyMap) display code (supports all base terrain graphics including mods, uses the file & index references Civ3 uses instead of bitmasking tile selection)
- Creating a serialized save format
- Importing map data from a Civ3 save
- Making a "static" or loaded-by-default JSON save file
- Reading the JSON save file into GameData
The good news is that the pieces are all there to save and load GameData, and import a Civ3 save directly into that format (as a GameData instance which of course is now serializable to JSON).
But it's been quite a journey, and it's not done. For the import I'm mocking two dummy players and reading in the data needed to display the map, but nothing else (yet). It also needs to be integrated into what Flintlock has done with scrolling and layers. Right now I'm just adding the Civ3Map which lays on top of the old map, and the new one doesn't pan or zoom (yet). Also, the old map is now all plains because I had to comment references out to mapgen stuff to prevent runtime errors.
I'm loading the JSON file in the create game entry point which is not the right place, but I just got it to display the map without runtime errors, so that's coming.
Other oddities: I may have changed some fields to getter/setters or vice versa while troubleshooting because at times it made a difference in whether serialization/deserialization worked, but I understand now you need to have the right JSON de/serializer options configured on both ends. I also definitely opened up some setters because the serializer needs to be able to write, and it needs a no-parameter constructor. We can start locking that down again I think once code migrates to where it belongs, and we can then use protected or protected internal to lock it back down again.
It's a bit of a pain, but coding a bridge between the serializer and game data would almost certainly be an even bigger pain to maintain over time.
Oh, and the save format right now is just a child of GameData with a version string added in. We can add other metadata that way, too.
It's obviously not ready to merge, but it's late, and I have 3 or so hours of meetings in the morning, so not sure how derailed I am for now.
Edit: My strategy has been to get us onto what is now the Civ3Map code and then integrate better with the current state of things, and then look at optimizing away from TileMap. I kinda think that last part will be easy as I'm already making my own tile reference index, so it seems like it should be trivial just to use that to grab individual sprites instead of from a TileMap. But first I gotta make it and MapView get along. (I also want to refactor TempTiles to keep up with Civ3Map...TempTiles is a very handy tool for me still.)