Suffering at the hands of the RNG

As a totally no knowledge about modding sort I am hesitant to make a suggestion...but...

Say the original damage is ten, so you either randomize it from 0-20 to average ten, or you randomize it 0-10 and multiply by two to average ten. Maintaining the average so the overall effectiveness of the unit doesn't change.

Another way to get the damage to average out to the original ten is to randomize it and then add five. That not only puts the average at the original value, but it makes the range less extreme. I personally would prefer the RNG didn't have the power to create a total misfire, or a super shot of double effect...though introducing some vagaries of chance is clearly a good thing.
 
As a totally no knowledge about modding sort I am hesitant to make a suggestion...but...

Say the original damage is ten, so you either randomize it from 0-20 to average ten, or you randomize it 0-10 and multiply by two to average ten. Maintaining the average so the overall effectiveness of the unit doesn't change.

Another way to get the damage to average out to the original ten is to randomize it and then add five. That not only puts the average at the original value, but it makes the range less extreme. I personally would prefer the RNG didn't have the power to create a total misfire, or a super shot of double effect...though introducing some vagaries of chance is clearly a good thing.
There is also an function in the DLL called Range, and it will generate a number between a minimum and maximum (if I understand the function correctly). One could take the original damage (randomized) and add a number which is in a range of one to five, rather than just add five to the randomized damage.

That being said, I might try the range function on its own. That way it won't exceed the allowable maximum amount of damage and make "killer" shots.

Hmmm.... the possibilities...
 
Hmnnn, I'm sensing an Egyptian rematch in next years GPRRU. I'll have Stan Blather and Rob Lostass start investigating :deal:
 
There is also an function in the DLL called Range, and it will generate a number between a minimum and maximum (if I understand the function correctly). One could take the original damage (randomized) and add a number which is in a range of one to five, rather than just add five to the randomized damage.

That being said, I might try the range function on its own. That way it won't exceed the allowable maximum amount of damage and make "killer" shots.

Hmmm.... the possibilities...

If you are going to modify the results of anything randomly you should use the Soren random number generator since it is synchronized. Using anything else would insure that it would break multiplayer. The only time non-Soren random numbers should be used is normally for things that only the human player will ever see, such as the suggestions from the advisors (although you could also do so if the game is running in single player mode, adding the code to check is rather pointless unless you like added complexity just to shave off maybe a few dozen nanoseconds of run time here and there).

But the "range" function in the DLL (defined in CvGameCoreUtils.h) does not randomize anything. All it does is check to see if the number is in the specified range and if it is below the specified minimum it returns the minimum or if it is above the specified maximum it returns the maximum, otherwise it returns the original number. So "i = range(5, 1, 10)" sets i to 5 since it is in the range, "i = range(-7, 1, 10)" sets i to 1 since 1 is the specified minimum, and "i = range(42, 1, 10)" sets i to 10 since 10 is the specified maximum.
 
As a totally no knowledge about modding sort I am hesitant to make a suggestion...but...

Say the original damage is ten, so you either randomize it from 0-20 to average ten, or you randomize it 0-10 and multiply by two to average ten. Maintaining the average so the overall effectiveness of the unit doesn't change.

Another way to get the damage to average out to the original ten is to randomize it and then add five. That not only puts the average at the original value, but it makes the range less extreme. I personally would prefer the RNG didn't have the power to create a total misfire, or a super shot of double effect...though introducing some vagaries of chance is clearly a good thing.

I kinda enjoyed the total randomness of it. Because it was so rare that a 0 was hit (not like the DCM range bombard where a miss would happen rather often), I caught myself actually being "drawn in" to the combat results, going :" ah comon! only 1%!!!:mad: or Ooooohhh 38% !!!! :D). At least there isnt any critical fire or Friendly Fire ;)

anyway, the problem is to add 5, coz it is a different number for each unit. but....

(Random of X) + ((Max X)/2) would do the trick, in a nice easy simple way

f.ex. Collateral Damage :

Code:
int CvUnit::collateralDamage() const
{
	return ((GC.getGameINLINE().getSorenRandNum((std::max(0, (m_pUnitInfo->getCollateralDamage()))), "Some Log Message")) + ((std::max(0, (m_pUnitInfo->getCollateralDamage()))) / 2));
}

(I do like parentheses (ALOT)) (;))

----------------

And, ofcourse if using the original method, and instead of doing XML changes and not wanting a equal numbers result, the *2 could ofcourse be added to the inside of the Sorenrand, which would give unequal numbers too :

Code:
	return (GC.getGameINLINE().getSorenRandNum(((std::max(0, (m_pUnitInfo->getCollateralDamage()))) * 2), "Some Log Message"));

note that I havent tested either yet, so they are purely hypothetical (Im VERY new at all this SDK/C++ so Im not totally sure about the syntaxes)

-------------------

Alternatively to the first, coz if doing like that, the whole idea about randomizing is "almost" gone, is to instead of RND10 + 5, it could be (RND10+(½ a 10)) + (1/4 of 10) or RND15 + 2.5, which would produce results of 2.5-17.5 and average at 10 (right?)
So it would look like : return=((RND(X+(X/2)))/(X/4))

I think this way would be the best overall. (Not resulting in failure, nor extremes)

----------------------

Regarding the code efficiency, I think (without knowing the exact function of sorenrand) it could be like a whole game is like shooting a bullet from mars and hitting England, but with the new randomization it would hit France instead. (Note to CIA, FBI, NSA or whoever is listening, I do NOT intend to go to Mars to actually shoot a bullet at neither England nor France, just to set the record clear ;))
 
I know nothing about coding, but with true dices it could be, instead of a 10 side dice for damage 1 to 1o, be a dice with more sides: 1 for 1, 1 for 10, 2 for 2, 2 for 9, and so on.
 
If you are going to modify the results of anything randomly you should use the Soren random number generator since it is synchronized. Using anything else would insure that it would break multiplayer. The only time non-Soren random numbers should be used is normally for things that only the human player will ever see, such as the suggestions from the advisors (although you could also do so if the game is running in single player mode, adding the code to check is rather pointless unless you like added complexity just to shave off maybe a few dozen nanoseconds of run time here and there).

But the "range" function in the DLL (defined in CvGameCoreUtils.h) does not randomize anything. All it does is check to see if the number is in the specified range and if it is below the specified minimum it returns the minimum or if it is above the specified maximum it returns the maximum, otherwise it returns the original number. So "i = range(5, 1, 10)" sets i to 5 since it is in the range, "i = range(-7, 1, 10)" sets i to 1 since 1 is the specified minimum, and "i = range(42, 1, 10)" sets i to 10 since 10 is the specified maximum.
Thanks for the clarification G-E. You just saved me a great deal of time. :)
 
Looks like the way of doing it wasnt that good after all. On a mouseover it shows the randomized number instead of the max number, so I think the randomization have to be applied directly at the combat results, which is not necessarily a bad thing, coz combined with Air Combat XP mod, the XP given can be modified by the result. I.E. :
If combat result is < 50% of Max combat then XP / 2
If combat result is > 90% of Max combat then XP * 2
 
Looks like the way of doing it wasnt that good after all. On a mouseover it shows the randomized number instead of the max number, so I think the randomization have to be applied directly at the combat results, which is not necessarily a bad thing, coz combined with Air Combat XP mod, the XP given can be modified by the result. I.E. :
If combat result is < 50% of Max combat then XP / 2
If combat result is > 90% of Max combat then XP * 2

The possibilities are interesting. I think I might do some exploring when I get some time.
 
I recently had a horrible stretch that cost me a game. Suleiman had his army of 8 swords and axes split into two groups of four, with one group of 4 right beside my city and the other group of four 1 tile away from my city. There is also 1 more CR1 sword behind that, 2 tiles away. I have 4 axes, 6 chariots, and 1 warrior, with chariots inbound (no iron, forgot horse archers need archery, whoops).
I have a chariot with combat 2 and shock. It attacks the full health CR1 swordsman with 50% and 5% withdraw. Does no damage and dies.
Then I attack with my axeman with combat 1, who is defended by the combat 1 full health enemy axe. 50% to win. Hits 1x, but dies.
Then I attack with an umpromoted axe. He goes up against CR1 axe, and so it is actually ~50%. He does no damage and dies.

I'm forced to use my other unpromoted axe at the same ~50%. He does 1 hit, then dies.

My axe is now greater than 50% to kill something, and I have lost 5 units without killing anything, so I decide to attack with him, figuring the RNG can't be a loss next (using mostly gambler's fallacy). I have mid 60's% iirc. I do some damage (2 hits I think) then lose.
I have 4 chariots and a warrior left, and he has a full health sword to protect his stack of units from my chariots. I have a flanking 2 chariot, so I use it to attack the enemy sword. The chariot dies (can't remember the odds, was seeing red, but withdraw alone is nearly 40%). He does a fair amount of damage though. 3 chariots, 1 warrior left, and the enemy has 4 units left.
I then have a combat 1 shock chariot to attack the 70% health CR1 sword, which has I think ~80% (?). I die, doing good damage. 2 chariots 1 warrior left to kill 4 units, all pretty injured.
I attack with my next chariot, which is now vs the higher health axe. I lose my next chariot in a 93.4% win, 0.7% withdraw scenario. I have lost 4 axes and 4 chariots to kill nothing.
I have an axeman in a jungle that can reach his 1 swordsman in the rear by itself, which is in a jungle itself. I only have 27% to win, but I've just lost 8 battle in a row, at a minimum of ~45% to win (gambler's fallacy again). I lose, doing no damage. Rage quit.
In retrospect though, I should never have attacked, and should have just let the 9 units pile up. The problem was that sulei had already sent 2 swords right past this city to go attack my cities in the back with very poor/ no defenses just a few turns before, like he was psychic (and unfortunately, I had not cleared enough jungles, so he could do the whole path to my closest no defenders city while staying in the jungle the whole time, except for this one square where the army of 4 was on a a plains. After that 1 tile of flat ground he had to cross, it was all jungle to my next city... in fact, cities....)
 
I have lost 4 axes and 4 chariots to kill nothing.
I have an axeman in a jungle that can reach his 1 swordsman in the rear by itself, which is in a jungle itself. I only have 27% to win, but I've just lost 8 battle in a row, at a minimum of ~45% to win (gambler's fallacy again). I lose, doing no damage. Rage quit.
Time to WB some tactical nukes. ;)
 
Alternative to the WB ( so you don't get the 10% score pen) is do the chipotle method. Just CTL-SFT-CLK and up pops a nice menu for your world domination pleasure. Also, no score penalty :)
 
I had mines discover gold twice in the same game which I think is 1:1000 for each.

Somehow it's always easier to remember the oddly unfavorable results rather than the oddly favorable ones. Why? Because you don't slam your mouse down in disgust and mutter under your breath for 10 minutes when something oddly favorable happens. You pretty much never hear someone say "Oh get real! I totally should have lost that battle!" You simply bask in shrewd smugness. Human nature, kinda funny.

Sounds like Lemon Merchant must have been muttering under her breath that whole game.

In a recent game I lost 3 caravels in a row to barb galleys at I believe 98.7%. Up to that point I always picked on barb galleys with caravels (why not? easy experience with relatively little risk) but I've been straight up avoiding them since that little episode. Although that one was more like "my caravels... *sob* my poor, brave little caravels!"
 
Sounds like Lemon Merchant must have been muttering under her breath that whole game.
More like screaming at the screen. I frightened the cat! :lol:
 
I had back to back 99%+ odds loses last week. But i just brushed it off and used one of the other 40 units I had with me.
 
I hardly ever got gold, but I think I get about one metal resource from a formerly non-resource mine per game, usually gems, silver or copper.
As for battles, I admit that I sometimes re-load and replay, if I lost repeatedly against very favorable odds. As the human player hardly ever tries to fight at extremely bad odds (except with suicide siege units) I will never really even out the lost >90% battles, simply because I do not fight enough battles at ~10-20% odds.
 
Except possibly on defense; it's harder to control unfavorable odds when the AI attacks. (Although stomping them fast enough means few attacks from the AI.)
 
I will never really even out the lost >90% battles, simply because I do not fight enough battles at ~10-20% odds.
That just tells me that you usually feel the need for superior tech before you attack.
If you go with inferior tech and rely on numbers, that happens more often.
 
That's true, offensive wars I always try to fight with a tech lead. And in early wars there will be suicidal attacks and also some lucky ones, but I very rarely fight them now. I am not very good at warfare and early rushes without a powerful UU I can't do on Emperor. I will not reload after a single unlucky fight. But before I ragequit, because I got screwed by the RNG in a war, I will rather reload. Some may consider it cheating, I don't.
 
Top Bottom