Difference between revisions of "Talk:Random"
m (Protected "Talk:Random" ([Edit=Allow only administrators] (indefinite)))
m (Removed protection from "Talk:Random")
Latest revision as of 00:53, 4 July 2020
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).
- The random number seed is reset when you enter a new area. This is true for single and multiplayer.
- This seed is always the same for each area. The sequence for each area will be identical every time.
- 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.
- 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.
- Bits are not pulled from the areas tag, name, or resref. Changing these will not change the sequence.
- Bits might be pulled from the tileset field (not sure).
- 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.
- If the module has nothing in it but the player character the sequence will therefore be identical everytime.
- 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.
- 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".