how do i generate a series of predictable numbers and non predictable numbers at the same time

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By XavierH622

i want the terrain in my world to generate the same every time (i.e trees are in the same place) given the same seed,
but loot chests/enemy AI/enemy drops/etc to be non-predictably random.

Why can’t You use two seeds ?
One calculated using stable ID and another one calculated using randomly generated number ?

Inces | 2022-07-08 14:47

Yes, what Inces said. The point being that the same seed will always generate the same sequence. So, for the stable number set, always use the same seed. For the unstable set, use a random seed.

jgodfrey | 2022-07-08 17:21

You could use a uniform distribution RNG for the non-predictable random (the larger the minimum and maximum value, the least likely every number in the bounds will be generated) and for the predictable RNG you could use some other distribution (maybe a normal distribution) so that most of your RNG values lie within close distance to each other.

You could also go with another approach where you manually define the probabily of each event you are workign with. So if you want trees to be common in certain areas, then when you are in a forest area, the probability of a tree spawning in a cell should be increased vs. the probability a tree occurs in a cell of a desert. For enemies you could similarily define the probability of enemy encounters, and you could fine tune the probability based on things like sneaking vs. not sneaking, in an enemy base, etc.

godot_dev_ | 2022-07-12 17:30