Thread Tools
Old December 6, 2001, 04:45   #31
Qnuc.dk
Chieftain
 
Local Time: 17:59
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Denmark
Posts: 32
RE: Moraelin

Very simple and makes sense. But wouldnt the unit fights per cent win/loose outcome be false.

A knight (4-3-2) attacking a phalanx (1-2-1) doens't necessary mean a 4/6 succes rate?, but somewhere close



RE: Ironwood

The idea is similar to the post above I believe
Quote:
We know an attacking unit (value 4) vs a defending unit (value 2)
that the chance outcome for attacking unit is (4+2) / 4 = 2/3
and the chance outcome for defending unit is (4+2) / 2 = 1/3

So the system must be something like
adding the 2 units calculate value (in this case it is 4 and 2)
and from the result, then use an 6_ranged_int_list like

5415151412425566564646362525112636645 ... (loop to start)

and the attacking unit win with the values 1,2,3,4
and the defending unit with 5,6

But I personnaly doubt there's a unic link between unit attack/defence values and result probability, (not the way we think it is)
Qnuc.dk is offline  
Old December 6, 2001, 05:00   #32
Ironwood
Prince
 
Local Time: 10:59
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Clovis, CA
Posts: 386
Quote:
Originally posted by Qnuc.dk
RE: Moraelin

Very simple and makes sense. But wouldnt the unit fights per cent win/loose outcome be false.

A knight (4-3-2) attacking a phalanx (1-2-1) doens't necessary mean a 4/6 succes rate?, but somewhere close

Given that, unless the devs were smoking pot the day they designed that algorithm, we're dealing with integers here, it is exactly a 4/6 (2/3) chance, within the limitations of a computer's random number generator, that is. So yeah, I suppose in reality, it's not perfect (no random number generator, or even physical die, is), but the logic the code attempts to replicate is very specific.

(Grumble, can't figure out how to make that paragraph make sense...)
__________________
To those who understand,
I extend my hand.
To the doubtful I demand,
Take me as I am.
Ironwood is offline  
Old December 6, 2001, 05:11   #33
Moraelin
Warlord
 
Moraelin's Avatar
 
Local Time: 17:59
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 284
Actually, they don't. If we both roll dice, and I have a 4 sided die, while you have a 10 sided die, chances are you'll win more often. Or to get back to the random number lists, if we both pick cards from a stack of playing cards, and I multiply their value by 4, while you multiply their value with 10, chances are that you'll get higher numbers more often than I do. It's the same stack of cards, but the multiplier you use for your defending Infantry is higher than the multiplier I have for my attacking Immortals, so most of the rounds you'll win.

Mind you, that's not the only way to roll attack vs defense. For example you could use only one number per round, by adding the defense and attack values and rolling only once for the sum. I.e., I add 4 and 10, and roll a number from 1 to 14. If it's under 10, your infantry wins, if it's between 11 and 14, my immortals win. I understand that that's the way Civ 3 really works.

But the whole point wasn't to end up with an accurate model of Civ 3, since there's already a combat calculator for that. It was just to give you a rough idea of why having a pre-set deck of cards that everyone draws from, doesn't mean you can accurately predict everything until the end of the game. And that even with saving the random seed, there are ways to skip one or more numbers from that list when you reload.

In fact, the saving only creates even more opportunities for cheating. Since the exact same sequence of actions produces the exact same results, you can feel free to try different combinations until you find the perfect sequence of actions. You don't have to stop from reloading when you get a "good enough" result, since you can always repeat the actions that produced that result. You can keep trying, and if you only get worse, then repeat the sequence that was the best so far.
Moraelin is offline  
Old December 6, 2001, 06:34   #34
Qnuc.dk
Chieftain
 
Local Time: 17:59
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Denmark
Posts: 32
Ok, assume the random seed list is based on numbers from 0 - 9

7987120359729835723984723 ... (loop to start)

When a unit attack another unit, their attack/defense values are calculated with a number from the random seed list

i.e.

Knight attack value 4 multiplied with 7 = 28
Phalanx defense value 2 multiplied with 9 = 18

The Knight would win 1st round

When the units values are equal the defender wins the round


So here's 2 simple math test, where I've calculated the success/failure rate from the rulers stated above

(Calculate all win/loose possibilities and end with a success/failure rate)



att-l = attack list
aw = attack wins count
dw = defense wins count
res = result of calculated success/failure rate
real = real success/failure rate



0123456789
-----------------------------------------------
knight(4) 0 4 8 12 16 20 24 28 32 36
warrior(1) 0 1 2 3 4 5 6 7 8 9


att-l, aw , dw

0 -> 0 , 10
4 -> 4 , 6
8 -> 8 , 2
12 -> 10 , 0
16 -> 10 , 0
20 -> 10 , 0
24 -> 10 , 0
28 -> 10 , 0
32 -> 10 , 0
36 -> 10 , 0


Res -> 82 , 18

Real = 80 , 20
-----------------------------------------------




0123456789
-----------------------------------------------
musketmen(4) 0 4 8 12 16 24 28 32 36
musketmen(4) 0 4 8 12 16 24 28 32 36


att-l, aw , dw

0 -> 0 , 10
4 -> 1 , 9
8 -> 2 , 8
12 -> 3 , 7
16 -> 4 , 6
20 -> 5 , 5
24 -> 6 , 4
28 -> 7 , 3
32 -> 8 , 2
36 -> 9 , 1

Res -> 45 , 55

Real = 50 , 50
-----------------------------------------------



In the first example the attackers chance is to high and in the second example the defense chance is to high

What I really want to know is what is the real success/failure rate?





But again, they could use some fancy math formula based on Moralin's idea to make the win/loose chance rate 'true'

I bet the civ3 math algorithm is very advanced
Qnuc.dk is offline  
Old December 6, 2001, 06:35   #35
Yog-Sothoth
Prince
 
Local Time: 18:59
Local Date: October 31, 2010
Join Date: Sep 2000
Location: Trondheim, Norway
Posts: 431
Quote:
Originally posted by cavebear

I detest games where results are mostly random rather than comprehensible given the powers of the units involved.
I completely agree. When playing civ3 I often find myself thinking, "why the hell did that happen, that makes no sense!!". I don't like luck playing suck a big role in the game. When you attack a warrior with a tank, there should be no more than a tiny chance that the warrior would win. I find myself completely unable to predict the outcome of almost any combat, it's incredibly frustrating.
Yog-Sothoth is offline  
Old December 6, 2001, 07:13   #36
Moraelin
Warlord
 
Moraelin's Avatar
 
Local Time: 17:59
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 284
OK, lets go into the "take the sum and then see in which region falls" algorithm, which again is how I understand the Civ game really works. Let's assume a random number generator that goes from 0.1 to 1.0, in decimal increments.

Knight: 4
Warrior: 1
4 + 1 = 5

We take a random number, we multiply it by that 5, and if it's less than 4 or equal to 4, the knight wins, if it's over 4, the warrior wins.

We

0.1 -> 0.5 -> less than or equal to 4, so knight wins
0.2 -> 1.0 -> less than or equal to 4, so knight wins
0.3 -> 1.5 -> less than or equal to 4, so knight wins
0.4 -> 2.0 -> less than or equal to 4, so knight wins
0.5 -> 2.5 -> less than or equal to 4, so knight wins
0.6 -> 3.0 -> less than or equal to 4, so knight wins
0.7 -> 3.5 -> less than or equal to 4, so knight wins
0.8 -> 4.0 -> less than or equal to 4, so knight wins
0.9 -> 4.5 -> over 4, so warrior wins
1.0 -> 5.0 -> over 4, so warrior wins

As you can see, the knight wins in exactly 80% of the rounds, the warrior wins in exactly 20% of the rounds.

Let's take knight against something with defense 6. E.g., unless my memory fails me, against a marine set on defense. On flat ground, no defense bonuses:

Knight: 4
Marine: 6
4 + 6 = 10

0.1 -> 1 -> knight wins
0.2 -> 2 -> knight wins
0.3 -> 3 -> knight wins
0.4 -> 4 -> knight wins
0.5 -> 5 -> marine wins
0.6 -> 6 -> marine wins
0.7 -> 7 -> marine wins
0.8 -> 8 -> marine wins
0.9 -> 9 -> marine wins
1.0 -> 10 -> marine wins

So the knight wins 40% of the rounds, the marine successfully defends 60% of the rounds.

However, bear in mind that:

1) There is more than one round, so things go a bit more skewed towards the stronger unit. For example although the knight has 40% to win one round, if they're both conscript (2 hit points), the knight would have to pull a 0.4x0.4=0.16=16% probability to win both rounds in a row and defeat the marine without even taking a scratch. On the other hand, the marine has 0.6x0.6=0.36, i.e. a whole 36% to win both rounds in a row, and defeat the knight without taking a single hit. That's more than twice the chances the knight has. (Assuming the Knight doesn't retreat after the first hit it takes. Actually, to add insult to injury and get the retreat out of the picture, let's replace the Knight with Longbowmen or Immortals, which have the same 4 attack.) And the rest of the 58% are various other outcomes where one unit wins, but takes some damage in the process.

And if we're talking both veterans with 4hp each, things become even more skewed in the marine's favour. Now the veteran Longbowmen only have 2.56% chances to win without even taking a scratch, while the veteran marines have a whole 12.96% (practically 13%) to defend and kill the Longbowmen, without even taking a scratch. That 40-60 per round isn't half as equal, and definitely not a case of "why bother making better units?"

2) But again, it's random. Crap can happen. As in Terry Pratchett's Discworld, one-million-to-one chances crop up nine times out of ten. Well, not really, but as you can see above there is a whole 16% chance that a conscript Longbowmen will just slaughter your conscript marines without even taking a scratch. Again, not just win, but not even take a scratch. It will happen every sixth battle or so! Or in the case of veterans, that 2.56% means that on the average more than 1 in every 40 battles, the veteran Longbowmen will roll over the veteran Marines without taking a scratch. Most people fight more than 40 battles in a game, so they WILL see this happening.

3) Terrain also counts. If that Knight attacks mere spearmen, but those spearmen are fortified in the mountains and across a river, well, don't be surprised if you don't have 4-to-2 chances.

Last edited by Moraelin; December 6, 2001 at 07:32.
Moraelin is offline  
Old December 6, 2001, 07:28   #37
Qnuc.dk
Chieftain
 
Local Time: 17:59
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Denmark
Posts: 32
mmkay

thx for detail illustrations, now I got it
Qnuc.dk is offline  
Old December 6, 2001, 10:08   #38
ntyatecafe
Chieftain
 
Local Time: 12:59
Local Date: October 31, 2010
Join Date: Dec 2001
Location: Georgia, USA
Posts: 42
Quote:
Originally posted by XPav

Because Chess is easier for a computer to play than Civ?
Because Deep Blue was a ridiculously powerful computer dedicated to one task, programmed by very very smart people?
Also because when dealing with Chess, there are a limited number of possible moves for the opponent. Granted, it is a high number, but not as high as the possible moves one can make in Civ3.

Deep Blue just had to look at the most practical of the possible moves, and move from there.
__________________
Why did I join the Army?
Free Food
Free Bullets
And it sure beats working for a living...
ntyatecafe is offline  
Old December 6, 2001, 10:31   #39
dweez
Chieftain
 
dweez's Avatar
 
Local Time: 18:59
Local Date: October 31, 2010
Join Date: Nov 2001
Location: Sweden
Posts: 36
Quote:
Originally posted by cavebear
Thanks, really. But it still doesn't resolve my concern. Perhaps it is that Civ3 has a far broasder range of possible victory numbers for old units vs newer ones. I just can't get much interest in a game where a 3.2 swordsman loses to a 1.1 warrior on grassland.

I think I would rather play Risk, and where can I get the software/site for that? Civ3 is too uncontrolable in SP.
This is quite stupid. You want a game where a 3.2 swordsman ALWAYS wins over a 1.1 warrior? Then there is no need for battle and no need for those numbers, just call it "swordman" and "warrior" without the numbers and say that a swordman always defeats a warrior without any battle or randomness.
Well, maybe that's what you want, but I wouldn't find that kind of game very entertaining. You're right, go play Risk instead.
dweez is offline  
Old December 6, 2001, 10:46   #40
Hurry
Chieftain
 
Local Time: 19:59
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 57
Thanks again for your posts, Moraelin. I agree with you 100%.

Moraelin wrote:
Quote:
In fact, the saving only creates even more opportunities for cheating. Since the exact same sequence of actions produces the exact same results, you can feel free to try different combinations until you find the perfect sequence of actions. You don't have to stop from reloading when you get a "good enough" result, since you can always repeat the actions that produced that result. You can keep trying, and if you only get worse, then repeat the sequence that was the best so far.
This is the point I am trying to make. By reloading several times and always recording the results you can draw quite a few conclusions. I am not using this for cheating, but to try to get a picture of the chance of a certain event occuring. For example, the chance of a unit being upgraded, or the probability of hitting with a bombardment (and what it will hit).

Now, in order to make these conclusions, one must know how many "cards" are taken from the stack each time. Moraelin suggests two cards (or die rolls) are needed for each round of battle. However, are two cards also needed to decide whether a bombardment attack succeeds? I guess one could be enough since there is no designated defender. And will one, two or even four cards be used if the result of the bombardment was two hits to the enemy unit? And how about upgrades?

I myself always try to simplify things, and that´s why I use percentages. I know the computer does not use them as such, but in the end we are anyways playing with percentages.

I am trying to make a bit of testing right now, and here I simply imagine the random number generator as a 100-sided die. So, when I attack with an Armor (att 16) against an Infantry in Mountains (def 10x100%), I will win on die rolls 1-44, while the Inf will win on 45-100. Imagine I lose this one-round battle (the inf was at 1HP). I reload and attack something with my artillery, which hits! Now I can draw the conclusion that artillery will hit on die rolls in a maximum range of 45-100. By making several more tests, I can eventually come to an answer saying for example that artillery will hit an enemy unit on die rolls between 1 and 75. I´ll post some results to clarify this later.
Hurry is offline  
Old December 7, 2001, 20:31   #41
Moraelin
Warlord
 
Moraelin's Avatar
 
Local Time: 17:59
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 284
Umm... While I can definitely understand the curiosity of dissecting how stuff works, do you REALLY need to go into THAT kind of detail?

I mean, really, understanding the probabilities and basic game mechanics is a noble goal. But stuff like exactly how many cards are drawn from the deck, and if you can predict exactly how the deck looks in advance, is IMHO a bit overkill.

You'd probably need to figure out the exact algorithm used first. E.g., that deck is going to look different if they're using a Mitchel-Moore generator, than if they use something else.

Then you'd need to figure out the exact constants used in that algorithm.

Then you'd need to figure exactly what happens to a drawn card for each number roll. E.g., there's a fundamental difference between the following two functions, that give back a number up to a given limit. I.e., you tell them how many sides you want the die to be, and they roll it for you. They're both in Java, addapted from one of my libraries, btw.

Code:
    public static final int rand1(int upperLimit) {
        if (upperLimit <= 1) {
            return 0;
        }
        return rand() % upperLimit;
    }

    public static final int rand2(int upperLimit) {
        int power;
        int number;

        if (upperLimit <= 1) {
            return 0;
        }
        for (power = 2; power < upperLimit; power <<= 1) {
        }
        power --;
        while ((number = (rand() & power)) >= upperLimit) {
        }
        return number;
    }
The fundamental difference is that the first one always draws one card from the list, while the second can draw more than one card per die roll. (However, the second has its advantages, too.) With the same deck of cards, you can get a fundamentally different result by using one or the other.

Even once you knew all that, you'd have to figure out the exact seed for the current list, before you can predict anything. That's a lot of trying.

AND, most importantly, even if you know the exact list at a point in time, all that knowledge ends the moment you end the turn. There are a lot of AI actions before you get the next turn, a lot of which need a random number. So unless you know all of them exactly, there's no way to tell how many cards did get pulled out of the stack during that time. So you're back to square one: you don't know what's next in the list, and you have to start the figuring out all over again.

And again, is it worth going into THAT kind of detail? Even if it were possible to figure it all out from the outside, it's already in the realm of "one heck of a lot of work". Unless you're in it for the pure intellectual challenge of figuring out a random number generator, I'd say not. It's likely not going to make your life any easier in the game, if that's the purpose.
Moraelin is offline  
Old December 24, 2001, 14:48   #42
Zachriel
King
 
Zachriel's Avatar
 
Local Time: 13:59
Local Date: October 31, 2010
Join Date: Dec 2001
Location: U.S.A.
Posts: 1,194
Quote:
Originally posted by cavebear
I just can't get much interest in a game where a 3.2 swordsman loses to a 1.1 warrior on grassland.
Spartacus. Believe me, the Romans weren't very happy either, but they couldn't quit the game.

(Like most such loses, it was due to tactical mistakes by overconfident commanders.)
Zachriel is offline  
Old December 24, 2001, 15:00   #43
Zachriel
King
 
Zachriel's Avatar
 
Local Time: 13:59
Local Date: October 31, 2010
Join Date: Dec 2001
Location: U.S.A.
Posts: 1,194
Quote:
Originally posted by XPav
Because Deep Blue was a ridiculously powerful computer dedicated to one task, programmed by very very smart people?
Keep in mind that the computer may have won the match, but also lost several games. It may be hard to believe, but the computer won the old fashioned way; it psyched-out its opponent. Kasparov kept thinking that some human was making the moves and not the machine. He should have been thinking about his next move instead.

Fisher always liked to psych-out his opponents, too.
Zachriel is offline  
Old December 24, 2001, 21:07   #44
Whoha
Alpha Centauri Democracy GameACDG3 Morgan
Emperor
 
Whoha's Avatar
 
Local Time: 12:59
Local Date: October 31, 2010
Join Date: Dec 2001
Location: The TOC is supposed to be classified guys...
Posts: 3,700
dont build swordsmen, horsemen are better
Whoha is offline  
Old December 25, 2001, 13:24   #45
Atahualpa
Spanish CiversCivilization III PBEMPtWDG2 Latin Lovers
Emperor
 
Atahualpa's Avatar
 
Local Time: 18:59
Local Date: October 31, 2010
Join Date: Mar 1999
Location: voice of reason
Posts: 4,092
Maybe Firaxis could pop up the military advisor who gives his comments when you take the mouse and drag the unit over the enemy unit. Something like:

"We can aswell give up!"
"I doubt it will work, Sire"
"We might stand a chance here"
"Give 'em Hell"

Of course Military Advisors could be wrong
and of course make it an option!

Ata
Atahualpa is offline  
Old December 27, 2001, 03:19   #46
Daimyo
Settler
 
Daimyo's Avatar
 
Local Time: 17:59
Local Date: October 31, 2010
Join Date: Feb 2001
Location: Feudal Japan
Posts: 11
oh yeah.. I miss the feature "Confirm odds before attacking" in SMAC.. It was really helpful

I don't think it's that difficult to add this option in a future patch.. but I doubt that Firaxis will do something about it.. it's kinda not essential..(you know, if ain't broken, dont fix it)
Daimyo 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:59.


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