Download

How to organize huge amount of data to be persistent among levels

Hello, I have been reading and watching tutorials about this but still a bit confused.

Ok, so in the engine you can have different maps (or levels) where any specific data related to them is lost when transitioning from one level to another. Additionally you can use your own GameInstance to store persistent data among levels.

Now let’s say I have a strategy-building game where I have 3 main levels:

  1. Your colony where you have all your buildings together with a lot of info about each one. Let’s say 1000 buildings with their coords, state, health, etc.
  2. An outside map of your colony where there are plenty of units around, resources, etc.
  3. Cinematics and dialogue with the player for quests, diplomacy, etc.

If in the middle of a game the player switch to the outside map, and after a few seconds switch back to the colony map. Am I supposed to load/save the thousands of variables involved in the different maps?

What about if I also want to store another bunch of state variables like, how are your relations with the rest of the factions; the spawn list for incoming new resources to the map, incoming events, how is the weather, etc… Where am I supposed to store them to be persistent?

How would be loaded/saved to a file the vars from all the levels?

Thanks :wink:

How much data are we talking about?

In 10MB you can store a many many many variables. 1000 buildings with coords, state, health is nothing. Would take a few kb?

Try to figure out how much data it actually is. Storing 10MB in memory all the time wont be noticable by the player. Storing 1GB will get you into some soft of trouble.

Hi Martin,

Imagine Civilization game where the hex map containing hundreds of units is in a level and each time you enter a city a new level is loaded, and when you exit the city you are back in your hex map.

The question is… Do I really need to re set all the actors in my hex map each time I switch the loaded level? What I want is to make persistent my main level, I don’t want the actors in my map to be reset because momentarily I loaded another level to do things like… showing a cinematic to the player.

Thanks :wink: