GOTM 42: Pre-Game Discussion

Skydance said:
The actual formula you need for the odds has to take into account that the Defense can fail 4 times (it takes 5 failures to kill him). I think you need to use that old factorial formula for computing this one. ;) I wish I knew for sure.

If you change factorial to binomial then you're correct. :)

First of all some clarifications to my earlier post. Carthage was size 1 at the time (I shouldn't have called it the city of ..., I know) so I didn't calculate with the city bonus. Could we have a definite answer on whether or not the capitol counts as a city?

A mercenary fortified on a hill is 3 x 1.5 x 1.25 = 5.625 3 x (1+0.5+0.25) = 5.25 defense. Adding an extra 0.5 for the city bonus gives 6.75.

Let's call the base probability of scoring a hit p, which in the example above would be 3/(3+5.25) ~= 0.364 for the one of my legions. I will use the following additional variables:
  • ohp = the number of hp the opponent starts with
  • hp = the number of hp you start with
  • lhp = the number of hp you lose
Informally, the chances that you will win is equal to the sum of the chances that you will win with a certain number of lost hp, which will range from 0 to h-1. Semiformally:
Code:
pWin = sum[lhp = 0 to hp-1](pWinAt(lhp))
The probability to win with a particular number of hp lost is where the binomial series come into play. I'll use an example where ohp is 3, hp is 3 and lhp is 1, i.e. you both start with 3 hp and you win win 2 hp left. Denoting an hit by you with x and an hit by the opponent o, the different outcomes are
  • o x x x
  • x o x x
  • x x o x
In all these outcomes you score ohp hits while the opponent will score 1 hit. The number of ways you can create such outcomes is exactly the binomial value 1 | 3, read "one over 3". Intuitively, for those who haven't read probability maths, x | y is "the number of ways you can pick x items out of a set of y elements". In our example the "items" are the positions at which an opponent hit occurs, and the set is the positions at which such a hit can possibly occur. Since the last hit must always be from you (otherwise you wouldn't win), we have that x = lhp and y = lhp+(ohp-1), i.e. y is the length of a series of hits (4 above) minus the last element which is always a hit from you.

With this intuition we can define pWinAt as
Code:
pWinAt(lhp) = p^ohp * (1-p)^lhp * (lhp | lhp + ohp - 1)
Informally this means that we must score a hit (probability p) ohp times to kill the opponent, he must hit us (probability 1-p) lhp times for us to lose that many hp, and we can construct (lhp | lhp + ohp -1) such series.

Instantiating these formulas for an elite legion attacking a regular mercenary gives
  • p = 3 / (3+5.25) ~= 0.364
  • ohp = 3
  • hp = 5
yielding a probability of ~ 0.5. For other values we get:
  • eLegion vs rMerc -> 0.50
  • eLegion vs vMerc -> 0.32
  • eLegion vs eMerc -> 0.20
  • vLegion vs rMerc -> 0.38
  • vLegion vs vMerc -> 0.22
  • vLegion vs eMerc -> 0.12
If the capitol counts as a city for defense purposes, then we get instead
  • eLegion vs rMerc -> 0.37
  • eLegion vs vMerc -> 0.21
  • eLegion vs eMerc -> 0.11
  • vLegion vs rMerc -> 0.27
  • vLegion vs vMerc -> 0.14
  • vLegion vs eMerc -> 0.06
which is considerably lower.


Since the chances of an initial win for an elite legion are quite high we cannot make the simplification that we are facing an elite mercenary from the beginning. Thus it's hard to say something about the overall probability of losing 7 legions in a row (2 were elites, 5 veterans, and in my game I actually had one more who captured the bloody place), except that they are small. Irritatingly small. :cry:
If we simplify so that we start against an elite mercenary, the chances of x legions winning are simply pWin with hp set to the sum of their individual hps. I don't do binomial numbers that large in my head, but I might be able to write a small program that does. :)
 
Niklas, there is an error in the premises.
Defense doesn't add up this way. When considering bonuses, it's always the base value that is multiplied by the defense factor, and the bonuses are added to the base value.

So, a merc fortified on a hill has a defense of
3 + (3*0.5) + (3*0.25) = 5.25
If the city is size 7+ another (3*0.5) is added, and the defense value becomes 6.75

Ah, there are no specific bonuses for the capital.

EDIT: that last sentence must be tested, i'm not 100% sure.
 
All this playing and I never even noticed... :blush:

Thanks tR1cKy for clearing that up. It will only affect the base probability calculation, to the benefit of the attacker. This means that the chances of that single merc goes down even more...
I'll correct my post above.
 
Alright, so I wrote a binomial number generator. Assuming 7 veteran legions that's 28 hp in total. Instantiating pWin with p = 3/(3+5.25) ~= 0.364, hp = 28 and ohp = 5 I get the whooping probability of 0.9974156 of a win, i.e. the chances that the merc would triumph is less than 0.26%. And that's assuming he starts as an elite. Gee, that's even worse than I expected.
Giving him a defense of 6.75 instead lowers the probability to 0.9848651, or slightly better than 1.5% chance of a defender win. Not much, but still a lot more than the previous.

I always knew the RNG hates me.
 
I know cats aren't as good in PTW as they are in C3C, but why wouldnt you bring a few along if you are going against carthage.

Any idea how the calculation looks if a HP is shaved off a merc first?
 
@budweiser: I brought no cats because I was pointy-stick researching Maths from Carthage. ;)

To calculate with one hp less, just set ohp in the formulas to 4 instead of 5. Once again that's assuming that the merc starts at 5 hp before the shaving. The probabilities of a win increase to 0.9991705, leaving the poor sod with less than a 0.09% chance to defend his home.

In this case the odds are overwhelming in any case, but with fewer legions the cat becomes more important. Assuming 4 veteran legions, the chances of a defender triumph is ~9.5% at 5 hp and drops to ~4.5% at 4 hp. With 3 vLegions the chances are ~25% vs ~15%.

Edit: Btw, how do you calculate the probabilities for a successful bombardment?
 
Good job Niklas.
Personally, it's some time that i have an impression floating around my mind. It could be wrong but... it seems that, when the RNG poops an exceptionally low value, it remains stuck in generating low values for quite a while.

Let N be the n-th current random number and F be the random generating function used to carve out the (n+1)th random value from N. It seems that when N is quite near to zero, the value F(N) has a high chance to be near zero at well. The result of such a thing would be a number of unfavourable events (like the one you described) much higher than expected from the probability.

If the RNG function isn't picked carefully enough such things may happen.
 
If carthage is even in the game, or greece. We wont face too many elites and if we strike early enough we will face regulars, not vets. I might not even build many barracks as all the barbs running around will act as free barracks for us, and unfortunately the ai.

I'm not sure how bombardment works in PTW, but I think you get an even chance to hit all three targets in the city; units, improvements, pop. So you need more cats than in C3C where units get hit first. The good news is cats against troops in the open work just fine and there are likely to be many troops out wandering looking for barbs.
 
Celts, Greece, Egypt, Carthage, Persia - they are Rome's contemporaries (just load up the Rise of Rome scenario in C3C).
 
@Niklas: doesn't the formula for calculating binomial odds include the ratio of two factorial numbers?

I felt it was time for a more "observational" approach, so I wrote a script to simulate 100,000 battles. (Umm ... 100,000 full fight-to-the-death sequences. It'll be easily a million individual attacks.)

As input, it takes the defender str & starting hitpoints, and the attacker str & number of hitpoints (more than 5 hitpoints for multiple attackers). My output shows the number of times at least that many hitpoints were lost by the attackers ... so it's more of a "probability chart" than just a result of a single calculation.

To verify that the system is working properly, I took two perfectly-matched opponents: each had 10 str and 5 hitpoints. The results came to a 50-50 chance of 5 attacker hitpoints being lost (defender wins the battle):

96920 (97%) 1 attackers lost
89080 (89%) 2 attackers lost
77350 (77%) 3 attackers lost
63582 (64%) 4 attackers lost
49930 (50%) 5 attackers lost

Okay! Let's see what 100,000 attempts at the tough problem shows us. (Ouch! 30 points of attackers? I thought we were talking about 22ish hitpoints of attackers. So much for 25% ....)

Defender: 5.25 strength, 5 hitpoints
Attacker: 3 strength, 30 hitpoints

99283 (99%) 1 attackers lost
97198 (97%) 2 attackers lost
93244 (93%) 3 attackers lost
87669 (88%) 4 attackers lost
80282 (80%) 5 attackers lost
71973 (72%) 6 attackers lost
63105 (63%) 7 attackers lost
54186 (54%) 8 attackers lost
45764 (46%) 9 attackers lost
38011 (38%) 10 attackers lost
30951 (31%) 11 attackers lost
25107 (25%) 12 attackers lost
20056 (20%) 13 attackers lost
15768 (16%) 14 attackers lost
12385 (12%) 15 attackers lost
9593 (10%) 16 attackers lost
7336 (7%) 17 attackers lost
5607 (6%) 18 attackers lost
4200 (4%) 19 attackers lost
3141 (3%) 20 attackers lost
2318 (2%) 21 attackers lost
1712 (2%) 22 attackers lost
1250 (1%) 23 attackers lost
893 (1%) 24 attackers lost
657 (1%) 25 attackers lost
488 (0%) 26 attackers lost
353 (0%) 27 attackers lost
253 (0%) 28 attackers lost
184 (0%) 29 attackers lost
139 (0%) 30 attackers lost

Yep ... 139/100000 (0.139%) is pretty small. And that's using the approximation that the Defender starts out as Elite; actual odds should be a touch lower.

Just for giggles, I gave the Defender a 50% wall bonus. I think this is the number we were using earlier (0.69 chance of Defender success). His odds went up dramatically:

Defender: 6.75 strength, 5 hitpoints
Attacker: 3 strength, 30 hitpoints

99722 (100%) 1 attackers lost
98780 (99%) 2 attackers lost
96791 (97%) 3 attackers lost
93636 (94%) 4 attackers lost
89169 (89%) 5 attackers lost
83663 (84%) 6 attackers lost
77351 (77%) 7 attackers lost
70390 (70%) 8 attackers lost
63262 (63%) 9 attackers lost
56113 (56%) 10 attackers lost
49110 (49%) 11 attackers lost
42411 (42%) 12 attackers lost
36343 (36%) 13 attackers lost
30914 (31%) 14 attackers lost
25947 (26%) 15 attackers lost
21559 (22%) 16 attackers lost
17852 (18%) 17 attackers lost
14685 (15%) 18 attackers lost
11998 (12%) 19 attackers lost
9751 (10%) 20 attackers lost
7907 (8%) 21 attackers lost
6321 (6%) 22 attackers lost
5051 (5%) 23 attackers lost
4017 (4%) 24 attackers lost
3158 (3%) 25 attackers lost
2492 (2%) 26 attackers lost
1946 (2%) 27 attackers lost
1524 (2%) 28 attackers lost
1204 (1%) 29 attackers lost
929 (1%) 30 attackers lost

Interesting to note is the scenario I discussed in my last post: 0.69 chance of Defender win, 17 attacks (average) to kill the Defender (at 0.31 hp per attack). 17 attacks - 5 wins = 12 losses. 12 attackers lost happens 42% of the time, though ... so that theory was ballpark, but it was wrong.
 
Niklas said:
Instantiating these formulas for an elite legion attacking a regular mercenary gives
  • p = 3 / (3+5.25) ~= 0.364
  • ohp = 3
  • hp = 5
yielding a probability of ~ 0.5.
Oh - since it's another good test of my script:

Defender: 5.25 strength, 3 hitpoints
Attacker: 3 strength, 5 hitpoints

95189 (95%) 1 attackers lost
86032 (86%) 2 attackers lost
74464 (74%) 3 attackers lost
62277 (62%) 4 attackers lost
50482 (50%) 5 attackers lost

Check.
 
ainwood said:
Not directly - I was actually doing some testing to see what it was that causes the wall graphics to appear on cities (where I found it was the bombard bonus, not the defence bonus). To test this, I actually gave barracks a bombard bonus. I was surprised to find that this prevented me from building a barracks in the capital (even though it was size 1). I'll double-check on this though.

Capitols can never have wall graphics because they always look like cities or metros (whether they are or not).
 
It is interesting how many different topics not directly related to GOTM42 were discussed in this thread. To try to bring this discussion back, I’d like to ask a question about southern oasis. In this graphical mode, it looks like it is shared between four tiles. Where is it exactly?

My opening sequence is likely to be the following:

4000BC worker nw, settler nw
3950BC worker n settler n
3900BC I may settle in the forest.
If not
3850BC settler ne, worker may start chopping the forest (may not)

Unless I will hear anything better, I will stick to the above plan.
I also will think before choosing the class, if predator won’t sound good for militaristic purposes, I will play open (I got badly burned in COTM11)
 
I don't see it as an oasis. I think it's the northern corner of a coastline or lake, and South/South from the settler is a water tile.
 
Sabre said:
Of course, the no Iron movement may serve as a way to eliminate bad luck from the game. Imagine the poor sap who has the only Iron in the area disappear on him.
That happened to me in GOTM 24. It disappeared in the IT right after 1000BC. I was convinced it was somehow hard coded to disappear immediately after QSC, but after the submissions were in it appeared that I was the only one it happened to. I was very discouraged and disbanded all units and declared on everyone to lose via conquest after a failed feeble desparation attack on Baekje's iron city. I'm a better player today and might not miss the iron so much.

solenoozerec said:
There are also Mostly Harmless and Young Zaphod Plays it safe, at least, in the book that I have at home. Yet, I did not read these two, got bored before. But I agree that the first one everyone MUST read.
Young Zaphod Plays it Safe is a short story and not its own book. Xevious listed the sequels in reverse order. So Long... and Mostly Harmless are the 4th and 5th books of the trilogy.

I'm guessing the towel reference is mainly about 42 and the upcoming movie. This is a bad enough start without trying to read between the lines of the intro!

And I thought DA had an Apple II, not a Mac?
 
Niklas said:
I ran a test game with the same settings, not quite the same bad start though. My closest neighbour was Carthage, with the city of Carthage located on a hill. I lost 7 veteran/elite legions to a single (initially) regular Numidian Mercenary. I consider this an omen...

I am of course disappointed that no-one used my simulator for this, so I did it myself (attack with 3 elite and 4 vet legions v one reg num merc in a hill city):

 
Offa, that's a great tool! I looked for something like that in the utilities section but I guess I didn't look hard enough.

Skydance, nice to see there's no big difference between theory and practice, eh? ;)
 
I also created a random map and then recreated the starting position. The oasis-like thing is coastline. My random map had Rome and 2 others on the big continent and 5 others on the small continent. Rome ended up almost in the middle of the lower half of the continent, with a very nice choke point (on a hill even) separating the lower from the the upper. I don't think we can be that lucky.

I removed iron from near the start to take it out of early consideration. There were a number of barb camps and ample resources and lux on the map. I concentrated on early moves. The barbs are pesky. I never build up enough to know how productive a tight ring would be.

Defending workers and cities will be important for me. It seems impractical to hook up the wine early, so home guards will be important. I'll probably settle 1 N, and start a chop N NW. Then road/mine and chop/road/mine the next forest. Research pottery, then Republic. Build barracks, warrior, warrior, settler, granery, warrior. Maybe granery before settler. I'll want to time my chops. Experiment with build order again tonight. The settler will take one warrior escort and settle RCP3 near the wine and build a worker. The new worker will connect then mine the wine. The first worker should have built a road to the second city by that time. Rome will build warriors/archers and settlers. A settler and escort will be sent to all the RCP3 sites. 8 of them? The second ring will be much farther out. In my first test runs, I sent out a very late warrior to scout and still made contact early enough to trade very effectively. To expand cities beyond 4 will require temples or lux.

How are the contact trades set up in this game? I had contact trading with writing in my map.

Anyway, I'll try some more runs. This looks like a hard start, and I will need to micromanage and guard everything.
 
Top Bottom