Proceduraly generated level save and load with triggers?

Every time you spawn a tile, you add one to a tile ID counter. For the tile we are about to spawn let’s say it is 25.

For the sake of simplicity, we just spawn a cube obstructor, in one of 4 positions. We can either remember the positions with a number ( 1234 ) or the actual vector. Doesn’t matter.

So now, we write into the save game ( 25, 3 ) - 25th tile, cube is in position 3.

Later, the player restarts the level. We are busy spawning tiles, we get to tile 25, and see the cube has to go in position 3 :slight_smile:

More generally, you would probably have an array of structs. Each struct has all the random spawning info, and the index into the array of struct is the tile ID.

If you need more info, maybe tell me a bit more about what sort of obstacles you’re spawning.

1 Like