So I’m currently looking into saving when going between levels, but I can’t get my head around how to do it in a good way.
What I have is the following scenario:
An overworld map with X amount of Armies.
Each army consists of 12 squads.
Each squad is between 1-9 soldiers.
And each of these soldiers have stats like Name, experience, skill etc that is saved between battles
What I would like to do is save the armies in an array in a Game Instance asset. And each of those Army actors contain an array for each squad in that army, that should contain the variables for the stats of each soldier in that squad.
But here is where I’m at. I am not sure what kind of asset to use to store those variables. A Data asset? A Blackboard? Just plain actor blueprint? Or something else entirely?
All I need to store are a few strings, bools and floats that I can then load when a battle is started.
Yeah I’d go with a Data_Asset class for each soldier type that can be called up when needed, or even a Data Table.
If the soldiers are highly specific (IE Steven, Amanda, Jacob vs Bomber, Striker, Sniper etc) you won’t want to do that, you would want to create an instance of a “Soldier” struct blueprint that stores data like HP, Speed, Range, whatever. Then add that to the array on the game instance.
Rather than trying to organize this for all these people all at once ( which will not go well ), I’d recommend teaching ( coding ) the soldier so they know how to save and load their own data.
That way, you just have to get them to save before you go to the next level, and load when you have entered the new level
You make make a struct, that suits all of them, which holds these basic variables. Then all the save game needs is an array of these structs. Each soldier gets an ID, which is their offset into the array.