Save and Load – success

Seriously, I thought I would have to pick it up again at a later point, but after drinking a good sip of whiskey, I finally found the right solution.

My problem with saving and loading the world object (which contains a two-dimensional array of WorldCells, aswell as a two-dimensional array of the Tile (enum)). I totally started it the wrong way. I wanted it to output into an xml file. I used XStream for the serialization and deserialization. It gave me an xml file, 38 mb huge and of course readable and editable, which I didnt want. I succeeded, after many hours, to save the world as I wanted it, but then - this was my biggest problem- I couldn't load the file back. I was browsing the web for hours reading about enum converters and stuff. All too complicated!

Today I sat down and after 10 minutes I was done.
What did I do?
It's easy:

Continue reading