Hello dear JGO
I am in need of a proper way to save my game to files.
The options i looked at are mainly XML/JSON/Serialization/Custom, and the ones i consider are JSON, Serialization and a custom parser.
My problem with this whole thing is, that my components get more and more complex, and use a lot of data types (float, bool, int etc. which is not the problem) and also objects of other classes i wrote for specific Components.
So basically, my components contain basic data types, and class objects which again contain other class objects.
This was great for programming small Components, since i could simply initialize my Components with behaviour of classes i wrote specifically for them.
I tried serialization, but then i would need to implement Serializable on EVERY SINGLE class i used in the component(right? Oo), which seems to me like a dirty solution.
Serialization seems great and easy, but makes things pretty much invisible to debug, and hard for me to adjust my engine architecture to it. Also, i will have a lot of entities on different layers(like in a tile map) etc.
On the other hand side, if i were to use something like Json, i would have the problem of needing to save one of my class objects as a string description of some sort, and then load it by identifying the string, get its values stored in a similar descriptive way, and then create the correct class objects from that.
Which is pretty much reinventing the wheel, allthough it may be a bad way of doing things.
I really have no idea how to approach this problem. And yes, i have tried to simplify my components by quit a bit, but that doesnt change the fact that i dont want to write a new component(and sometimes also a system) for each and every type of Plant, for instance.
I would really like to create a simple parser, game->Text->Game, for my loading and saving (i dont need obfuscation/encryption), nor am i working with a team.
I am ‘off course’, using Java(LWJGL)…
Really need some help from the masters