Biased RNG in MP
Moderator: Forum Moderators
-
dwarftough
- Posts: 623
- Joined: August 4th, 2019, 5:27 pm
- Contact:
Biased RNG in MP
Since 1.16 the Biased RNG has been available in SP. It makes the outcomes of battles follow the expected value much more closely drastically reducing the variance. Choosing a different RNG is not supported in Multiplayer, so this mod tries to emulate the Biased RNG behaviour.
It's almost certainly incompatible with Advanced Wesnoth Wars and it's very possible more addons incompatible with this. Make sure to leave bugreports here!
Summary how it works: it calculates the expected value, which is EV = strikes * chance to hit. If it's an integer, the unit hits exactly EV times. If it has a fractional part, then the unit hits floor(EV) times and may make one extra hit with probability fractional_part(EV). The order of hits and misses is still random. For example: Mage has 3 attacks with 70% to hit. EV = 3 * 0.7 = 2.1. So Mage will hit two times surely and with probability 10% one more time.
Special thanks to celticminstrel and Ravana for their great help in Wesnoth's #modding channel that made this mod possible.
It's almost certainly incompatible with Advanced Wesnoth Wars and it's very possible more addons incompatible with this. Make sure to leave bugreports here!
Summary how it works: it calculates the expected value, which is EV = strikes * chance to hit. If it's an integer, the unit hits exactly EV times. If it has a fractional part, then the unit hits floor(EV) times and may make one extra hit with probability fractional_part(EV). The order of hits and misses is still random. For example: Mage has 3 attacks with 70% to hit. EV = 3 * 0.7 = 2.1. So Mage will hit two times surely and with probability 10% one more time.
Special thanks to celticminstrel and Ravana for their great help in Wesnoth's #modding channel that made this mod possible.
Co-founder and current maintainer of IsarFoundation, Afterlife Rated and overall Wesnoth Autohost Project
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP
Re: Biased RNG in MP
Code looks like it should work but icon.png and icon.xcf look unused.
-
dwarftough
- Posts: 623
- Joined: August 4th, 2019, 5:27 pm
- Contact:
Re: Biased RNG in MP
Yeah, that's just for the add-on picture in server.pbl tbh
Co-founder and current maintainer of IsarFoundation, Afterlife Rated and overall Wesnoth Autohost Project
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP
-
dwarftough
- Posts: 623
- Joined: August 4th, 2019, 5:27 pm
- Contact:
Re: Biased RNG in MP
The funny thing with this mod is that it makes the stats window to show always 0
It's clear why: the mod alters the hit chances to either 100 or 0 during the attack, so from the engine standpoint there is no variance at all. Essentially it's not true: there may be variance about making that extra hit or not. But this calculation is hidden inside the mod and so doesn't count.
If it's possible to make an ability that sets the hit chance equal to the value of a variable, this stats thing may be solved: instead of 0 or 100 hit chances the mod would generate either 0, 100 or some value in-between.
It's clear why: the mod alters the hit chances to either 100 or 0 during the attack, so from the engine standpoint there is no variance at all. Essentially it's not true: there may be variance about making that extra hit or not. But this calculation is hidden inside the mod and so doesn't count.
If it's possible to make an ability that sets the hit chance equal to the value of a variable, this stats thing may be solved: instead of 0 or 100 hit chances the mod would generate either 0, 100 or some value in-between.
Co-founder and current maintainer of IsarFoundation, Afterlife Rated and overall Wesnoth Autohost Project
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP
Re: Biased RNG in MP
The expected battle outcomes in that pre-battle window are off now. Otherwise it works great, thanks for your work.
-
dwarftough
- Posts: 623
- Joined: August 4th, 2019, 5:27 pm
- Contact:
Re: Biased RNG in MP
Unlike the stats window, this can't be helped. The pre-battle calculator is nonadjustable by modifications. Funny enough, it doesn't even change for SP with in-game Biased RNG.
Glad you liked it!
Co-founder and current maintainer of IsarFoundation, Afterlife Rated and overall Wesnoth Autohost Project
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP
-
dwarftough
- Posts: 623
- Joined: August 4th, 2019, 5:27 pm
- Contact:
Re: Biased RNG in MP
Version 1.1.0 has been released!
It fixes one thing but a very big thing: the statistics windows now should show actual data.
Special thanks to gfgtdf for mentioning self.wml_vars, without it the fix wouldn't be possible.
It fixes one thing but a very big thing: the statistics windows now should show actual data.
Special thanks to gfgtdf for mentioning self.wml_vars, without it the fix wouldn't be possible.
Co-founder and current maintainer of IsarFoundation, Afterlife Rated and overall Wesnoth Autohost Project
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP