I'm working on an algorithm (procedural racetrack generator) whose outcome, in the general case, is solely based on the RNG outputs. But in some specific scenarios, I need to provide to user the ability to bypass some generation steps (e.g. terrain conformation) without affecting the rest of the generation process.
As you can see, in the User-overridden racetrack case, the fact that the Terrain generation step is bypassed (and so no RNG output is consumed) alters all the subsequent generation steps.
What I'm looking for is some sort of RNG synchronization operation (probably not the most corrected term to use...) to put in between the Terrain generation step and the Surfaces generation step to have the same RNG stream from the * onwards, regardless if the terrain is provided by user or not. I thought about something like:
uint64_t seed = // initialized with racetrack ID
pcg32 rng(seed);
// Do Track shape generation step
// Do Terrain generation generation step
seed = seed + k; // where k is some constant
rng.seed(seed);
// Do Surfaces generation step
// Do Assets picking step
But I don't know if seed = seed + k; is a valid reseeding approach (or there's something better) and if some value is better than others for k.
[EDIT]
Forgot to state it, but the number of RNG outputs required for every generation step in not constant among different racetracks generation (and it isn't even predeterminable in advance).
I'm working on an algorithm (procedural racetrack generator) whose outcome, in the general case, is solely based on the RNG outputs. But in some specific scenarios, I need to provide to user the ability to bypass some generation steps (e.g. terrain conformation) without affecting the rest of the generation process.
Let me make a simple practical example:
As you can see, in the User-overridden racetrack case, the fact that the Terrain generation step is bypassed (and so no RNG output is consumed) alters all the subsequent generation steps.
What I'm looking for is some sort of RNG synchronization operation (probably not the most corrected term to use...) to put in between the Terrain generation step and the Surfaces generation step to have the same RNG stream from the
*
onwards, regardless if the terrain is provided by user or not. I thought about something like:But I don't know if
seed = seed + k;
is a valid reseeding approach (or there's something better) and if some value is better than others fork
.[EDIT] Forgot to state it, but the number of RNG outputs required for every generation step in not constant among different racetracks generation (and it isn't even predeterminable in advance).