From NWN Lexicon
Jump to navigationJump to search

Controversial Bug Report

The following statement is now thought to be incorrect:

The random number sequence is always the same for single player, but is usually different for multiplayer (assuming there is more than a single player playing in multiplayer mode).

  1. The random number seed is reset when you enter a new area. This is true for single and multiplayer.
  2. This seed is always the same for each area. The sequence for each area will be identical every time.
  3. This seed is some combination of bits taken from basic area information. If you create "identical" areas they will have the same seed, and therefore the same sequence. Obviously this is also true of copied areas.
  4. Bits are definitely pulled from the area height and width (in tiles) and the indoor/outdoor and natural/artifical flags. Changing any of these can change the sequence.
  5. Bits are not pulled from the areas tag, name, or resref. Changing these will not change the sequence.
  6. Bits might be pulled from the tileset field (not sure).
  7. There is a delay between the resetting of the seed and the calling of the OnAreaEnter script. During this period other scripts (heartbeats, perceptions, etc.) and maybe some hard-coded stuff can call the random number function, "consuming" the start of the sequence.
  8. If the module has nothing in it but the player character the sequence will therefore be identical everytime.
  9. If there is other stuff in the module the sequence will start at some point further down the list (as the first numbers have already been used). Since there is some variation in area load time etc.. this will be a random offset into the sequence. This is why it often looks like you have several sequences turning up, but really they are just different parts of the same sequence.
  10. The random seed works exactly the same in single player and multiplayer - at least when the multiplayer game only has one PC.

Confirmation that function is truly random


Acaos "the reseed is based on the server timestamp. Nothing else".