Here are all the villagers that a popular streamer had at 17 minutes into a ranked RM 1v1 ladder game. Notice anything weird?
Game information
- Version: 101.102.33868.0 (#99404) 12936891
- Platform: Stream
- Operating System: Windows 11
Issue
Sometimes in the first part of a multiplayer game, all the things that are supposed to be random seem to be giving very predictable results. All the villagers are born with the same sex, and all the birds cluster in one place.
The birds can be a distraction for players (I saw a pro streamer get really annoyed at them one time). Also, randomness plays a role in arrow mechanics, animal movement, and monk conversions. If the villager ### is not random, I think it’s quite likely that those other mechanics are broken as well during that time period.
Below I have attached a replay where you can see the bug in action. In the first 17 minutes, the players spawned a combined total of 64 villagers from their TCs, and every one was male. (Note that 4 of the starting villagers were female.) With a working random number generator, the odds of this happening are extremely low: you’d expect it to happen once every 2^64 games, which is 36,893,488,147,419,103,232 games. If you add the fact that the birds were all clustered in one place, the odds of this game being the result of a working random number generator get astronomically lower.
(The issue does seem to fix itself at 17:22 in the replay.)
Frequency
This happens less than 25% of the matches I play (RARELY).
Reproduction steps
I don’t know how to reproduce it reliably in a new game, but you can take the replay file I’ve given you, fast forward to 17 minutes, and note the ### of the villagers and the location of the birds.
Expected result
Villagers should have an equal chance of being male or female, and the birds should fly around the map instead of just going to one place.
Image
Here are some screenshots from the attached recorded game.
Birds all in one place:
Survivalist’s villagers, all men except for 2 of the starting vills:
MORG_11’s villagers, all men except for 2 of the starting vills:
Recorded game
terrible_rng_17mins.aoe2record (1.4 MB)
Comment
You can implement a single-threaded pseudo-random number generator in about 3 lines of C. The RNG from Newlib basically boils down to this C code:
uint64_t seed = ...;
int rand()
{
seed = seed * 6364136223846793005 + 1;
return seed >> 32 & 0x7FFFFFFF;
}
If there’s some bug and you don’t seed this random number generator, the first random value will be 0, but then after that it will immediately start giving numbers that at least look random even if they aren’t.
A similar bug was reported 3 years ago but the documentation was lacking.