Multi Level Time Records Saving

Hello !
I’m currently working on a game that features “Challenges” or short levels packs with time scores.

It goes like this ;

Jump_01 Is a persistant level that have 10 sub stages, i call this a “Challenge”

  • Jump_01-0

  • Jump_01-1

  • Jump_01-2

  • Jump_01-3

Then i will have other Challenges Like Jump_02, Jump_03 or even Wall-Jump_01 and maybe Combat_01 and so on.

All of theses Challenges will have 10 sub-stages each. (Jump_01 is the persistant level name that contains the sublevels)

When the player start the level from the Menu, he loads Jump_01 and all the sub-stages.
When the player complete the first stage, a TimeBoard is shown, displaying :

  • His current chrono time (the time he took to complete the sub-stage)

  • His Previous Best Time (the player previous best time record)

  • The Dev Time (the time i took to complete the stage)

It goes like that for all the sub-stages and when you complete the last stage (the 10th stage)
The game will display the stage scoreboard like usual, but when the player press a Key he will then be shown the whole level time board.

This Board will display in multiple lines the Current time, Previous Best, and Dev Times for all the sub-stages.


My problem is how to save and load theses values.

The current system i have works with a single Challenge level pack.

In my Challenge Savegame asset, i made float array variables for the time to be stored.

And when i need to check if the player time is a new record (and therefore needs to be saved) i get theses array variables that way :

So i have a Level to Time map, that uses an Array of “worlds” and that allow to know which sub-stage you just completed, then i know the index to search in the Array variables.

If the loaded level is Jump_01-05 then the index is 5, so i search the Best times Array at index 5 and compare it with the chronometer value and decide if i should save or not.

However this system is extremely cumbersome and i think it is overcomplicated.
It work for a single Challenge but it will become a headache when i’ll have 20 or more Level-Packs.
Also since i would love to have a lot of theses Challenges, its very slow to create the arrays manually for each levels.

I would need a way to dynamically create and save unique arrays for every Challenge (Level Packs) loaded.

So if i open the Challenge : Wall-Jump_01 it would create the Previous Best Times Array, The Current Best Times Array and populate them as i progress in the Sub-stages of my Challenge.

Is there a way to do that while minimizing the amount of tasks i have to do manually for each Challenge ?

Do you have other ideas on how i could handle that ?

1 Like

I think maybe you’re running into problems because you’re naming the arrays literally :slight_smile:

You could make a totally re-usable data structure using an array of structs, for instance.

Make a struct of your two float arrays and the single float, then have an array of that struct.

Then all you have to do it choose the correct index into the array of structs to update.

So i would need a DataTable with that Structure, but how do i save it in my SaveGame then ?

I need some kind of variable array in my savegame, but if i save Jump_01 and then Jump_02 the SaveGame variable will be overriden with the new values…

Sorry, i can’t understand how it would work ?