Ship to ship combat probability calculator

Request for information

Hello, this is my first post, so please go easy on me

Due to the controversy surrounding attack and defense, I'm attempting to write a c++ program with the goal of ultimately figuring out a fleet's probability for victory (and probable hp of ships that survived). However this is somewhat of a big undertaking. I've made some progress, but ran into a wall due to a lack of solid information. So far I've done a damage probability calculator, given an attack value and a defense value (the defense is assumed to be ideal, ie shields against beam weapons). However, I've run into a wall for multiple weapon/armor ships. Does anyone have any idea how that is exactly calculated? Searching the forums, I found mostly confusion and a few speculative ideas. One of them is listed below:

"So, say a ship with 20 beam attack and 10 mass driver attack shoots at a ship with 12 shields, 8 armor, and 4 point defense. Roll 1 to 20 for beam damage. The defense against beams is 12 + sqrt(8+4). So roll 0 to 15 for beam defense (the sqrt rounds down). The difference between the attack and defense rolls is the damage. For mass driver attack, roll 1 to 10 for attack, roll 0 to 8+sqrt(12+4) = 12 for defense. Then add the damage done in the beam attack to the damage done in the mass driver attack, and that's the damage displayed in the combat viewer. "

I don't know if this is correct, or if indeed everything is one roll (and in such a case, how are non-congruent offenses and defenses calculated?)

I have, however, begun to progress into single ship vs ship combat survivability, assuming again only ideal defenses.
I will attempt to make the exe, source code, and mathematical anyalsis (ie how I determined the formulas for the probability) avaiable on a website soon.

Here's a few sample outputs from the damage probability part of my calculator:

maximum attack strenght: 3
maximum defense strength: 3

RESULTS:
Damage Probability Exact
0 62.5% 10/16
1 18.75% 3/16
2 12.5% 2/16
3 6.25% 1/16
notes: this shows that shields are usually above 50% effective, assuming the hp of the ships are considerably less than the attack (negating "lucky rolls")

maximum attack strenght: 2
maximum defense strength: 1

RESULTS:
Damage Probability Exact
0 50% 3/6
1 33.33% 2/6
2 16.67% 1/6
notes: again, shields are still effective, with relatively low numbers.

maximum attack strenght: 1
maximum defense strength: 3

RESULTS:
Damage Probability Exact
0 87.5% 7/8
1 12.5% 1/8
notes: outshielding can be effective, if you can afford it.

maximum attack strenght: 20
maximum defense strength: 20

RESULTS:
Damage Probability Exact
0 52.38% 231/441
1 4.535% 20/441
2 4.308% 19/441
3 4.082% 18/441
4 3.855% 17/441
5 3.628% 16/441
6 3.401% 15/441
7 3.175% 14/441
8 2.948% 13/441
9 2.721% 12/441
10 2.494% 11/441
11 2.268% 10/441
12 2.041% 9/441
13 1.814% 8/441
14 1.587% 7/441
15 1.361% 6/441
16 1.134% 5/441
17 0.907% 4/441
18 0.6803% 3/441
19 0.4535% 2/441
20 0.2268% 1/441
notes: if the defending ship is a small fighter with no bonuses (10hp), despite the 20 shields, it has a probability of being destroyed in one hit of about 15%. Not so hot, especially when considering that 20 shields on a fighter is not really realistic either.

If you think there is a problem with the calculator, please post a response highlighting the mistake my probability algorithm. Like I said earlier, I will attempt to place the formulas used, source code, and exe on a website in the near future, as well as work on the optimal ship-survivability part of the calculator. It will be hard to progress with non-optimal defenses unless I know exactly how each case works.
4,576 views 2 replies
Reply #1 Top
I think what you were saying for multiple weapons was right. That is: the first weapon fires and is defended against by all of the enemy defenses (or square root of defenses, where approporiate) and then the second weapon fires. This is why I think putting multiple weapon types on the same ship is not a good idea, since this lets the enemy ship defenses be used multiple times against the same attacker instead of only once.

I also checked a few of your results, and they looked right on, assuming attack and defense rolls are both 0-max instead of 1-max.

I'm curious as to what your process will be to actually figure out the final combat probability (being as I've tried unsuccessfully in the past to do it without just relying on actually running the combat in a program a large number of times and taking the average result). The problems were, you don't know how many times a ship has to actually hit for damage to destroy an opponent since the damage isn't constant (this rules out using a negative binomial distribution like the Civ4 combat odds use). Also, once you add defense in, damage probabilities are no longer centered around the mean, so it isn't normally distributed. I'm just hoping I'm missing something obvious here and that you've already figured it out