How Combat is Balanced

So part 2 of how combat generally works, I’m going to talk about balance and how combat effectiveness is calculated and works, note you’ll need to understand the concepts of Attack Points, Defence Points, and Effective Damage which were discussed in the Combat Changes post.

Before I begin, I’m gonna be throwing some details of the combat configuration in here, these numbers are subject to change, so don’t trust them too much!

So what should define how strong a ship is? The easiest, most obvious, and possibly most contentious, method is a Ship’s Asset Score, the cost of the resources to construct a ship. Big ships cost a lot so are more powerful, small ships cost a little so are weaker, and it’s a very relative scale. Obviously it’s not currently perfect, but it’s a solid foundation for things (Workers, Turns and ‘Difficulty’ costs aren’t taken into account directly, but that’s going to be tweaked later).

So how are these numbers used? The first stage of configuration is to set the AP and HP of a ship, so in the case of a fighter, it looks something like this (note, HP is multiplied by 1000, more on that later):

<Unit name="Fighter" attackPoints="24000" hitPoints="24000000" score="24000" />

Secondly, a target list is defined, which is a huge list containing all ships, their firing order, and the ‘effective’ damage value, so we’ll keep on the fighter trend, and look at fighter vs fighter…

<Target attacker="Fighter" target="Fighter" effectiveDamage="1000" />

So here’s where ‘Effective Damage’ is first seen, and configured. As mentioned in the previous post it defines how much damage a single AP will use against a target. Here’s where the multiplier on the HP mentioned earlier comes into effect, as it allows me to define the weighting up to three decimal places without having the headaches of floating point arithmetic. So, using the above configuration, in a 1v1 fight:

AP (24000) * ED (1000) = Damage caused (2400000)

This configuration would result in fighters killing other fighters at a 1:1 ratio. Tweaking the ED allows me to explicitly define the killing ratios based exclusively on the score of the units, in the ‘real world’ the ED of Fighters vs Fighters is 1400, meaning fighters kill fighters at a 1:1.4 ratio.

Moving onto a slightly more complex case, lets take a look at Fighters vs Bombers, bombers are defined thusly:

<Unit name="Bomber" attackPoints="72000" hitPoints="72000000" score="72000" />
<Target attacker="Fighter" target="Bomber" effectiveDamage="2540" />

The effective Damage of Fighters vs Bombers is quite high, as bombers are weak to fighters, however it’s not 1:2.54, as these ratios are score focused, and not explicit ratios, so running the numbers for the fighter…

AP (24000) * ED (2540) = Damage Caused (60,960,000). Remaining Bomber HP: 11,040,000

So in this instance, a single bomber would survive an attack from a single fighter due to the bomber having 3x the score, and the ED not being above 3000.

So onto the big question, how is ‘Effective Damage’ calculated? Firstly it should be noted that ED is the ‘non-disclosed’ magic number of combat, but in the background, I maintain a spreadsheet that looks something like this:

The important thing about this spreadsheet, and the associated code is that the total value of every row MUST equal 6000, if it doesn’t, it’s completely rejected and the game wont setup. Increasing the ED of Fighter vs Fighter to 1400 means I MUST reduce the relative effectiveness against other ships by 400, even if that simply involves dropping all other values by 80. This is designed to enforce balance, the stronger a ship is against another ship, the weaker it HAS to be against others. This results in Fighters being extremally weak against BTS for example, with an ED of only 170.

So that’s how general balancing of combat works inside DarkGalaxy, there will probably be a part three of this series as things move along, there are going to be more tweaks to how combat works now the new code has opened up a lot of possibilities, so watch this space :slight_smile:

1 Like

Something tells me that excel does not contain the correct numbers :yum:

Yes because it is in Sheets :wink:

You would be correct, real numbers are secrets :stuck_out_tongue:

Don’t worry, I’ll find out :smiling_imp:

1 Like

Thanks for the update Frosty and good job!

Looks like now there is some space in which there can be balance, and also the option to tweak it or change it around to keep the game fresh over many rounds.

I do keep wondering though why you dont just remove the zeroes from all the numbers, for legibilities sake, if nothing else :smiley:

No they are not.


As weird as the insane number of zeros are, the primary usage of them is to create fractions without actually using floating point numbers, 1.004:1 is better represented as 1004:1000. Computationally in computers floating point numbers have a high chance of rounding errors when doing floating point arithmetic, so the easiest way to solve that, is to remove fractions from the equation :slight_smile:

They’ve changed :stuck_out_tongue: