Save a procedural generated map

Hello, i am making an endless runner mini project, the level is being proceduraly generated at runtime and it consists of the floor tiles and cube obstacles that are also proceduraly generated. When the player hits one of the cubes the level restarts, i’d like to save the locations of the obstacles when they are first created and have them be at the exact same place regardless of how many times the player dies and restarts the level, only reaching a certain amount of distance will advance the level and generate the next map and so on so forth.
I thought i about making a transform array and check if player has died to do a foreachloop and then spawn actors to from that array but i was not able to make it work. Any help please?
Thanks!

You could use USaveGame to store the state of your level after the initial procedural generation and then on subsequent restarts, reload it if the USaveGame exists. If it doesn’t exist, you do the procedural generation at startup, because the lack of an existing USaveGame would indicate a fresh playthru of the level.

Perhaps you already were attempting this with the Transform array, but the USaveGame is the place to store it such that it will still exist on restart. The USaveGame will put your Transform array (and other level status indicators) to storage.

Thank you, it works.

How about multiplayer ? The seeds where should I start from? I got stuck

Sorry, never been involved in multiplayer development. Maybe someone else could comment.

So i was able to save the locations of everything that got generated and worked exactly as expected, but i’ve come across another issue. I’ve decided to increase the amount by quite a lot, that’s around 1.5k cubes for the entire level, however there’s an insane performance drop when the player dies and the level is being loaded, i guess its to be expected since its generating this much volume at the same time.

So my new question is this:
If i generate the level and the cubes as the player passes through trigger boxes so they are generated gradually and not all at the same time, and save all their locations etc, is it possible on the load state to have them also generated when the player passes the trigger boxes and keep their previous saved location?

I am a little lost at this point…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.