Thread Tools
Old November 23, 2001, 12:31   #1
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
Question about random seed test
Well, hmmm.

I've been doing some testing.
I wish I had the numbers in front of me but I'm at the office right now and I can only share my limited conclusions.

Like most of you I had seen streaks that have made me blanch, so I wanted to try and figure out how the RN generator was working.

I placed 3 artillery, 6 horsemen, 3 sword men, 2 pike men and a warrior in three stacks, within striking range of four stacks that consisted of unfortified 2 horsemen, a bowman, a pike man and a warrior. All are on desert tiles with no modifiers.

I re-loaded the same turn around 30 times and attacked with 5 different combinations of units and tried to spot a pattern. My main questions were: is the queue fixed for all battles? Is there a unit specific queue? And if not, then what determines a change in queue.

Example of a combination would be
1st attack hm(1st stack) attack, swm(1st stack)
2nd swm(1st stack) attack, pm(1st stack)
3d hm (1st stack) attack, hm(2nd stack)
4th pkm(2nd stack) attack, w(3d stack)
5th hm (3d stack) attack, hm(4th stack)

If I used the same combination twice I’d invariably get the same result, pointing towards a fixed queue of seeds. However, if I changed only one of the attacks, ie replaced

2nd attack swm(1st stack) attack, pm(1st stack)
with hm(1st stack) attack, pm(1st stack)

then the result for 3d, 4th and 5th attacks would change also. That meant that when my hm used, supposedly, the third seed in the queue for the same battle as last time, it gave different result. Hence, a different seed was used.

To make it clearer:
You don't exactly reset the queue, but somehow branch out into another queue, because no matter what combination you use you'll always get the same result for that combination, and if you have an inclination for save-cheating, you can reload until you find a combination that is in your favour. If I didn't like the result from my multi-battle combat I just have to reload and change the order of attack.

Anyone have any theories as to how that may be working?

Zap

Last edited by zapperio; November 23, 2001 at 12:40.
zapperio is offline  
Old November 23, 2001, 15:09   #2
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
Considering how much speculation there has been around the combat system I'd have thought there would be more interest in the actual mechanics of said system?

Zap
zapperio is offline  
Old November 23, 2001, 16:51   #3
Rakki
Warlord
 
Rakki's Avatar
 
Local Time: 03:23
Local Date: November 1, 2010
Join Date: Sep 2001
Location: Sydney, Australia
Posts: 160
For god's sake, haven't people figured out by now that the random number generator generates a queue of random numbers which are then FIXED for that particular turn ?

or are they too busy pretending that a new number is generated every time a unit attacks ?
Rakki is offline  
Old November 23, 2001, 18:13   #4
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
Quote:
Originally posted by Rakki
For god's sake, haven't people figured out by now that the random number generator generates a queue of random numbers which are then FIXED for that particular turn ?

or are they too busy pretending that a new number is generated every time a unit attacks ?
Exactly who are you addressing this to? Maybe you'd like to actually read the post before replying?

I think my post makes it abundantly clear combat is not solved with something as simple as a single fixed queue.

Zap
zapperio is offline  
Old November 23, 2001, 22:12   #5
Excelsior
Warlord
 
Excelsior's Avatar
 
Local Time: 11:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Alabama
Posts: 162
After reloading, do the results change if you atack with a different unit of the same type or with another type of the same attack rating?

Example: If you attack with Horseman (first stack) then Swordsman (second stack), are the results different then if you used Horseman (second stack) or Archer (first stack) first?

Also, would the results change for the second unit if you use either a different unit of the same type or a different type with the same attack?

These experiments would tell us whether the seed is dependant on the unit type, unit attack rating, or the specific instance of the unit. I'm not sure what use this data would be, but it would bring a step closer toward understanding how the combat system works.
Excelsior is offline  
Old November 23, 2001, 23:26   #6
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
Quote:
Originally posted by Excelsior
After reloading, do the results change if you atack with a different unit of the same type or with another type of the same attack rating?

Example: If you attack with Horseman (first stack) then Swordsman (second stack), are the results different then if you used Horseman (second stack) or Archer (first stack) first?

Also, would the results change for the second unit if you use either a different unit of the same type or a different type with the same attack?

These experiments would tell us whether the seed is dependant on the unit type, unit attack rating, or the specific instance of the unit. I'm not sure what use this data would be, but it would bring a step closer toward understanding how the combat system works.
Exactly my point. A little understanding of the combat system might tell us more about the occurances of streaks that people have been reporting.

Of course the easiest thing would be to ask firaxis about this but I'm not sure if that is an option at this point.

To answer your questions: (which were the ones I had when I did the experiment, incidently)

I thought I had made this clear in the above post, but I guess it may require a bit more careful reading than intended. Let me try again, and now that I'm home I can use my numbers to back me up.

Quote:
After reloading, do the results change if you atack with a different unit of the same type or with another type of the same attack rating?

Example: If you attack with Horseman (first stack) then Swordsman (second stack), are the results different then if you used Horseman (second stack) or Archer (first stack) first?
When I did a combination of five attacks I would get a different combat result depending of the order of the attacks.

The way I tested this was by changing only one attack in the combination.

i.e. 1st attack: (1st stack) reg horseman vs (1st stack)veteran horseman
2nd attack: (1st stack) reg swordman vs (1st stack reg pikeman)
3d attack: (1st stack) elite horseman vs (2nd stack veteran bowman)
...

Then I'd reload and change only second attack.

1st attack: (1st stack) reg horseman vs (1st stack)veteran horseman
2nd attack: (1st stack) reg swordman vs (3d stack reg swordman)
3d attack: (1st stack) elite horseman vs (2nd stack veteran bowman)
...

Now, you notice the third attack is exactly the same and should be using the same random seed as before the reload, but I'd consistantly get different outcome out of that attack depending on what I did with my second attack.

Mind you, those outcomes are fixed also, so there is obviously a sort of a branching queue being used.

I'm sure other people have noticed this, but I tested it thoroughly, and the results are unit dependent. That is if you have a stack of 3 horsemen and a swordman and you attack 3 times agains the same stack. ie

1st attack horseman
2nd attack swordman
3d attack horseman

you will get different result for the last two attacks if you go horseman in all three attacks.

There is no distinction made between reg, vet, or elite, for either outcome or branching.

Zap
zapperio is offline  
Old November 24, 2001, 00:08   #7
Excelsior
Warlord
 
Excelsior's Avatar
 
Local Time: 11:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Alabama
Posts: 162
Quote:
Originally posted by zapperio
I thought I had made this clear in the above post, but I guess it may require a bit more careful reading than intended. Let me try again, and now that I'm home I can use my numbers to back me up.

When I did a combination of five attacks I would get a different combat result depending of the order of the attacks.

The way I tested this was by changing only one attack in the combination.

i.e. 1st attack: (1st stack) reg horseman vs (1st stack)veteran horseman
2nd attack: (1st stack) reg swordman vs (1st stack reg pikeman)
3d attack: (1st stack) elite horseman vs (2nd stack veteran bowman)
...

Then I'd reload and change only second attack.

1st attack: (1st stack) reg horseman vs (1st stack)veteran horseman
2nd attack: (1st stack) reg swordman vs (3d stack reg swordman)
3d attack: (1st stack) elite horseman vs (2nd stack veteran bowman)
...

Now, you notice the third attack is exactly the same and should be using the same random seed as before the reload, but I'd consistantly get different outcome out of that attack depending on what I did with my second attack.

Mind you, those outcomes are fixed also, so there is obviously a sort of a branching queue being used.

I'm sure other people have noticed this, but I tested it thoroughly, and the results are unit dependent. That is if you have a stack of 3 horsemen and a swordman and you attack 3 times agains the same stack. ie

1st attack horseman
2nd attack swordman
3d attack horseman

you will get different result for the last two attacks if you go horseman in all three attacks.
Zap
What I meant was, does it change the branching if you use a different unit of the same type to attack or a different unit with the same attack? i.e., does it change the branching if the attack and defense values are the same in each case, but different units are used? The point I'm trying to get at is, do the units used affect the branching, or is it the A/D ratings of the units involved?

Example:

1st attack: (1st stack) reg horseman vs (1st stack)veteran horseman
2nd attack: (1st stack) reg horseman vs (1st stack reg pikeman)
3d attack: (1st stack) elite horseman vs (2nd stack veteran bowman)

If we change the second attack to this,

2nd attack: (1st stack) reg archer vs (1st stack reg pikeman)

this,

2nd attack: (1st stack) reg horseman vs (2nd stack reg pikeman)

or this,

2nd attack: (2nd stack) reg horseman vs (1st stack reg pikeman)

what are the results? In each case the A/D is the same, but the units used are different.
Excelsior is offline  
Old November 24, 2001, 00:21   #8
barefootbadass
Prince
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Dec 1969
Posts: 378
Quote:
Originally posted by Rakki
For god's sake, haven't people figured out by now that the random number generator generates a queue of random numbers which are then FIXED for that particular turn ?

or are they too busy pretending that a new number is generated every time a unit attacks ?
Actually a random function is most likely called everytime a random number is needed(including every 'round' of combat). There is no way to know how large of a queue you would need for a turn and it would be pointless to make one since it would make no difference in the sequence of numbers.

Oops, I just noticed the thought about unit queues or whatever, but I still think they are not used for the same reasons.
barefootbadass is offline  
Old November 24, 2001, 00:31   #9
Cavalier_13
Chieftain
 
Local Time: 12:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Montreal
Posts: 38
About the results.....
All of this seems akin to something I used to experience in an old game called "X-COM".

At the end of a turn, if I saved and then reloaded the turn 15 times, I'd get the same results everytime. However, if I made even the smallest change, ie, crouch a trooper that was completely out of the battle, the whole results were changed.

So I tend to think that there is a fixed queue of numbers.

The whole mechanics must be figured out though before we make a final assumption.

Cavalier
Cavalier_13 is offline  
Old November 24, 2001, 04:16   #10
Hurry
Chieftain
 
Local Time: 19:23
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 57
Interesting results, Zap. However, it seems most people on this forum are 13-year olds who don´t understand the point you are trying to make. Pay no attention to them, and please, keep on testing.

I´m especially interesting in seeing if changing the instance of a unit changes the results, i.e. if the results differ when attacking with different tanks in the same stack.

Also, my own experiences suggest that just moving around units would not change the random seed. I claim this mostly on the fact that attacks and events during the enemies´ turn are identical even if you walk around with units and make small "end of turn" changes (that is, after you have made all your attacks).
Hurry is offline  
Old November 24, 2001, 07:56   #11
GodSpawn
Prince
 
GodSpawn's Avatar
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Scotland
Posts: 389
I seem to remember seeing somewhere that there were several different seed variables used - one for combat, another for other random occurances etc.

If the combat seed were used like this it may give the kind of results that we are seeing:

Assume we have a random number generator function, rng(), that accepts a seed as input and returns both the required random number and a new seed for use with the next random number.

Also assume that each military unit has a unique identifying number.

Then you calculate the next random number like this:

next_random_number = rng( current_seed + attacker_id + defender_id )

This would also generate a new seed (not shown above).

This would mean that the random number generated would depend not only on the previously generated on, but also which units were actually involved in combat.

Of course, there are a near-infinite number of ways that you can implement this kind of stuff, so the chances of anyone successfully guessing the actual algorithm used are quite low...
GodSpawn is offline  
Old November 24, 2001, 11:48   #12
TCO
Apolytoners Hall of Fame
Emperor
 
TCO's Avatar
 
Local Time: 07:23
Local Date: October 31, 2010
Join Date: Mar 2006
Location: Richmond, VA
Posts: 8,057
Quote:
Originally posted by zapperio


Exactly who are you addressing this to? Maybe you'd like to actually read the post before replying?

I think my post makes it abundantly clear combat is not solved with something as simple as a single fixed queue.

Zap
There's fixed outcomes to prevent "reload combat cheaters". If you do something to reset the rng, you get a different outcome.
TCO is offline  
Old November 24, 2001, 22:08   #13
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
Quote:
Originally posted by Hurry
keep on testing.
thx for the vote of confidence

Quote:
I´m especially interesting in seeing if changing the instance of a unit changes the results, i.e. if the results differ when attacking with different tanks in the same stack.
That was one of my questions also and upon testing I noticed no difference. Neither did experience of a unit have any impact.

Quote:
Also, my own experiences suggest that just moving around units would not change the random seed. I claim this mostly on the fact that attacks and events during the enemies´ turn are identical even if you walk around with units and make small "end of turn" changes (that is, after you have made all your attacks).
That had been my experience also and so I tested it and we are right. Unit movements between attacks does not change the queue.

Zap
zapperio is offline  
Old November 24, 2001, 22:12   #14
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
Quote:
Originally posted by GP


There's fixed outcomes to prevent "reload combat cheaters". If you do something to reset the rng, you get a different outcome.
There is not a simple reset either as all possible outcomes are fixed and "reload combat cheating" has not been prevented except for a single unit battle.

Zap
zapperio is offline  
Old November 24, 2001, 22:39   #15
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
Quote:
Originally posted by Excelsior


What I meant was, does it change the branching if you use a different unit of the same type to attack or a different unit with the same attack? i.e., does it change the branching if the attack and defense values are the same in each case, but different units are used? The point I'm trying to get at is, do the units used affect the branching, or is it the A/D ratings of the units involved?
Ok I see what you're asking. Based on my results it is a/d rating that makes a difference, and stacks. I have not tested this fully, but preliminary result show that if all hm are from the same stack it will make no difference in what order they go as long as they attack the same units in order.

I need to fully test whether difference in stacks matters. i.e.

replace 2nd attack hm (stack 1) vs pm (stack 2)

with

2nd attack hm (stack 2) vs pm (stack 2)
or
2nd attack hm (stack 1) vs pm (stack 1)
or
2nd attack hm (stack 2) vs pm (stack 1)

My numbers lead me to believe that it will change the results but I did not test this specifically. I only had 4 enemy stacks to play with.

Zap

Last edited by zapperio; November 24, 2001 at 23:28.
zapperio is offline  
Old November 24, 2001, 23:27   #16
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
I got an interesting result, just now, as I was trying to answer Excelsior question about effects on queue from units from different stacks and a/d dependency.

this time, I had two stacks of horsemen vs two stacks of one(1)pikemen. As the test variables are quite limited I followed up each combination with 2 more attacks by a swordman vs hm and warrior vs hm so that if there were changes in the queue I'd have more variables to help me pick up on it.

An example of an attack:

1st attack Horseman (1st stack) vs pikeman (1st stack)
2nd attack Horseman (1st stack) vs pikeman (2nd stack)
3d attack Horseman (2nd stack) vs pikeman (1st stack)

(My first two attacks were rebuked and therefore I was able to make a third attack against one of the pikemen with my final horsey.)

I followed these with 2 attacks elsewhere to pick up on changes in queue.

When I changed the stacking order i.e. attacked 2nd stack first with 2nd stack horsey followed by 1st stack vs 1st stack there were no changes in the queue. Neither did it matter whether the final attack was made against 1st or 2nd stack. The 2 following combats always came out the same.

This pointed towards a a/d dependency independent of stacks.

However, and this is the interesting bit, when I attacked the same pikeman stack (with one pikeman only) in the first two attacks it changed the queue!

I.e.

1st attack Horseman (1st stack) vs pikeman (1st stack) (pm survives)
2nd attack Horseman (1st stack) vs pikeman (1nd stack)
or
2nd attack Horseman (2nd stack) vs pikeman (1nd stack)

So there is not an a/d dependency either!

Right now I'd give my right hand to find out how the branching system really works, but my testing seems to raise more questions then answers.

Zap
zapperio is offline  
Old November 25, 2001, 11:00   #17
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
shameless bump
zapperio is offline  
Old November 25, 2001, 17:19   #18
Excelsior
Warlord
 
Excelsior's Avatar
 
Local Time: 11:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Alabama
Posts: 162
Quote:
Originally posted by zapperio
This pointed towards a a/d dependency independent of stacks.

However, and this is the interesting bit, when I attacked the same pikeman stack (with one pikeman only) in the first two attacks it changed the queue!

I.e.

1st attack Horseman (1st stack) vs pikeman (1st stack) (pm survives)
2nd attack Horseman (1st stack) vs pikeman (1nd stack)
or
2nd attack Horseman (2nd stack) vs pikeman (1nd stack)

So there is not an a/d dependency either!
Did the pikeman survive the second attack or not? Perhaps the survival of the combatants affects the queue?

Example:

1st Attack: Horseman (1st Stack) vs. pikeman (1st stack) (pm survives)
2nd Attack: Horseman (2nd Stack) vs. pikeman (2nd stack)

If you change the first attack to:

1st Attack: Horseman (2nd Stack) vs. pikeman (1st stack) (pikeman dies)

is the 2nd attack changed?

Also, you say that it doesn't matter which of these you do first:

Horseman (1st stack) vs. pikeman (1st stack)
or
Horseman (2nd stack) vs. pikeman (2nd stack)
, right?

Does it change the queue if you change it to

Horseman (1st stack) vs. pikeman (2nd stack)
Horseman (2ndstack) vs. pikeman (1st stack)
?
Excelsior is offline  
Old November 25, 2001, 20:00   #19
Admiral PJ
PtWDG Lux Invicta
Prince
 
Admiral PJ's Avatar
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Dec 2000
Location: Southeast England , UK
Posts: 592
I'm a programmer, and it seems pretty clear that the game uses random number seeds so that no matter if you save a game, the results will always be the same (if you follow the same moves you did each time) as it saves the random seed each time.

It is strange that you'd expect a pattern if similar units were in combat, so like the 3rd unit would always win, but they might change the random seed for the units number or something so it always goes the same way.

WHAT THIS MEANS FOR RELOADS:
if you want to reload a game and chance the outcome in your favour, do like is said in this forum , change the order which you attack/move, I'm not sure what actions change the random seed, it could be it changes the random number depending on what movement number your on..

Often i've got fed up playing seriously, and mucked around for a few turns and suddenly got a Leader!
There may be some luck mechanism programed in, where if you lose or do worse then it helps you giving you more resources or a leader or more unit rank promotions.
Admiral PJ is offline  
Old November 26, 2001, 09:39   #20
FuManchu
Settler
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 5
Hope this might shed some light on things. Situation is probably a lot simpler than it looks (despite the fact the length of this post might suggest otherwise!)

Random number generators generally produce a difficult-to-predict-by-observation sequence of numbers, but they do that by feeding a value (the "seed") through a complex equation and storing the result to be used as the seed next time round. So it's completely deterministic - in other words, if the seed is initially value A, it'll always become B on the first call, C on the second etc etc (not that the numbers themselves would fit such an obvious pattern).

The pseudo-random number generated is also very unlikely to be the seed itself. Usually the seeds are great big numbers and the return value would be something more useful - like a percentage for instance - derived from specific bits of the seed. But this is just applying more maths, so a specific seed value will always produce a specific random number and we've still got a pre-determined (though still hard to predict) sequence of numbers.

Anyway (if you're still with me)...

This more than likely explains the phenomenon mentioned, that if you repeatedly reload a game and try the exact same sequence of attacks you get exactly the same results. I've been tinkering around with it, and battles do appear to have identical outcomes - even down to when individual hit points are lost - as long as you always carry out your attacks in the same order as before. If you change the order of attacks the outcome of the battles may change, but that's explicable too.

For all this to add up, I'm making two (reasonably big) assumptions...

1) The current seed value is saved along with the rest of the game data and restored when the game is reloaded (as mentioned in other posts).

2) The random number generator is only ever called when it's needed - e.g. for combat.

This is kind of interesting. It doesn't really prevent people cheating as attacking in a different order can yield more favourable results and if you're bothered enough you could go through all your options to find something better by continuously reloading and trying again. The thing is, this effect could be avoided if the program called the RNG every so often in the background to bump the random number sequence along - IOW made it not completely relative to what the player does (and also the seed wouldn't need to be saved at all).

So why are they doing it? Best guess - it might be some kind of multiplayer synchronization thing. If the seeds on different machines are set the same to begin with then communications are a bit simpler - you just need to give the other machine a list of battles between specific units and it can figure out the identical outcomes on it's own, round-by-round, battle-by-battle. You don't need to chuck so much data back and forth.

As to why you can get different outcomes by trying battles in a different order: we've got a fixed sequence of random numbers so if you change the order you fight battles in, each battle is going to hit the sequence in a new place, get a different set of numbers and so maybe have a different outcome.

I really don't think there's anything sinister involved and I don't think there's anything here that ties in with other combat weirdness, as in "unrealistic" results. Which is whole other topic...
FuManchu is offline  
Old November 26, 2001, 09:57   #21
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
The replies that this thread gets seem to suggest that we are puzzling over why re-loading doesn't work. That is absurd and can only be a result from not reading the thread or not understanding it.

I'm a programmer myself, and call me anal, but I actually would like to know how the combat RNG queue system works. I'm interested as it relates to my field and I do think it may help the re-occurring discussion on the combat system in this forum.

Quote:
Originally posted by FuManchu
I really don't think there's anything sinister involved
Neither do I.

Quote:
and I don't think there's anything here that ties in with other combat weirdness, as in "unrealistic" results. Which is whole other topic...
I agree with your explanation on how the RN is used but what I'm interested in is what kind of action, when, under what circumstance, changes the order of results. Hence the testing.

Zap

I don't agree. If you know how a system works you may find it easier to know how and if it fails.
zapperio is offline  
Old November 26, 2001, 10:05   #22
Dev
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 130
Good observations zap.

Now I wonder if messing with the queue can change the whole AI path. i.e. if you can make the AI move unit X from A to C instead of A to B simply by reloading and do whatever you're doing in a different order.

/dev
Dev is offline  
Old November 26, 2001, 10:15   #23
zapperio
Warlord
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Halifax, NS
Posts: 150
Quote:
Originally posted by Excelsior


Did the pikeman survive the second attack or not? Perhaps the survival of the combatants affects the queue?
No, he succumbed to his numerous wounds, alas. What changed the queue in this case was either that he was attacked twice in a row or, and I need to test this, he was attacked while wounded (he'd lost 1 hp in previous attack).

Quote:
Example:

1st Attack: Horseman (1st Stack) vs. pikeman (1st stack) (pm survives)
2nd Attack: Horseman (2nd Stack) vs. pikeman (2nd stack)

If you change the first attack to:

1st Attack: Horseman (2nd Stack) vs. pikeman (1st stack) (pikeman dies)

is the 2nd attack changed?
Hard to test, that as he will either die or he will not die when attacked, in the 1st attack, by a horseman. Nothing I can do will change that except if we had a reg pikeman that survived against reg horseman but died fighting elite horseman. I still haven't seen that happen though. Saaay....

Quote:
Also, you say that it doesn't matter which of these you do first:

Horseman (1st stack) vs. pikeman (1st stack)
or
Horseman (2nd stack) vs. pikeman (2nd stack)
, right?

Does it change the queue if you change it to

Horseman (1st stack) vs. pikeman (2nd stack)
Horseman (2ndstack) vs. pikeman (1st stack)
?
No it doesn't.

I tried all combinations and there was no change until I attacked the same stack twice in a row.

Zap

Last edited by zapperio; November 26, 2001 at 10:24.
zapperio is offline  
Old November 26, 2001, 10:46   #24
quinalla
Apolyton University
Warlord
 
quinalla's Avatar
 
Local Time: 12:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Ohio, USA
Posts: 208
Excellent thread, zapperio, I haven't done any testing myself, but it what you have done so far is very interesting. I might have to try something myself.

-quinalla
__________________
Jacob's Law "To err is human: to blame it on someone else is even more human."
quinalla is offline  
Old November 26, 2001, 11:45   #25
FuManchu
Settler
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 5
zap: you said "The replies that this thread gets seem to suggest that we are puzzling over why re-loading doesn't work"

Sorry, that wasn't my intention. I was mainly offering a suggestion as to why they bother to store the RNG seed
in the save file at all. It's probably there for a reason. Also: if it weren't there, we wouldn't be able to enjoy this entertaining discussion

Anyway, you want suggestions as to how the RNGs are picked up by the combat routines. Here's my hypothesis...

Let's assume we've got an RNG producing a series of random percentages. As I said in my previous post, the series is generated to a fixed pattern determined by the current value of the seed and the formula applied to it. So call the RNG a dozen times for a specific initial value of the seed and you'll always get the same set of a dozen numbers in the exact same order.

You fight two battles. First time it's A vs B, second time it's C vs D. If the first battle requires 3 rounds to resolve and it only needs one random value per round then A vs B will use the 1st, 2nd and 3rd numbers from the sequence, C vs D will use the 4th onwards.

Reload, seed gets reset, repeat battles, same numbers, same results.

However, if you reload and reverse the order of the battles then C vs D gets the numbers at the start of the sequence, A vs B picks up the sequence wherever C vs D finished off. So by reversing the battles you plug them into a different set of random numbers, which could well effect their outcomes.

Make sense? I'd be interested to hear if you've seen anything that might contradict this.
FuManchu is offline  
Old November 26, 2001, 12:32   #26
Hurry
Chieftain
 
Local Time: 19:23
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 57
Quote:
Sorry, that wasn't my intention. I was mainly offering a suggestion as to why they bother to store the RNG seed
The most probable reason for saving the random seed is to make reload-cheating harder. As you have shown, this can easily be bypassed when you have several stacks of units, but especially early in the game, cheating is hard. For example, reloading won´t help you if you find a horde of barbarians in a village instead of something useful.

And yes, it seems quite clear that the random seed is only called for when it is needed.
Hurry is offline  
Old November 26, 2001, 12:43   #27
AHO
Chieftain
 
Local Time: 17:23
Local Date: October 31, 2010
Join Date: Nov 2001
Location: WV
Posts: 55
I've also noticed that battle results will change by doing something that would appear to be completely unrelated but that uses a random outcome, such as, entering a goodie hut (or not entering the hut, whichever way you did it the first time). Conversely, you can change the outcome of the goodie hut by altering your battle plan (which, again would seem unrelated, but is tied to the RNG)
AHO is offline  
Old November 26, 2001, 12:50   #28
Nero Would
Chieftain
 
Nero Would's Avatar
 
Local Time: 12:23
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 90
Quote:
Originally posted by zapperio

No, he succumbed to his numerous wounds, alas. What changed the queue in this case was either that he was attacked twice in a row or, and I need to test this, he was attacked while wounded (he'd lost 1 hp in previous attack).

Zap
Surely that must be it. I may be missing something, but you seem to be assuming that one random number is used to resolve the combat between a pair of units. That does not fit the explanations of combat that I have seen. It seems more likely that one random number is used to resolve each round of combat, that is the loss of a hit point by one unit or the other. Any time you do something that changes the number of rounds it takes to resolve a given combat, the following combat will no longer get the same random numbers.

So if you change the attack/defense/experience values of any unit, or if you substitute a wounded unit (i.e. few hit points) for an otherwise identical unit, you potentially change the number of rounds (and therefore random numbers) required to resolve the combat. If the number of rounds is changed, the next combat starts at a different point in the string of random numbers.
Nero Would is offline  
Old November 27, 2001, 05:15   #29
Hurry
Chieftain
 
Local Time: 19:23
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 57
I hade the chance to make a little test in my current game, which in my opinion proves that the "die" is rolled in advance.

I had five Knights of different experience and damage levels (and in different tiles, as well), and I attacked a single regular Longbowman at full strength (3 hit points). After attacking with one of the knights, I reloaded and tried with another of the knights. These are the results (H=hit to enemy, W=wounded):

Attack with Elite Knight w/ 3 Hit points left: HWHH, Leader produced
Attack with Veteran Knight w/ 4 Hit points left: HWHH, upgraded to Elite
Attack with Regular Knight w/ 3 Hit points left: HWHH, upgraded to Veteran
Attack with Regular Knight w/ 2 Hit points left: HW, withdrew from battle
Attack with Veteran Knight w/ 1 Hit point left: HW, lost battle.

I think this clearly shows that the queue of random numbers is fixed, and also that is may be used as much in your favor as against you if you love reload-cheating.

Hurry

Last edited by Hurry; November 27, 2001 at 05:21.
Hurry is offline  
Old November 27, 2001, 05:32   #30
Hurry
Chieftain
 
Local Time: 19:23
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 57
I continued my testing a little bit.

As I showed in the above post, my unit got a hit during the second round of combat (after inflicting one hit on the enemy). This meant that I lost the battle if my unit had only one or two hit points left (since Knights retreat when wounded to one hit point). Now, I let this happen, and continued attacking with a second knight.

If my theory was right, I would always win this battle with no damage. This was the case. I always won, even if I attacked with a one-strength Knight. Also, I was also upgraded after the battle, and the Elite Knight always produced the leader.

Imagine the random generator is a die with 100 sides. It has always made the next 100 die rolls or so. Now, in this example, the die rolls could for example be 40, 96, 9, 67 and 1 (low number in favour of the player).

Since I had around 80% chance of winning (attack str 4 against def str 1), the die rolls 1, 3 and 4 was in my favour, while die roll 2 was in the enemys favour. The last die was in this case used to check whether my unit was upgraded after the battle. As you have seen, the elite can´t be upgraded, but instead produced a leader. The probability of gaining a leader is less than being upgraded, but can still use the same die roll.

Hurry
Hurry is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 13:23.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team