FfH2 0.15 Bugs

Sureshot said:
one thing about that code, doesnt it lend itself to the possibility of never ending loops if the RNG is mean (i.e. keeps picking the same number)?

might be better to do the while loops with "rnd2 = rnd2+1" inside to guarrantee a maximum of two loops for the first one and three for the second, unless you're a gambler lol

If the rng keeps picking the same number the game is already broke as all battles, events and ai choices will become consistent.
 
maybe, and given that RNG is only pseudo random such things are less likely, if it was truly random it could happen and it wouldnt be broken, since thats just what is possible with randomness. but with the RNG, it seems less efficient to keep picking a random number which potentially can pick the same number 5 times in a row when you can just get the next number in the list (which yields the same results as though you had randomly picked the number from the updated number list lacking the used up trait)

it prolly isn't necessary, doing the same thing 10 times might be so inconsequential its not worth even talking about for all i know lol

but, the ideal efficient code would be to randomly pick a trait, then randomly pick a trait from the list without the first picked trait which is what you'd be doing by picking the next trait in the list if you got the same one as previous
 
except that the trait immediatly following the first one you pick is then twice as likely to be chosen.

You'd get an uncommonly large number of certain pairs of traits.
 
ya i just realized that too lol, double weighted if it follows, which can be solved but with some complication
(i.e. rnd2 being picked from list with 1 less number, rnd 3 being picked from list with 2 less, if statements that if (rnd2>=rnd1) then rnd2=rnd2+1 and a double if to handle it for rnd3)
 
lmao, i didnt see kaels code, why doesnt that work?

does it only not work in the case where the initial setup is already fine (where theyre already unique)? thats what it seems to me, in which case you only need to add an if before it to say "only do this if one of the traits is the same as another one")

so:
if (iRnd1==iRnd2 || iRnd1==iRnd3 || iRnd2==iRnd3) with the true case leading to kaels original solution

(i never trust the RNG, ive lost too many 100% battles to believe the RNG can't or won't do what you don't expect or want)
 
TheCowSaysMoooo said:
Sect of Flies has the Orc promotion, should it be a demon?

Thats fixed in 0.16.
 
TheCowSaysMoooo said:
OK, how about Orc Berserker not having the Orc promotion? ;-)

Already fixed, keep them coming.
 
using lists is as SchpailsMan suggested is probably the most robust and Pythonesque :mischief: way of doing it (says me, with my ultimate three days Python wisdom!).

You already have your Traits list at your disposal, so how about this

Code:
iRnd = CyGame().getSorenRandNum(len(Traits), "Insane")
newTrait1=Traits[iRnd]
Traits.remove(newTrait1)

iRnd = CyGame().getSorenRandNum(len(Traits), "Insane")
newTrait2=Traits[iRnd]
Traits.remove(newTrait2)

iRnd = CyGame().getSorenRandNum(len(Traits), "Insane")
newTrait3=Traits[iRnd]
Traits.remove(newTrait3)

or maybe

Code:
newTraits=[]
for i in [1,2,3]:
    iRnd = CyGame().getSorenRandNum(len(Traits), "Insane")
    newT=Traits[iRnd]
    Traits.remove(newT)
    newTraits.append(newT)

or something? (disclaimer: I'm extremely tired right now, no guarantees! :crazyeye: )
 
@Sureshot: no, it might as well happen when the original setup wasn't correct. Take iRnd1 = 3, iRnd2 = 2, iRnd3 = 2, it (doesn't) work all the same. It doesn't behave as expected as soon as iRdn2 <= iRnd3 < iRnd1, and will actually fails if iRnd3 == iRnd1 - 1.

@dreiche2: thanks, the loop-based version is exactly what I had in mind. I didn't write the code because I don't have any experience in Python whatsoever, but oviously your suggestion is really like I'd recommend(sp?) it.
 
Sureshot said:
maybe, and given that RNG is only pseudo random such things are less likely, if it was truly random it could happen and it wouldnt be broken, since thats just what is possible with randomness. but with the RNG, it seems less efficient to keep picking a random number which potentially can pick the same number 5 times in a row when you can just get the next number in the list (which yields the same results as though you had randomly picked the number from the updated number list lacking the used up trait)

it prolly isn't necessary, doing the same thing 10 times might be so inconsequential its not worth even talking about for all i know lol

but, the ideal efficient code would be to randomly pick a trait, then randomly pick a trait from the list without the first picked trait which is what you'd be doing by picking the next trait in the list if you got the same one as previous

In theory yes the same number could be picked repeatedly. With 8 traits, the third trait would choose the same number as one of the other traits with a frequency of .25. Assuming an incredibly slow computer that can only handle that loop 1000 times per second, you would see a 1 second lag with a probability of .25 ^ 1000, which is slightly less than 1*10^-602.

A solution with better worst case performance, which fully eliminate the possibility of any repeated, would be to use a set to store the traits and remove the traits from the set before choosing a new one. However I am not familiar enough with python to be able to tell if it has a set construct, or how the array implementation works with removing elements.

The reality is that any speed overhead by improvements isn't ever going to be seen by an end-user and the most important part of the trait choosing algorithm is correctness.
 
mindlar said:
A solution with better worst case performance, which fully eliminate the possibility of any repeated, would be to use a set to store the traits and remove the traits from the set before choosing a new one. However I am not familiar enough with python to be able to tell if it has a set construct, or how the array implementation works with removing elements.

uhm, well, if you would like to go back two posts... :mischief:
 
really hope that stops, can't stand the constant mary-ism

a bug about the plague, one of my units got it when they killed mary (a highly promoted hunter), and i kept getting a python error of float division by zero whenever i moused over its unit button.
 
OK, what can you do in this situation:

Playing as Perpentach on a huge fantasy map, marathon setting at Monarch.

Like the last 7-8 games the Red Dragon has pitched his 'tent' just outside my border. Mid-game I get a stack of units together to take him down. Uh, no.

The stack included a Beastmaster with nearly 200XP, a Heavy Crossbowman, A Priest, and 10 Lizard Rangers (gained through Dominion). The problem arose when I tried to attack.

For five straight turns EVERY blasted units withdrew from battle with the Red Dragon. My plan was to soften him up with the Lizard Rangers and then kill him with the Beastmaster. But even the Beastmaster and Heavy Crossbowman withdrew from the battle in fear I suppose.

Meanwhile, I am getting attacked by Orc macemen, chariots, lizard assassins and rangers. So, I just gave up.

What can you do? How can you overcome this 'withdrew from battle' syndrome?

Thanks.
 
In the same game above I have a question on losing casters...

I was using Dominion by three archmages to build up an army of Lizard Rangers. However, things went horribly awry when early on I lost two casters on the same turn. Tough, building them up, then losing them quickly that way. It is tough enough when a spell doesn't work, but losing the caster is another whole bad deal.

Anyway, could you tell me the odds you will lose a caster on Dominion? I might have to change my strategy on what I thought was a great spell.

Thanks.
 
Another bug discovered during MP, though I believe it applies to single player as well: player one casts Entangle on a large stack of enemy units. Part of the units in the stack resist the spell. An attempt to move the whole stack will crash the game (occasionally bringing the entire OS down with it, forcing a reboot).

(As an aside, that Entangle can be a godsend. The player opposing me parked his entire invasion army in one square next to me. Zzap, the army wasn't moving anywhere anymore. Recast every turn. Only his heroes managed to resist, and his Baron kept killing my Druids, but I had enough production capability to keep rebuilding them. Finally his Baron died on an attack 99.1% odds. After that a Hideous Thoughts softened up his Sphener enough for my Treants to kill it, in a lucky battle with 30% odds. It ended with my forces breaking out of Kwythellar and driving him out of my continent, though I had lost my Saverous and he had razed two of my Kuriotate supercities in the meanwhile. I'll most likely still lose, but at least I'll make him work for it. Love spellcasters.)
 
Two spellcaster-related questions:

1. What is the difference between the Lifespark and Healing spells. Often, my caster has both and I don't see a difference. Both heal units in the tile PARTIALLY. Maybe have one provide complete healing???

2. After every game in the stats of units killed I find tons of summoned units. The problem is I don't remember killing almost any of them. There is never a 'your XYZ killed an ABC while defending' message or such. I don't see any damage to my units either. When are these assorted Djinn, Imps, Nightmares, Treants,etc. attacking and why don't I know it?
 
Sarisin said:
Two spellcaster-related questions:

1. What is the difference between the Lifespark and Healing spells. Often, my caster has both and I don't see a difference. Both heal units in the tile PARTIALLY. Maybe have one provide complete healing???

Lifespark has an additional ability that healing doesnt, it can be used defensivly. Meaning that if one of your units is about to die in the same tile with a lifespark the lifespark will sacrficie itself to heal that unit in the middle of combat. Its one of the rare spells that will trigger on other players turns.

2. After every game in the stats of units killed I find tons of summoned units. The problem is I don't remember killing almost any of them. There is never a 'your XYZ killed an ABC while defending' message or such. I don't see any damage to my units either. When are these assorted Djinn, Imps, Nightmares, Treants,etc. attacking and why don't I know it?

Its probably counting unsummoned units as being killed. You will have to ask Teg for the specifics.
 
Back
Top Bottom