Jump to content

Erroneous Random Number Generation in the whole game


Recommended Posts

expected behavior: The RNG used for certain operations in the game should get seeded with different seeds on every game load.

experienced behavior: The RNG used for certain operations in the game is wrongly seeded with the same constant seed on every game load.


tip of the day: While not being sufficient for cryptographic usage, you should AT LEAST incorporate the date and time stamp into the seed!


I firstly confirmed this fact in A19 with the contents of loot bags, which after reaching a certain level kept being the exact same for ever. Every first loot bag i opened in the game had the exact same content.


I reported that as a bug, but that report never got an answer, and the bug never got fixed, as i can now see in my first longer series in A20. Nowadays, the bug first occurred with vending machine contents being the exact same for the whole game EXCEPT if i had opened some loot box or bag beforehand - which occurred exactly ones in my 70 game days so far.


Since the deviation from the pattern occurred AT ALL, this confirmed that it is NOT INTENDED that vending machines do have the exact contents on every try.

Since the deviation from the pattern occurred exactly ones in about 30 tries, it is confirmed that the pattern is no rare coincidence.


See the following picture of vending machine contents i picked from the last videos (from the last few days): The one exception to the right was the one i wrote about three sentences further up (and which triggered the deja-vue-effect)...




Since the development of the character in this series was still in early stage, the contents of loot bags until now kept changing with every horde night. I will attach screenshot evidence about the boguous RNG as soon as i get repeating loot bag contents in this series.

Edited by White-Gandalf (see edit history)
Link to comment
Share on other sites

I disagree that this is a bug or a serious issue.  For vending machines, the contents are randomized every time the container is restocked.  Loading up the game itself should not re-randomize the contents of the container.


I did a quick test where I loaded up the same map twice, using the same game name (deleted the save so I can use the same name).  The contents were exactly the same on both starts.  I loaded up a new game and changed the game name from RWG1 to RWG2 and got different results.  The same thing applied to non-vending machines (3 trash piles and one car gave me the exact same loot items with RWG1 on both runs, and different loot on RWG2).


Randomization is a generic term where it can be applied in different ways.  For this game, each world seed / game name seed generates a new randomization that is applied to the containers throughout the world.  That is still randomization, and doesn't have to be reset every time a game is loaded.  It doesn't matter if the randomization is already determined ahead of time and applied throughout the game (and not redone every time the game is loaded up), that is still randomization (as the world was already randomized during generation).

Link to comment
Share on other sites

I interpret White-Gandalfs post differently: He seems to say that whenever you start the game (not reload the same savegame from a backup) that it also uses the same starting seed for looting. I.e. in a continuous series of normally playing a game the seed is always the same when you start the game on the computer.


That is unproblematic in normal use because people tend to start and stop the game at random in-game times.

But assume a player who always stopped playing at nightfall or morning and as the first action on starting a new session would always visit the trader in the morning. He would suddenly always get the same stuff in the vending machine because of the same starting seed.


Or someone usually logging off immediately at 4 am on a horde night and leaving the bag looting for the next session. He would get the same stuff in the loot bags until his lootstage crosses over to new loot tables.


If it does happen that way it definitely is not a serious issue but could be considered a bug.



Link to comment
Share on other sites

  • 4 weeks later...

Meganoth got that right: The problem at hand has nothing to do with determinism in relation to RE-LOADING a saved game. It has to do with determinism in relation to the CONTINUATION of the game AFTER EXITING it.


To clearify it by example: I am now on day 130 in that series where i took the pictures above. At the time i took them, i already had about 30 times the exact same contents of the vending machine - during the 60 days before.  And i had them only 30 times out of 60 because i didn't search that machine more often, just that 30 times i mentioned. Up to the current point, i WOULD have seen 130 times the exact same contents (and never anything other) in that vending machine, IF I HAD continued to visit it every day in my series. Because i always cut episodes at 6:00 o'clock. Thus, when i LOAD the game to CONTINUE playing, the random number generators are restartet, and always with the exact same initialization vector.


This last aspect ("always with the exact same initialization vector") is the culprit at hand.


The fact that those initialization vectors are dependent on the name of the game does in no way conflict with the fact of the described bug. Since the name of the game does not change between sessions in the same game.


The solution to the problem is extremely simple: Just do NOT use the exact same initialization vector! There are a multitude of methods available to get randomized initialization vectors. Every CPU nowadays has some built in, every operating system nowadays has multiple ones built in, every crypto library provides you with some - it should be a miracle to miss all and every offer presented to the programmers.

Edited by White-Gandalf (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...