openomf
openomf copied to clipboard
Demo has a super high probability of matching the same pilot against themselves
As the title says. If you watch the demo enough you will notice that >50% of the time the pilot will be matched up against themselves.
We might need to look into an alternate random number generator for seeding the pilot_id/har_id.
Not a big deal this one obviously but having an alternate rand_int method somewhere would be a major improvement and i could re-use it in the AI logic too.
Having a better random generator is probably a good idea. Only point is that the generator must be seedable and produce consistent results on different machines when using matching seeds (for network support).
The problem is probably because on insufficiently random low-order bits in the generator and a bad algorithm for range reduction.
I suggest PCG as a generator. It's small, fast and has good randomness.
For range reduction check out https://www.pcg-random.org/posts/bounded-rands.html. TL;DR: there's a bunch of ways of doing it, most of them wrong in some way. Pick one of the ready-made unbiased ones to avoid strange issues like this.
Huh, didn't know about PCG, seems good to me.