So the Boost::Serialization library is amazing and is exactly what I need for this project, although slightly confusing to get working if you have complex objects like I do. What serialization is, if you don't already know, is converting objects/variables/basically anything into data that can be stored into a file and later reloaded. The troubles I had with serialization combined with figuring out how to organize my data was a real bugger. I couldn't really do one without the other.
When it comes to coding, I like to be very organized, so I tend to put everything into classes/structs like categories. This can sometimes prove to be a problem as it did with serialization. I have it basically set up like this:
struct Equipment{ struct Helmet{ Helmet(string n, int val, string eff){ name = n; str = val; effect = eff; } string name,effect; int str; } struct Shield{ /****Same as Helmet****/ } etc... }
So when I need to make a new item, I just make a new pointer to it like
new Equipment::Helmet("Wooden Helm",1,"");
and put it in some sort of vector or something.
Anyways, back to the point. I was so perplexed at how to go about serializing this because of the complexities. It was getting pretty late and my brain felt like it was going to explode. I decided to sleep it off and hey, what do you know? I figured it out the next day. Phew! I can now save games.