The value of defense

How the combat system works.

Some people seem to put a lot of stock into defense, but many don't like it. The problem as I see it is that there is some confusion about how the combat system works.....

ISSUE 1: Attacking Ship with single class weapon vs defending ship with correct single class defense.

Example: Attacking ship has Beam attack of 6, Defending ship has shield of 3

Question 1a: Is the attack roll from

i)0 to 6

or

ii) 1 to 6?

Question 2b Is the defense roll from

i)0 to 3

or

ii)1 to 3?

I assume the question to both is from 0 to max.

Issue 2 : Attacking ship with single class weapon vs defending ship with two different class defense.

Example : Attacking ship has Beam attack of 6, Defending ship has shield of 2 and armor of 4.

Question 2a: For the defense roll is it

i) 0 to (2 + root 4) = 0 to 4

or

ii) 0 to 2 PLUS 0 to root 4 = 0 to 2 PLUS 0 to 2.


Issue 3 : Attacking ship with multiple class weapon vs defending ship with two different class defense.

Example : Attacking ship has Beam attack of 6, Mass driver of 5. Defending ship has shield of 2 and armor of 4.

Question 3a) How is damage caculated ?

i) Beam damage roll is applied against full defense (both shield and armor) using calculations in issue 2. Next Mass driver roll is applied against full defense(both shield and armor) using caculations in 2. Total damage is the sum of the two.

ii)Total attack is sumed up and applied against total defense.


Issue 4 : Attacking fleets.

Example : Attacking fleet consists of 2 ship, one has Beam attack of 6, Mass driver of 5. Another has Mass driver 3. Defending fleet consists of 2 ships. One has shield of 2 and armor of 4. The other has shield of 3.

My understanding is that the attacking ships choose a target priority based on a formula taking into account Attack and HP.

My question is, when attacking which of the following is true.

i) each attacking ship deals it's own attack indidivually against the target ship based on the calculations above.

ii) The attacking ships pool their attacks and are considered as one ship with a combined beam attack of 6, Mass driver of 8.


Thank you.

14,567 views 25 replies
Reply #1 Top
bump!!
Reply #2 Top
As far as I have been able to tell:

1a, 1b: Attack and defense rolls are 0 based.

Example : Attacking ship has Beam attack of 6, Defending ship has shield of 2 and armor of 4.

Again, I can't say anything with certainty, but to the best of my understanding:

matched defense = min(6, 2) + min(0, 4) + min(0, 0) = 2 + 0 + 0 = 2
mismatched defense = total defense - matched defense = (2 + 4 + 0) - 2 = 4
defense roll = (0 to matched defense) + integer(sqrt(0 to mistmatched defense))) = (0 to 2) + integer(sqrt(0 to 4))
attack roll = 0 to (beam + missile + massdriver)
damage = max(0, attack roll - defense roll)

I *think* that's how it works. So I'm picking neither 2a.i or 2a.ii, but instead: {0, 1, 2} + {0, 1, 1, 1, 2}, so like 2a.ii but with a different probability distribution for the mismatched defense.

Honestly, I don't have any way of testing which of the below alternatives is correct:
attack roll = 0 to (beam + missile + massdriver), or
attack roll = (0 to beam) + (0 to missile) + (0 to massdriver)

defense roll = (0 to matched defense) + integer(sqrt(0 to mismatched defense)), or
defense roll = (0 to matched defense) + (0 to integer(sqrt(mismatched defense))), or
defense roll = 0 to (matched defense + integer(sqrt(mismatched defense)))

Example : Attacking ship has Beam attack of 6, Mass driver of 5. Defending ship has shield of 2 and armor of 4.

So using the formulae above,
defense roll = 0 to 6
attack roll = 0 to 11

i) Beam damage roll is applied against full defense (both shield and armor) using calculations in issue 2. Next Mass driver roll is applied against full defense(both shield and armor) using caculations in 2. Total damage is the sum of the two.

I've seen explanations of the combat system along the lines of this, but I find it unlikely: It doesn't fit my observations of the game, doesn't make sense to me as a design decision. But the people who know aren't talking.

As for issue 4, ships in a fleet deal their damage individually. A ship with high shields will not protect other ships in the fleet, etc.

However, cheap fighters in a fleet with expensive battleships can protect the battleships from other battleships by aborbing the first volley. To the best of my knowledge, ships are targeted in descending order of (attack / (defense + hitpoints)), a formula given by Stardock somewhere and listed in the wiki page on fleet combat. As for the order in which they fire, I had *thought* it was descending order of attack, but this isn't the case in 1.1... I've seen my fighters fire before my battleships now, so maybe ships fire in the same order they're fired upon or something, not really sure at this point.

Hope this helps.
Reply #3 Top
Honestly, I don't have any way of testing which of the below alternatives is correct:
attack roll = 0 to (beam + missile + massdriver), or
attack roll = (0 to beam) + (0 to missile) + (0 to massdriver)

defense roll = (0 to matched defense) + integer(sqrt(0 to mismatched defense)), or
defense roll = (0 to matched defense) + (0 to integer(sqrt(mismatched defense))), or
defense roll = 0 to (matched defense + integer(sqrt(mismatched defense)))


LOL, you are right there are tons of possibilites there.

But all? of them will have different probability functions, so in theory if you could rerun the same battles say 10,000 times you could figure out which formula was most likely used...

They are all pretty close, because the roll is from 0 to max. If the roll is from 1 to max, they could be quite signifantly different.

Oh well I suppose it's good that the human players don't know exactly what is going under the hood, otherwise we will just exploit the system even more.
Reply #4 Top


But all? of them will have different probability functions, so in theory if you could rerun the same battles say 10,000 times you could figure out which formula was most likely used...


There's a fleet simulator that runs it at a standard 10,000 times lurking somewhere on these forums, I'll see if I can find it.

And defences are stacked together and calculated as the basic against the primary weapon they were designed for, and then the square root of the weapons they aren't. I believe the defences all work on one part of the weapon at a time, and then the damage is done as a whole.

So issue 3 is (0/6)-(1/2+1/2(square root of 4))+(0/5)-(1/4+root 2)=damage dealt (because it's all done by dice roll)

EDIT: Bugger, can't find it. However, there is Kyro's fleet sim Link which runs it once. So, you can just click a few thousand times

It's also fairly certain that the defender ship is about to die, unless they have an attack of at least 2. Then they might win. With an attack of 3 on top of the defences, they have a good chance.
Reply #5 Top
To Issue 4 ii)

The Attack power of a fleet is not pooled. During Combat each ship attacks seperatly, all attacks and defenses are counted seperatly. This can be observed during combat in the combat simulater. On the bottom of the screen you can see each ships attack (how much dammage the ship rolled), what the targets defenses rolled and how much dammage resulted from the attack.
Reply #6 Top
I have found that the size of the ship matters. On a very large ship you should try to focus on defense but on a small one offense.
Here is the rationale:
the bigger one has more hit points and if you can give it a good defense it can hang around for more rounds. I have used a single big ship with the wrong defense type to take out 11 small ships. The small ships had a defense between 4-11 and attack between 11-30. My big ship had attack 32 and armor 140. The square of 140 is over 12 so it still is ok. THe combat when basically like this:
my ship would fire and kill one of them. THen they would fire and sometimes do no damage or a point or 2. The big ship survived but was severly damaged (2 hit points or something). IF it had great offense yea it would have killed a ship or 2 but would have lost.

However, if the small shps are stacked with great offense with a couple different weapon types then they would do more damage and would win. You might lose a couple of ships but you would win.
Reply #7 Top
I concur on this. One reason I like to use fleets of small ships in great number is this very fact. They can take down an enemy, and then move on to the next one when my next ship fires. If they were all pooled, wouldn't the rest of the ships be shooting at a destroyed hull?
Reply #8 Top
Attack 32, armor 140??

Small ships with defense 4-11 and attack 11-30?

Are you a tech God?? Let me guess? Huge/Gigiantic maps? SERIOUSl tech in weapons and defenses?

Sigh does anyone EXCEPT me play with medium maps? I thought it was the default!

I've always played at medium maps and below, and for me i'm fighting wars with medium hull 100% filled with weapons, at *best* 16-20+ attacks. Once i hit 30+ attacks for large hulls, it's game over.

I once built a huge hull for fun.
Reply #9 Top
Based on my understanding of how combat works, i think Marcathonas has the right idea. Likewise, I agree with hockeyrama about defense being more valuable on bigger ships. Full defense value against the weapon that the defense counters (shields vs. lasers, etc) and square root of that value for everything else, rounded down. I'm also fairly sure that the minimum attack roll is 1 (not 0), since I've never had a ship do 0 damage to another ship that had no defenses. I'm also fairly sure that the minimum role for each type of a defense is 0, since I've done my maximum damage amount to ships with defenses and also had it done to my ships.

This also seems to suggest that mixing weapon types on a single ship is not the best idea, since each weapon type counts as a separate attack (even though it only shows up as one). In other words, I think the enemy's defense get a chance to defend against each weapon type. Likewise, this makes multiple defense types on a single ship a good idea, especially values which have a whole number for a square root (1, 4, 9, etc).
Reply #10 Top
I never build any defenses on my ships. Ever.

I tend to push engines and beam techs. When your ships move 12+ per turn, and theirs move 4.. it's much better to just load up the weapons and take out as much as possible (usually the whole fleet) on that initial attack.

Then again, I play gigantic maps.. and the AI seems to be designed for smaller maps (even in late game their ships move <10 per turn).

-Neb
Reply #11 Top
I'm pretty sure it's 0 to max. One of the developers mentioned it. When 0 damage is done or blocked it just isn;t shown.

In the simulator thread, someone remarked that the developers look at the equations and said it was all correct, so all we need to do is to look at how the simulator runs....
Reply #12 Top
I'm pretty sure it's 0 to max. One of the developers mentioned it. When 0 damage is done or blocked it just isn;t shown.

I believe the developers over many, many things but not my own eyes. I have never seen that happen and I'm quite sure that no-one else has either since we haven't had a single bug-report of 'Ships not always firing in combat'.
Besides, when all damage done is blocked, it is shown as 0 damage but this never ever happens if the enemy ship hasn't got any defence.
Attack is 1 to max. Defence is 0 to max.
Reply #13 Top
I used to be for pure weapons, especially beam weapons and engines, but recently I had a really rotten time with the Drengi. My fleets were larger and faster, and had better weapons. The Drengi had smaller fleets, fewer great weapons, and were slower. But what they did do was ambush me in a time of peace -- the attacker got to fire first, and my defense-free ships got slaughtered. The Drengi didn't wipe out my fleets by any stretch, but they did have more production than me, and I lost out because I couldn't re-produce the quality ships fast enough.

Now I want to try lots and lots of defenses, and see if that makes a difference.
Reply #14 Top
Ignuss is correct, I did trials and found that ships always have a 1-based atttack role and a 0-based defense role. An easy way to see this is in the battle fleet window. There is one line every time a ship fires. If you have 4 live ships, and the target has no defense --- you will always see four lines before the opponent fires, one for each ship, and you will never see a number below 1.

Try it yourself. It is not hard to see.

Reply #15 Top
I used to be for pure weapons, especially beam weapons and engines, but recently I had a really rotten time with the Drengi. My fleets were larger and faster, and had better weapons. The Drengi had smaller fleets, fewer great weapons, and were slower. But what they did do was ambush me in a time of peace -- the attacker got to fire first, and my defense-free ships got slaughtered. The Drengi didn't wipe out my fleets by any stretch, but they did have more production than me, and I lost out because I couldn't re-produce the quality ships fast enough.

Now I want to try lots and lots of defenses, and see if that makes a difference.


You probably play different styles of galazies than I do. I play gigantic galaxies with lesser amounts of planets and stars. That's probably why I've never seen an ambush. Ships loaded with weapons and engines are king in my games.

-Neb

Reply #16 Top
As for the pure weapons vs. heavy defense designs, I had an interesting chance to test how effective these were in a recent game. My main attack ship was a small size (10 hp) with 6 mass attack and 4 shield defense. The Torians, who I had just gone to war with, were fielding medium ships (16 hp) with 2 mass attack and 8 armor to counter me. Needless to say, my initial impression was "I'm screwed." After all, their defense was higher than my attack and they had more hit points. My defense (after taking the square root) was only equal to their attack.

I decide to figure out my chances in a one-on-one battle (no combat simulator, used good ol' probabilities instead). Math Warning!

I compared sums of possible damage values multiplied by their probabilities of occurring

Torian damage to my ship (roll combinations: 6 (1 to 2 attack * 0 to 2 defense)
DMG -- Possible ATT / DEF rolls -- Prob.
2 -- 2/0 -- 1/6
1 -- 1/0, 2/1 -- 2/6
0 -- 1/1, 1/2, 2/2 -- 3/6
So, the expected damage of the Torian ship to mine each round was 2*1/6 + 1*2/6 + 0*3/6 = ~0.667, so the ship would need to fire around 14.993 times to do the 10 damage needed to kill my ship.

My damage to the Torian ship (roll combinations: 54 (1 to 6 attack * 0 to 8 defense)
DMG -- Possible ATT / DEF rolls -- Prob.
6 -- 6/0 -- 1/54
5 -- 5/0, 6/1 -- 2/54
4 -- 4/0, 5/1, 6/2 -- 3/54
3 -- ... -- 4/54
2 -- ... -- 5/54
1 -- ... -- 6/54
0 -- ... -- 33/54
So the expected damage of my ship per round would be 6*1/54 + 5*2/54 + ... + 1*6/54 + 0*33/54, which would give me an expected damage of ~1.036 per round (so I would need to fire around 15.444 times to kill the Torian ship). If i started the combat, I would get the one extra attack, which meant my small ship should actually expect to win the majority of the time.

Someone feel free to point out any flaws in my reasoning here. But this seemed to pretty much match the results of my one-on-one engagements. Also, since my ships were smaller, I could fit more of them in a fleet which helped my chances even more. Needless to say, I won the war despite my initial worries .

Moral? Looks like it may not the best idea to sacrifice attack in order to raise defense too high.
Reply #17 Top
Er, sorry. I was hasty in my previous reply and got something wrong. I said attack and defense are both zero based, when I should have said that I think attack is 1 based and defense is 0 based.

Richrf wrote (#3):
But all? of them will have different probability functions, so in theory if you could rerun the same battles say 10,000 times you could figure out which formula was most likely used.

Yeah. There are three ways to figure out what's going on.
1) Stardock tells us (gee this would be nice).
2) Use a disassembler or similar low-level tool to look under the hood.
3) Collect a lot of data and perform a statistical analysis, which would end with you being able to say which candidate formula more closely matches the observations. The problem with the statistical approach is you would need really a heap of data, free from errors, to get any kind of precision. The best way to do this is to start a game in cheat mode, give yourself all techs (Ctrl-Shift-R), some money (Ctrl-M), design and buy a huge ship with the desired weapons and defense (more hitpoints mean more data per battle), take control of the AI player (oh yeah, tiny galaxy with 1 opponent) using Ctrl-Shift-Z, and design an identical ship. Poisition them near each other, save the game, and attack. Write down the data (DISCARDING all fatal shots, displayed as red; these are not valid as they are truncated to prevent HP from dropping below zero), load the game, and repeat. It's tedious... I've done it a couple of times, collecting a sample of about 200, to check the results of my simulator. It's not much fun.

The each-defense-counts-thrice model is different enough, however, that it should be able to prove or disprove it with a fairly small sample if the test is designed right.



Reply #18 Top
Um, there's also a problem right now with collecting data. Something's going on that is not explained by any of the above models. Here's some data from the following combat, performed in the game (v1.1):
Attacker: A = (5, 1, 3), D = (3, 3, 3)
Defender: A = (5, 1, 3), D = (3, 3, 3)

Here's the data as *displayed* in order from first shot to last shot:
(Side firing, damage)
A, 1
D, 2
A, 2
D, 0
A, 2
D, 4
A, 0
D, 3
A, 3
D, 0
A, 1
D, 1
A, 0
D, 0
A, 5 <--
A, 0 <--

D, 1
A, 0
D, 1
A, 0
D, 1
A, 2
D, 0
A, 2
D, 3
A, 1
D, 2
A, 0
D, 1
A, 0
D, 1
A, 0
D, 0
A, 5 <--
A, 1 <--

D, 2
A, 0
D, 1
A, 1
D, 2
A, 3
D, 0
A, 2
D, 0
A, 0
D, 0
A, 5 <--
A, 0 <--

D, 0
A, 5 <--
A, 5 <--

D, 0
A, 2
D, 0
A, 2
D, 4
A, 0
D, 0
A, 5 <--
A, 0 <--

D, 0
A, 5 <--
A, 0 <--

D, 1
A, 2
D, 2
A, 4
D, 0
A, 2
D, 1
A, 0
D, 0
A, 5 (fatal shot, discard)

Occasionally the attacker fires twice in a row; when this happens, the first of the shots is always exactly 5. I've noticed this even in cases where the attacker's total offense is less than 5 (like 1). It appears to be a glitch; it's been reported, but no response from SD. Something like this makes data collection very hard...
Reply #20 Top
From whether attacks are 0 to max or 1 to max...

I believe the developers over many, many things but not my own eyes. I have never seen that happen and I'm quite sure that no-one else has either since we haven't had a single bug-report of 'Ships not always firing in combat'.


And here shows examples of ships not firing in combat...

Occasionally the attacker fires twice in a row; when this happens, the first of the shots is always exactly 5. I've noticed this even in cases where the attacker's total offense is less than 5 (like 1). It appears to be a glitch; it's been reported, but no response from SD. Something like this makes data collection very hard
..
Reply #21 Top
Also it seems that there are 'criticals' which the lucky attribute affects, so there's something else going on..
Reply #22 Top
SOrry about the late reply. I build the huge ships with zero point armor and disruptors, 30 attack and 140 defence. It was later in the game in a medium map. Remember, later in a game it is not difficult to focus on a few techs and research them all the way through. I usually play diplomatic for most of the game. Then research alot and build huge ships. Then research the tech and after wiping out a weak race or two upgrade the old huge ships to the new powerful ships. If you build big defense ships they rarely die. Meaning even a few are deadly so no wasted production on replacement ships.
Reply #23 Top
Re: Richrf, reply #20:

The attacker-firing-twice-in-a-row behavior may or may not be related to a attempt to "hide" zero-value attack rolls. I've tried to figure out what's going on, and all I can say is whenever attacks are "skipped", it's only one side that skips (human as attacker, never AI as defender, I don't know about human as defender or AI as attacker) and a damage of exactly 5 is always involved in the first of the two consecutive shots. In short, it's buggy. I haven't observed any non-buggy skip mechanism at work. I haven't observed a wide enough range of situations to say much with certainty, though. It could have something to do with luck (now that I think about it, I believe I conducted most of these tests as default Terrans, who have the +25% to luck IIRC).
Reply #24 Top
Defence is 0 based ? Are you sure or are you guessing ?
Reply #25 Top
Defence is 0 based ? Are you sure or are you guessing ?

An educated guess. Otherwise how would a battle between a 1 attack ship and a 1 defense ship ever end?