[Request]Reduce RNG influence

General feedback and discussion of the game.

Moderator: Forum Moderators

Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: [Request]Reduce RNG influence

Post by Yogibear »

Here is the next version with some enhancements: https://sourceforge.net/projects/wesnot ... p/download
StevenAus wrote:What is happening now - an existing campaign game with mainline settings needs to be loaded (without "Ask for every campaign scenario" on) before you start setting new RNG settings, as otherwise it will always crash.
This is fixed.
StevenAus wrote:The "Ask" option is triggering *every* time you load a save, even ones in the middle of the map, however even if it is in the between scenarios campaign map, changing the settings does not set them in the newly started scenario - it only uses the options there before (so if you change from 2 to 3 smoothing does not affect it for the newly started scenario). The save that automatically happens between scenarios (ie. the new scenario in the campaign has not been loaded yet) is the only place where the game should ask what options you want to use, not after scenario has loaded or in-scenario saves.
This should be fixed as well.
StevenAus wrote:Also check out the following two replays - see how many times the mages are missing their 70% hit chance attacks, and especially how if you are attacked the first time by an enemy the enemy often gets all four hits in (40% defence).
Not sure about that one, actually, maybe there was something wrong with the algorithm. I made a few experiments and it looks like smoothing doesn't have an effect at all. That might actually make sense as its scope is only within a single strike, not taking many strikes into account. Maybe you can find out something more about that.

The main menu also has a new command "Damage Calculation" that enables you to view the current settings (so you don't have to look them up in the savefile all the time :wink: ). It's right below the status table.

Have fun :) .

Edit:
The sliders are supposed to have a step-size of 5 and 10 respectively. Due to a Gui2 bug step-sizes above 1 don't work, so i set it to 1 instead. I will get back to the old behaviour as soon as that bug is fixed.
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
User avatar
StevenAus
Posts: 84
Joined: December 18th, 2009, 12:15 am
Location: Perth, Australia
Contact:

Re: [Request]Reduce RNG influence

Post by StevenAus »

Great stuff! =)

Currently the Damage Calculation option in the main menu crashes if you're starting a new scenario in a campaign, rather than starting a new campaign. :) This crash happens whether or not "Ask for each campaign scenario" is on, but it doesn't happen when starting a new campaign.

Currently, even when loading an in-between save there is no option to change settings when "Ask" is on. :) Is it possible to make only the saves for in-between maps in a campaign trigger the "Ask for each campaign scenario" settings dialog, and all others don't?

How about a campaign's last used Damage Calculation settings, that existed when the special in-between save was created, are default when starting a new scenario in a campaign? (Say when "Ask" is off, each subsequent map in the campaign would keep the settings that the previous map had. Or if "Ask" is on, the settings from that particular in-between save would show up in the Damage Calculation dialog, able to be changed for the new scenario.)

What do you think of this idea? :)

Best regards,
Steven.
My Life Purpose Is To Teach The World To Fish For Life. I AM Steven Russell Lynch Abundance That I AM. Empowerment Is My Name And Fostering Self-Responsibility Is My Game.
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: [Request]Reduce RNG influence

Post by Yogibear »

StevenAus wrote:Currently, even when loading an in-between save there is no option to change settings when "Ask" is on. :) Is it possible to make only the saves for in-between maps in a campaign trigger the "Ask for each campaign scenario" settings dialog, and all others don't?
Hmm, i am not quite sure what you call an in-between save. If it is a save in the middle of a scenario (a manual save or an autosave), then this is by design: The damage calculation settings must not be changed within a scenario or things will become a lot more difficult.

I will take care of the other bugs soon.
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
User avatar
StevenAus
Posts: 84
Joined: December 18th, 2009, 12:15 am
Location: Perth, Australia
Contact:

Re: [Request]Reduce RNG influence

Post by StevenAus »

No, the save that happens between scenarios (basically the one that shows the campaign map and campaign progress so far). The in-between save is only made after completing the previous map, and that might be a good place to remember the settings of the previous scenario in the campaign. :)

Best regards,
Steven.
My Life Purpose Is To Teach The World To Fish For Life. I AM Steven Russell Lynch Abundance That I AM. Empowerment Is My Name And Fostering Self-Responsibility Is My Game.
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: [Request]Reduce RNG influence

Post by Yogibear »

StevenAus wrote:Currently the Damage Calculation option in the main menu crashes if you're starting a new scenario in a campaign, rather than starting a new campaign. :) This crash happens whether or not "Ask for each campaign scenario" is on, but it doesn't happen when starting a new campaign.

Currently, even when loading an in-between save there is no option to change settings when "Ask" is on. :) Is it possible to make only the saves for in-between maps in a campaign trigger the "Ask for each campaign scenario" settings dialog, and all others don't?
Both functionalities work for me. Can you give me a precise way to reproduce the bugs, please? And are you using old mainline saves or ones created with WesnothXP?
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
User avatar
StevenAus
Posts: 84
Joined: December 18th, 2009, 12:15 am
Location: Perth, Australia
Contact:

Re: [Request]Reduce RNG influence

Post by StevenAus »

Mainline saves (1.8.0). All the saves between scenarios (attached) from the end of Crossroads (start of Princess of Wesnoth) to the beginning of Scepter of Fire all exhibit this crash bug. All the attached saves were made with Wesnoth 1.8.0.

Best regards,
Steven.
Attachments
In-Between Saves.7z
(226.87 KiB) Downloaded 243 times
My Life Purpose Is To Teach The World To Fish For Life. I AM Steven Russell Lynch Abundance That I AM. Empowerment Is My Name And Fostering Self-Responsibility Is My Game.
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: [Request]Reduce RNG influence

Post by Yogibear »

All of the above bugs should be fixed now. I also discovered a mistake in the implementation of smoothing (that happens when you think you are smarter than the inventor :P ). Seems quite reasonable now. There might be some issues left with rounding damage. I will see if i can talk with sauron about that.

https://sourceforge.net/projects/wesnot ... p/download
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
User avatar
StevenAus
Posts: 84
Joined: December 18th, 2009, 12:15 am
Location: Perth, Australia
Contact:

Re: [Request]Reduce RNG influence

Post by StevenAus »

Just played HttT A Choice Must Be Made, with 2 smoothing, and it seems to work well. :) Reduces out of scale randomness just a little, but your units can still die if you are not careful with them. =)

With regards to rounding, I suppose we still have to think about it a bit more. :)

Best regards,
Steven.
My Life Purpose Is To Teach The World To Fish For Life. I AM Steven Russell Lynch Abundance That I AM. Empowerment Is My Name And Fostering Self-Responsibility Is My Game.
User avatar
StevenAus
Posts: 84
Joined: December 18th, 2009, 12:15 am
Location: Perth, Australia
Contact:

Re: [Request]Reduce RNG influence

Post by StevenAus »

I notice with standard damage of 10 and smoothing setting of 3, the possible damages are 0, 3, 6 and 10. Rounded to the nearest integer it would be 0, 3, 7 and 10. How about the following system for rounding? (first three rules already exist)
  • If the number of rolls for an attack attempt is 0, then obviously no hit and no rounding necessary.
  • If all the rolls for an attack attempt succeed, then full (standard) damage is scored with no rounding necessary.
  • If a fraction of the rolls for an attack attempt succeed, and this fraction multiplied by standard damage exactly equals an integer (ie. no decimal places), than that integer of damage is done with no rounding necessary.
  • If a fraction of the rolls for an attack attempt succeed, and this fraction multiplied by standard damage is closer to one integer than the other, it is rounded to that integer.
  • If a fraction of the rolls for an attack attempt succeed, and this fraction multiplied by standard damage is exactly in the middle of two integers, then one 50% roll (regardless of smoothing number above 1) is made to determine whether the halfway damage is rounded up or down. If successful, damage is rounded up to the next integer, if unsuccessful damage is rounded down to the previous integer. If another fraction of the rolls succeed *in the same attack sequence* (ie. in the same sequence when one unit initiates an attack sequence with another unit, once) then the opposite rounding is done - down if rounded up the first time, up if rounded down the first time. Then if a third (fifth? etc. :wink:) attack where damage is exactly between two integers, the 50% roll is conducted again. But the first time in an attack sequence that a number with .5 as its decimal place is produced by

    (Number of successful rolls/smoothing number) x Standard damage

    the single 50% roll is always taken initially. In other words, reversing the result of a 50% roll only happens *if there has already been a .5 initial result for damage in the one initiated attack sequence*. It doesn't carry over between separate attack sequences. This allows a little bit of luck.
What do you think of this proposed system? :)

Best regards,
Steven.
My Life Purpose Is To Teach The World To Fish For Life. I AM Steven Russell Lynch Abundance That I AM. Empowerment Is My Name And Fostering Self-Responsibility Is My Game.
domein
Posts: 1
Joined: November 15th, 2010, 7:23 am

Re: [Request]Reduce RNG influence

Post by domein »

I see that a Sauron's mod did almost everything that i was about to suggest, if set to full deterministic setting. However it seems to be rounding up the damage, and this is not a good thing to do, because most units are getting overwhelmed too fast. Therefore:

1) Round down all damage fractions.
2) Define minimum damage of 1 point per attack.

Luck still has an effect in form of special ability attack rolls.
Suira
Posts: 13
Joined: December 25th, 2010, 12:10 pm

Re: [Request]Reduce RNG influence

Post by Suira »

Yoyobuae wrote:(...)
The trick is buffering. Keep a number of RNG results in a memory buffer. These can be analyzed and tweaked to try to filter out cases of really bad/good luck. Whenever one is used in battle, it gets discarted and RNG generates a new value, the analysis is repeated.
That actually seems very doable. In practice you could generate a big list of random numbers for each player and always check if the average of the next 10 numbers (or some other number) is between 2 set bounds, if it isn't, make a new list.

Concrete: you'd need:
- a method that fills a new (array)list with random numbers from scratch (how long the list should be is debatable, I'd try it with length=10)
- a method that returns the average of a list
- a method that gives you the first random number in the qeue, deletes it, adds another random number in the end and checks the average again (newaverage = oldaverage - (deleted number+new number)/2 ). If the average is too high or too low, create a new list and check again, etc.

Note that every player would get his own list.

I can actually program (mostly in java) so I'm confident I could try doing the above once I do abit of research on LUA, but I don't quite have the time at the moment. Might do it after my exams if there's enough interest.

Anyway, advantages would be:
- you somewhat prevent rediculous luck streaks (luck still remains a big factor though).
- even if you remember the previous 9 numbers, it still won't be possible to calculate the last one bar extreme circumstances. Simply because you don't know the exact value of the 9 previous numbers and in most of the cases, the list wouldn't have been discarded no matter what the 10th number was (this depends on how big you set the bounds). Only in some specific scenario's (like 3 mages missing all their attacks) you'd have enough information to guess the 10th one. If this still happens to be an issue, increase the length of the list or the bounds.
- you don't complicate hit chances that much

Dsiadvantages would be:
- creates the gambler's fallacy problem (http://en.wikipedia.org/wiki/Gambler%27s_fallacy): people who had a bad luck streak might think the chance they'll hit the next attack is bigger, even though it will rarely be the case. (if this is a problem, you can still decrease it by manipulating the parameters)
- the % of lists getting rejected may turn out to be so low it hardly matters

Again, it only solves rediculous luck streaks. But in combination with other solutions or with more luck reducing traits (like "if the first attack misses the second one hits") it could actually reduce the amount of complaints about unfair luck.
User avatar
StevenAus
Posts: 84
Joined: December 18th, 2009, 12:15 am
Location: Perth, Australia
Contact:

Re: [Request]Reduce RNG influence

Post by StevenAus »

I find I like the Sauron mod when number of rolls per attack is 3 - so damage is one of 0, 1/3, 2/3 or 3/3 (full standard damage), with special effects like slow, poison etc. being rolled separately (yes/no). I don't change the damage split ratio.

I would be interested in trying out a modified system (perhaps in combination with existing solutions) such as you described. :-) I'm not sure about guaranteed hits though.

Best regards,
Steven.
My Life Purpose Is To Teach The World To Fish For Life. I AM Steven Russell Lynch Abundance That I AM. Empowerment Is My Name And Fostering Self-Responsibility Is My Game.
Noitakuningas
Posts: 20
Joined: December 21st, 2010, 7:46 am

Re: [Request]Reduce RNG influence

Post by Noitakuningas »

By the gods, I swear that the computer is a cheating illegitimate child.

I feel like my units miss most of the time, and even characters with magical attacks or marksmanship tend to go on a missing sprees, failing all their four or five attacks multiple turns in a row, while the computer has unbelievable streaks of annihilation, practically hitting with four attacks one after other with 30 % chance to hit.

Either fix the RNG so it actually works fairly, or remove it and think of something new.
You are a Ghost: you drain the life energy from other people to survive and are hated/feared by regular people.
Saurian Skirmisher 80 %
Elvish Fighter 75%
Dark Adept 75%
User avatar
Reepurr
Posts: 1088
Joined: August 29th, 2010, 5:38 pm

Re: [Request]Reduce RNG influence

Post by Reepurr »

Noitakuningas wrote:Either fix the RNG so it actually works fairly, or remove it and think of something new.
The mods get that a lot.
(And the third of that link has links to even more "bad luck" and "RNG not fair" threads!)

The reason you think the RNG doesn't work fairly is that you remember the bad times, not the good times.
"What do you mean, "a dwarvish dragonguard with marksman is overpowered"?"

Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Noitakuningas
Posts: 20
Joined: December 21st, 2010, 7:46 am

Re: [Request]Reduce RNG influence

Post by Noitakuningas »

Reepurr wrote:
Noitakuningas wrote:Either fix the RNG so it actually works fairly, or remove it and think of something new.
The mods get that a lot.
(And the third of that link has links to even more "bad luck" and "RNG not fair" threads!)

The reason you think the RNG doesn't work fairly is that you remember the bad times, not the good times.
Oh, I'd remember the good times because I actually took count. Bad streaks happen WAY more frequently than good ones.
You are a Ghost: you drain the life energy from other people to survive and are hated/feared by regular people.
Saurian Skirmisher 80 %
Elvish Fighter 75%
Dark Adept 75%
Post Reply