Randomly Generated Map Help with Seeds

Hey guys, I’m new to C# and Unity in general, so I’m having a hard time with this. I have a randomly generated maze that when you go down a set of stairs you go to the next scene with a randomly generated maze. I wanted to know how if I could create a seed that can load up the last scene with the same exact same seed. Thank you

You have two choices:

  1. You save a master seed which is used to decide the seed values of all levels.
  2. Every time you generate a seed you save it somewhere (you probably want to wrap the seed getter into a function that first looks at storage to see if it already has one, if not, it generates a new one and stores it).

Ok cool, that makes sense. How would I go implementing it? Is there any specific code?

Nothing specific, you’ll probably have to code it up yourself.

Alright, I have no real idea how to start. Do you have any articles or tutorials that might point me in the right direction?

Set the seed. Serialize the seed. So, for a particular save file, you serialize the seed its master used. The master could be used to generate the specific-level seeds, so you don’t need to save the others necessarily. For a serialization framework, if your game is very simple you could get away with using Unity’s PlayerPrefs. If more complex, then you likely are looking at XML or JSON (using for example JSON.NET).

Ok, I’ll mess around with it for a bit