rnd generator

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
Kamor
Posts: 1
Joined: May 12th, 2022, 4:16 pm

rnd generator

Post by Kamor »

Game is really nice, but your current rnd is strange and often frustating.

I have not looked in your code, but i think you use a predefined c++ rnd generator.

So first:

If you have managed to implement a good and balanced rnd logic and use the same generator for both players, your balanced rnd logic becomes inbalanced.

Simply think this, you roll for one player the same 50% rnd generator and have a good balanced flow, sometime you have win strikes, sometimes loose strikes, but at all you have a good miss, hit, miss, hit.

Now when you use this logic on 2 players, this changes to player 1 miss, player 2 hit, player 1 miss, player 2 hit, ...
...
Of course later it also changes to the opposite player 1 hit, player 2 miss, player 1 hit, player 2 hit, ...

In game this feels often really frustating, if you miss 10 times on 30% and your enemy hits 5of6 times in a row on 40%.

And this situation happens very often.

...

So simply by using 2 independend rnd generators, each player one, you can improve your logic.

...

You can also go for 10 rnd generators, 5 for each player, one for 30%, one for 40%, one for 50%, one for 60%, one for 70%. This will balance the different hit chances better.

...

Next: I have noticed that the miss strikes on 40% hits are more often, than the hit strikes on 60%? How can this happen?

Do you have a wrong logical comparison in your code? Happens very fast, one line < instead of <= and your chances changes this way.
30% -> 20%
40% -> 30%
50% -> 40%
60% -> 50%
70% -> 60%
If your logical comparisons are correct, there must be another reason why i miss more more often in rows on 40%, than i hit on 60% in rows?

...

Finally: Have you tried to write your own rnd generator, perhaps using a microphone, recording rainfall and use this instead of using PI or other math logics, only ending in a kind of oscillating pseudo rnd?
dwarftough
Posts: 234
Joined: August 4th, 2019, 5:27 pm

Re: rnd generator

Post by dwarftough »

Kamor wrote: May 12th, 2022, 4:46 pm I have not looked in your code, but i think you use a predefined c++ rnd generator.
No, the game uses the Mersenne Twister, which is good.
Kamor wrote: May 12th, 2022, 4:46 pm Simply think this, you roll for one player the same 50% rnd generator and have a good balanced flow, sometime you have win strikes, sometimes loose strikes, but at all you have a good miss, hit, miss, hit.

Now when you use this logic on 2 players, this changes to player 1 miss, player 2 hit, player 1 miss, player 2 hit, ...
...
Of course later it also changes to the opposite player 1 hit, player 2 miss, player 1 hit, player 2 hit, ...
No. 50% only means hitting with probability = 0.5, that's it. It doesn't mean anything, it certainly doesn't mean "hit, miss, hit, miss" patterns, that's not good randomness! It's a predictable pattern. Neither it means those patterns should occur often.
Kamor wrote: May 12th, 2022, 4:46 pm So simply by using 2 independend rnd generators, each player one, you can improve your logic.
It's not needed, the game uses good rng, and each his roll is more or less independent (the Mersenne Twister has good characteristics).

You suppose than all hits happen for one player and all misses for other but that's not how randomness works.
Kamor wrote: May 12th, 2022, 4:46 pm If your logical comparisons are correct, there must be another reason why i miss more more often in rows on 40%, than i hit on 60% in rows?
You just notice those situations and think that they are often. Psychological bias.
Kamor wrote: May 12th, 2022, 4:46 pm Finally: Have you tried to write your own rnd generator, perhaps using a microphone, recording rainfall and use this instead of using PI or other math logics, only ending in a kind of oscillating pseudo rnd?
The game is crossplatform, so that would be hard. And the Merseen Twister is good enough
mesilliac
Developer
Posts: 81
Joined: November 18th, 2005, 8:09 am
Location: New Zealand

Re: rnd generator

Post by mesilliac »

For single-player there is a "Biased RNG" option which may do something more like what you want.

It makes results look more random, by making them less random.
Post Reply