Introduction
Today I released version 0.1 of Chronus on IndieDB, which was quite exciting. I fixed the last really major issues regarding serialization, and thus I thought it would be a pretty good idea to release.
So first thing first, I should probably exactly what serialization is.
In layman's terms, serialization is the process of taking some data from your game, and storing it in a file. Deserialization is what happens when you, for instance, load up a saved game (i.e. taking data from a file, and putting it into the game). In Chronus I use serialization for a bunch of stuff, most importantly though, for saving ships in an XML file. I've done several iterations of this system, and at the moment I believe I've found the very best solution to one of my main problems being...
How does one create easily manageable files
This is something that I've thought about quite a lot. What's the best way to actually store these ships. At first what I did was I created an XML file per profile, containing data for each ship attached to said profile, but that created another issue - what if you wanted to share your ship with your friends? Then they'd have to get the data from your entire profile. That wasn't any good.
Instead I ended up with the current system. Each profile has a folder and inside each folder you will find two types of files. A .profile file and a .ship file. The profile file is kind of boring (Currently stores time played, shots fired and blocks placed, basically it just stores stats), however, the .ship files are quite interesting. Whenever you save a ship in-game, it will create a new .ship file, which makes it quite easy for you to share you creations. Simply send the ship file to one of your friends, and have them place it in their profile folder
Nicely named ships in a profile folder
How does all of this work?
I don't think it's a secret that I didn't write the entire serializer from scratch. After all, it's a project I'd like to have fun with, and writing a custom serializer would simply take up too much of time I'd rather spend on writing game mechanics.
I'm using Unity Serializer, which is a free Unity extension created by Mike Talbot. It's incredibly easy to work with, and has allowed me to go from no serialization to everything described above in a matter of a week or two. All I've had to write is the XML serializer, alongside the functions I use to maintain profiles, ships and so forth. I can highly recommend it to anyone looking to serializing anything in Unity.
Update on a patch for 0.1
In a day or two I'm going to release a patch for 0.1 which will be the first stable build of Chronus. At the moment it's quite unstable, and includes a few pretty large bugs. I've already fixed the worst of them (Loading large ships crashes game), and hopefully the rest will come along quite easily. In the meantime I hope people will try out the game and have some fun with it.
- Daniel Everland