Veblen Veblen

Exploring effects of simultaneous combat

Exploring effects of simultaneous combat

Question: How will the simultaneous-firing system for combat (announced for 1.2) affect the ideal balance between weapons and armor?

This post attempts to answer this quantitatively using my combat simulator. I've started by writing a new version of the simulateCombat function that implements the simultaneous firing.

To show you the difference, I've uploaded two graphs. Here's how to read them: Combat is simulated a number of times (10000 here), and the "result" of each combat is saved. The result is defined as (Attacker hitpoints remaining - Defender hitpoints remaining), so a positive value means the attacker won, a negative value means the defender won, and (in the new system) a result of zero means both fleets were destroyed. The graphs show the number of times (frequency) that each result appears.
Attacking fleet: 3 ships, each 10 hitpoint, 6 beam attack, 4 beam defense
Defending fleet: same as attacking fleet
(Each ship has a small hull, Warp Drive II, 2 Phasors, 2 Shields II, miniaturization 25%, cost 252, size 32/32)
Current system:
Simultaneous firing:
The attacking fleet won 63.86% of the 10000 iterations in the current system, but only 47.74% of the 10000 iterations with simultaneous firing. Note also that the simultaneous system is quite symmetric around zero, which matches with our intuition: now that attackers and defenders are treated the same, we expect that when two identical fleets fight that it will be an even coin toss. More specifically, one expects that the true distribution is perfectly symmetric around zero. Also, note that while in the previous system there were no zero values, now they are common. In fact, there are (have always been) sharp spikes in frequency at the values that represent "whole" numbers of ships remaining, and zero is now one of these spikes.

So we set up the experiment as follows:
1. Pick two fleets, A and B, where A and B represent realistic options for a player at a certain tech level, and where A has only weapons and B has weapons and shields.
2. Using the sequential-firing simulateCombat function, estimate the probability that: (i) A wins attacking A, (ii) A wins attacking B, (iii) B wins attacking A, (iv) B wins attacking B.
3. Repeat (2) using the simultaneous-firing simulateCombat function
4. Interpret the data

1. Pick two fleets
We want to pick fleets that will give us meaningful results. In the interests of brevity, I'll skip to what I came up with.
Fleet A: Three ships, each with:
Small hull, Warp Drive II, 3 Phasors, miniaturization 25 =
10 hitpoints, 9 beam attack, 30/32 used space, 192 cost
Fleet B: Three ships, each with:
Small hull, Warp Drive II, 2 Phasors, 2 Shields II, miniaturization 25 =
10 hitpoints, 6 beam attack, 4 beam defense, 32/32 used space, 252 cost

The cost on the second ship is higher and it requires an additional technology (Shields II), but we're just going to ignore that. We're not looking for the best split between offense and defense, we're just looking to see how the effectiveness of each design type will change in the simultaneous firing system. Also, since the cost of researching Shields II isn't considered, note that while this may be useful in helping you decide which model to build if you have Shields II, it won't tell you if Shields II is worth researching in the first place. Despite these limitations, Fleet A and Fleet B are pretty representative, I think, and should be good enough for us to get something interesting.

2. Use sequential-firing model to estimate victory probabilities
Running sequential-firing simulateCombat with 5000 iterations,

(Probability attacker wins, median result, mean +/- standard deviation)
A attacks A: 86.88%, 15, 12.93 +/- 9.82
A attacks B: 62.06%, 9, 4.41 +/- 13.85
B attacks A: 86.70%, 16, 13.24 +/- 10.69
B attacks B: 64.04%, 9, 5.02 +/- 13.56

3. Use simultaneous-firing model to estimate victory probabilities
Running simultaneous-firing simulateCombat with 5000 iterations,

(Probability attacker wins, probability of tie, median result, mean +/- standard deviation)
A attacks A: 41.78%, 17.40%, 0, 0.04 +/- 8.25
A attacks B: 32.06%, 7.90%, -5, -3.99 +/- 10.37
B attacks A: 61.32%, 7.66%, 5, 4.17 +/- 10.37
B attacks B: 47.66%, 3.60%, 0, -0.07 +/- 12.28

4. Interpret the data
It looks like the ships chosen may have been... not so great. The results would have been clearer if, for example, B had been inferior in the first system but superior in the second. However, we see here that B is the superior ship is both: not surprising considering that it requires more research and has a higher production cost. Perhaps, in choosing ship design, Fleet A should have been given better weapons (thus more attack power and higher cost) in order to balance them. However, we can see some things worth noting in the data.

In the current system, Fleet A and Fleet B perform about the same as attackers. Fleet B, however, is much better at taking a punch. Fleet A's chance of surviving is about 13.2%, while Fleet B's chance of surviving is about 36.9%, about 2.8 times higher.

In the simultaneous-firing data, we see two things right away: The advantage to the attacker is gone now, and it was big. Also, Fleet B is superior to Fleet A in every way now: It will win about 2/3 of the time, regardless of if it attacks or defends.

In the current system,
When Attacking: Fleet A and B approximately the same
When Defending: Fleet B 2.8 times more likely to survive (36.9% vs 13.2%)

In the simultaneous-firing system,
When Attacking or Defending: Fleet B wins about 61%, ties 8%, and loses 32% of the time.

And it looks like that may be it for conclusions. We know a bit more about what's going on that we did when we started, but I don't feel that we can answer the original question based on the somewhat murky results of one experiment.

I feel that the fleets should have been chosen better at the start... it's hard to say exactly how the change in system shifts the ideal balance between weapons, but it would appear that it shifts it towards defense. This might just be my bias, though, since I expected it to increase the value of defense. (Based on the reasoning the all-weapon ships are very bad at taking a punch and derive much of their current power from being able to take out half the enemy fleet before it fires).

If you can think of a good set of fleets to test against each other in the two systems, describe them in a comment and I'll run them through. Maybe with more/better data points we'll start to see a pattern.


As an aside, we expect certain things from a symmetric system, and we see them here. This serves as a convenient reality-check that the simulation is working as desired. First, when two identical fleets fight, the probability of victory should equal the probability of loss, and since Pr(victory) + Pr(tie) + Pr(loss) = 100%, then Pr(victory) + Pr(tie)/2 should = 50%. (41.78% + 17.40%/2 = 50.48%, and 47.66% + 3.60%/2 = 49.46%). Second, Pr(Attacker wins, X vs Y) should equal Pr(Attacker loses, Y vs X). So 32.06% should equal 100%-61.32%-7.66%=31.02%, and 61.32% should equal 100%-32.06%-7.90%=60.04. All in all, this checks out quite nicely. Also, the mean, median, and standard deviation values all behave as we would expect with the symmetry of simultaneous firing.
17,676 views 33 replies
Reply #26 Top
This is very interesting, and i especially like the graph provided with your post #16 experiment. It really helps to show where attack and defense start to even eachother out. At least in absolute victory tearms.

I agree with moral55 that the cost of victory is an important factor to look into. Another thing I would like to see is how 2 fleets with the same logistics, but different ship sizes, compare. Using the same tech level, I put together four fleets to try out against one another from a current saved game file. All fleets use 24 logistics.

Fleet 1:
8 small ships, each with 12 beam attack, 12 beam defense, and 10 hp.

Fleet 2:
8 small ships, each with 18 beam attack, 3 beam defense, and 10 hp.

Fleet 3:
3 huge ships, each with 24 beam attack, 24 beam defense, and 50 hp.

Fleet 4:
3 huge ships, each with 36 beam attack, 3 beam defense, and 50 hp.

I'd like to see how these ships compare in a simultanious firing solution. In the current system players tend to favor smaller weapon only ships, so that they can take out as many enemy ships as possible in that first strike. With the larger hulls you have a maximum of only 3 kills, where the smaller hulls you can get 8 kills, if your ships are strong enough.

My hypothesis is that we'll probably see a much larger advantage with the huge class hulls, even though the total fleet attack+defense is less. The technologies used are phasors, barriers II, and warp drive IV, along with quite a bit of miniaturization.
Reply #27 Top
Hey, that's a good one. I'll get right on it.
Reply #28 Top
Interesting. Thanks for running that.

I know the low level point defense isn't going to block 30 black hole missiles, but I thought it might give it a small chance of hanging in the fight, at least for one more firing pass.

At the high end weapons/defense, I knew I'd win most battles. I was just worried it would turn into a meat grinder because of how powerful their firepower is.
Reply #29 Top
Re: #26

Ship 1: Small hull, Warp Drive IV, 4 Phasors, 4 Barriers II, cost 473
Ship 2: Small hull, Warp Drive IV, 6 Phasors, 1 Barriers II, cost 373
Ship 3: Huge hull, Warp Drive IV, 8 Phasors, 8 Barriers II, cost 978
Ship 4: Huge hull, Warp Drive IV, 12 Phasors, 1 Barriers II, cost 718

Incidentally, there's something weird with these: at 155 miniaturization (all miniaturzation techs, two Shrinkers, and Yor racial bonus), I get a (used space / max space) for Ship 1 is 62/66; Ship 2, 65/66; Ship 3, 215/204; Ship 4, 205/204. So, either these configurations aren't possible in the game, something else is going on, or my program is off. Let's run 'em anyway and see what happens.

So our fleets are:
Fleet 1: 8 ships @ 10 hp, 12 beam attack, 12 beam defense (total cost 3784)
Fleet 2: 8 ships @ 10 hp, 18 beam attack, 3 beam defense (total cost 2984)
Fleet 3: 3 ships @ 50 hp, 24 beam attack, 24 beam defense (total cost 2934)
Fleet 4: 3 ships @ 50 hp, 36 beam attack, 3 beam defense (total cost 2154)

We run each ship attacking each ship with the sequential and then simultaneous model, for a total of 32 simulations (2000 iterations each). Three summary statistics (probability of attacker victory, median result, mean combat value) are computed for each simulation. In each of these tables, the cell at row i and column j represents a battle where Fleet i attacks Fleet j.

Table 1a. Probability of attacker victory (%), sequential

.......Fleet 1..Fleet 2..Fleet 3..Fleet 4
Fleet 1...69.8.....94.6......0.0.....59.8
Fleet 2...72.9.....95.3......1.7.....95.5
Fleet 3..100.0.....99.9.....58.0.....87.0
Fleet 4...95.1.....73.4.....41.6.....76.3


Table 1b. Median result (hitpoints), sequential

.......Fleet 1..Fleet 2..Fleet 3..Fleet 4
Fleet 1.....30.......50.....-109.......20
Fleet 2.....33.......56......-92.......50
Fleet 3....121......115.......24.......74
Fleet 4.....75.......52......-23.......62


Table 1c. Mean combat value (bc), sequential

.......Fleet 1..Fleet 2..Fleet 3..Fleet 4
Fleet 1....881.....1421....-2951.....-832
Fleet 2...1544.....1881....-1740......933
Fleet 3...3183.....2256......243......474
Fleet 4...2470.....1225......414......659


Table 2a. Probability of attacker victory + 0.5 * Probability of tie (%), simultaneous

.......Fleet 1..Fleet 2..Fleet 3..Fleet 4
Fleet 1...49.6.....73.1......0.1.....33.0
Fleet 2...30.1.....50.1......0.5.....77.7
Fleet 3..100.0.....99.5.....52.2.....75.6
Fleet 4...64.9.....19.1.....24.1.....51.2


Table 2b. Median result (hitpoints), simulaneous

.......Fleet 1..Fleet 2..Fleet 3..Fleet 4
Fleet 1.....-1.......20.....-109......-25
Fleet 2....-20........0......-96.......20
Fleet 3....109.......96........3.......50
Fleet 4.....22......-24......-50........0


Table 2c. Mean combat value (bc), simultaneous

.......Fleet 1..Fleet 2..Fleet 3..Fleet 4
Fleet 1....-16......-27....-2945....-1664
Fleet 2....110........3....-1811......-80
Fleet 3...2956.....1822.......51......-48
Fleet 4...1622.......30.......29.......28


(Ugh... I need to find a better way to format things like this.)

A quick note about median result and combat value. The median result (unit is hitpoints) can tell you how many ships you will finish with half of the time, because we know the hitpoints for the ships in the fleets (10 and 50, easy numbers). So we see that the median result when Fleet 3 attacks Fleet 2 is 96 hitpoints. Since this is a positive number, this means the attacker wins. The attacker, Fleet 3, has 3 ships at 50 hitpoints each. So a median result of 96 means that Fleet 3 will lose one of its huge ships a little more than half the time.

As for combat value, that's something new. It's calculated by viewing combat like this: Each side loses value according to how much damage its ships take and how much each ship is worth; by assuming that the game is zero-sum, a loss for one side is a gain for the other. Therefore, the expected "gain" in value for the attacker is the difference between the value lost by the defender and the value lost by the attacker. As far as the formula is concerned, partially damaged ships lose value according to the percentage of hitpoints lost, so a 500 cost, 20 max hitpoint ship that takes 4 points of damage will be valued at (16/20)*500 = 400 bc.

Here's a full example: If a fleet of 2 ships (each 10 hitpoints, 200 cost) fights a fleet of 3 ships (each 10 hitpoints, 100 cost) and the result is 3, then:
combat value = net gain for the attacker
combat value = loss for the defender - loss for the attacker
combat value = (100 + 100 + 100) - (200 + (7/10)*200)
combat value = 300 - 340 = -40
So the attacker won the battle, but lost more in value as a result of the combat. Note that for a given pair of fleets, the maximum combat value is the total cost of the defending fleet, and the minimum combat value is -1 times the total cost of the attacking fleet.

I don't have time to interpret the results right now, but they look pretty good. The choice of fleets has produced some interesting behavior. There are things like in Table 2a, we have a rock-paper-scissors dynamic going on with Fleet 1 > Fleet 2 > Fleet 4 > Fleet 1. Defense seems to be paying off for Fleet 3, that's for sure, although remember from the top of the post that Fleet 3 might be using more space than it has.

Ok, interpret away. What do you see in the data?
Reply #30 Top
I can access the forum again! Yay me! And woe to those who have to read my posts.

The second experiment as well as your last one seem to back up my doubts about the use of defences: as HP decreases compared to the potence of the equipment, fluke rolls become more important and attack profits from this. There also seems to be some kind of critical cut-off point where a ship becomes virtually untouchable. If a player can construct these ships, their cost is practically a detail. Fleet 3 for example has a lot of HP per ship and a solid defence . A bad roll can be accomodated without the loss of a vessel. This normalizes results greatly and means start making sense.

The fleets do suffer from some imbalances, however, with Fleet 4 being far cheaper than the others. It does manage to score quite a positive combat value meaning that, despite the lower investment, it's likely to cause more 'manufacturing damage'. Does this mean that, even while fleet 4 loses most fights, two empires with equal manufacturing would see the winner being the one that builds Fleet 4 and throws them in battle?

Also, the Combat Value seems to indicate that, although Fleet 1 fares rather well in one-off fights, it is actually losing in the greater scheme of things.

I've set up my own little (amateuristic) experiment to display the effect of fluke rolls. I calculated the odds of scoring a one-shot-one-kill on a 10 HP fighter using different Attack/Defence values. Now, mathematical instinct says that when Attack and Defence are equal, damage should be limited, right?

Odds of scoring a killing shot (10 HP or more):

10 Attack/10 Defence: 1%
20 Attack/20 Defence: 16.5%
30 Attack/30 Defence: 25.6667%
40 Attack/40 Defence: 31%
50 Attack/50 Defence: 34.4%

With attack and defence balanced, the increase in percentage is the result of variance entering the calculations (without having to compute it).

This experiment shows that in mid- to late-game phases, ships become more fragile, regardless of defence. Obviously, the survival rate of an undefended ship is far lower. Otherwise, defences should have a negative effect on survival and that would most certainly be seen as a bug.

As a conclusion I find that Veblen's experiments show that:

- The ratio of defender-HP/attacker-Offence is an important factor in determining the usefulness of Defences. A higher ratio means more use for shields/armour/point defence.

- Strategies using cheap fleets but oriented to the offence may pay off in the long run if you can keep the pressure up and organize your military accordingly. This may be hard to do on larger maps.
Reply #31 Top
According to that run, in the simultaneous-firing system coming with 1.2, a fleet of 10 ships each A:(20-0-0) D:(0-0-0) will be evenly matched against a fleet of 10 ship each A:(10-0-0) D:(10-0-0). This doesn't look at cost, though; I expect the 20-attack ships would be cheaper.


Yes, there are two kinds of cost to talk about technological research cost and production cost .

Another problem is that depending on the tech levels, 20 attack ships might not be possible, compared to 10 attack, 10 defense ships because generally defenses are more space efficient.

Reply #32 Top
Veblen, how are you getting your data? I really can't see you doing all this on the simulator gizmo?
Reply #33 Top
I wrote my own simulator, which I talk about in some other threads:
one, two.

Although it's been improved a bit since the earlier posts. Now, I can type something like
ship.1 = buildShip("Medium", c("Warp Engine", "Doom Ray", "Doom Ray", "Kanvium"), mini.bonus=60)
ship.2 = buildShip("Small", c("Warp Engine", "Doom Ray"), mini.bonus=60)

fleet.1 = rbind(ship.1, ship.1, ship.2)
fleet.2 = rbind(ship.1, ship.2, ship.2, ship.2)

iteratons = 10000
results = simulateCombat.simultaneous(iterations, fleet.1, fleet.2)

prob.vic.1 = sum(results>0)/iterations
prob.tie = sum(results==0)/iterations
prob.vic.2 =sum(results<0)/iterations

This is a simple example. Basically, my simulator consists of a few functions I've defined (simulateCombat, buildShip, combatValue, buildComponentMatrix). These functions aren't user-friendly, since you need to have some programming experience and to download the R gui to use them, but they're flexible and powerful--as long as you can design a good experiment to use them on.

Anyway, I'll probably come back to GC2 after 1.2 comes out... right now I'm back to poker for the most part. Honestly I've kinda given up on GC2, since I don't think they'll let users mod the AI or alter the game mechanics in any meaningful way.