Wednesday, September 07, 2011

Galaxy Legion: Damage Formula?

People on the message boards keep coming up with guesses as to what the damage formula is in Galaxy Legion. I care what the formula is because I want to be able to establish precisely what will happen when I add on specific amounts of extra attack. When, if ever, will it be better for leveling to spend my rank points on tactical officers instead of engineers, for example. Or exactly what impact switching to the Konqul or Drannik races will have.

The developer gave a hint early on that the formula wasn't just simple subtraction or anything and used a combination of a tanh function, a random factor, and the size of the ship being attacked. People have narrowed the likely formula down to the following:

dam = tanh(A*R/(5*D))*C

A = attacker's attack stat
R = some random factor
D = defender's defense stat
C = damage cap (2.5*rank for NPCs, MAX(decks/2, rank+19) for PCs)

It's not clear what the random factor is, or even where it should be in the formula. I've tracked 1180 shots against NPCs and it looks like R varies between .6 and 1.66 or so, with a single weird outlier at 2.1. Scan doesn't seem to impact the damage done to NPCs at all. It averages right around 1.01 and occurs more often around that point. Is is a sine wave? A normal distribution? I don't know!

What I care about most is how changing A changes the damage done. The random factor can be considered as a constant here since as far as I know it is fixed on any individual shot.

d/dA(dam) = d/dA(tanh(A*R/(5*D))*C) = C*R/(5*D)*sech^2(A*R/(5*D))

sech is a function that varies from 0 to 1. All of A, R, and D are positive so sech^2(A*R/5*D) is going to be strictly decreasing and is going to come awfully close to 0 when AR/5D gets into the 4-5 range.

As an example lets take a look at a typical NPC boss that seems to be cropping up a lot recently: lazuli fabrication plant. This guy has 2500 defense, a damage cap of 775, and 45000 health. 3 people can get rewards for him so I tend to do around 15000 damage to him. My buffed attack is 3678. Plugging this stuff into the formula above gets us:

d/dA(dam) = 775*R/(5*2500)*sech^2(3678*R/(5*2500))

Which for typical and extreme values of R gives us:

d/dA(dam){R=.6} = .036
d/dA(dam){R=1.01} = .057
d/dA(dam){R=1.66} = .082

dam{R=.6} = 135
dam{R=1.01} = 224
dam{R=1.66} = 351

To do my 15000 damage I need 67 'average' shots. Each shot costs 5 energy and I could, when I spend rank points, get 5 attack instead of that 5 energy. Adding 5 to my attack would increase my damage on every average shot by .285. So in order to break even on energy against this guy I would need to be taking average shots at him 786 times per level.

There are a few problems with that. For one, this boss is near optimal for adding attack, I think. He has a reasonably high defense and he has enough health that I'm less likely to get hurt by rounding issues. To explain what I mean about that, take a look at the flimsiest NPC that I can spawn, the sha'din charger. When I last attacked him (he levels as I do so things change a little) his stats were 1120 defense, 1400 health, damage cap of 815. My attack at the time was 4438. So for him...

d/dA(dam) = 815*R/(5*1120)*sech^2(4438*R/(5*1120))

Which for typical and extreme values of R gives us:

d/dA(dam){R=.6} = .070
d/dA(dam){R=1.01} = .082
d/dA(dam){R=1.66} = .061

dam{R=.6} = 361
dam{R=1.01} = 541
dam{R=1.66} = 706

I find it interesting that if I roll high on the random number roll here the impact of more attack is actually decreased. A high roll edges me closer and closer to the 4-5 range of X where sech^2x trends to 0, so even though I'm multiplying by a bigger external factor out front with the higher R it gets overshadowed by the much smaller sech^2 factor. Do note that I was Konqul at the time with a 20% bonus to my attack, and probably had used a limited attack buff as well.

I almost always killed these guys in 3 shots. On one occasion I did manage to kill one in 2 shots. But in general it feels like adding on an extra couple damage isn't going to be able to bring me down from 3 shots to 2 shots and therefore any actual 'gain' is completely wasted as overkill. I'd need to know the distribution of R to work out how many shots I could expect to save but I'm pretty confident it wouldn't ever overpower the impact of just having more energy to shoot with.

Of course I'm actually somewhere between these two extremes. I kill some chargers. I kill some boss refineries. If I was fighting exclusively bosses then going with more attack makes sense for now. But since I'm fighting a lot of lesser guys and spending an awful lot of energy on missions instead of fighting it makes sense to keep pounding away at engineers.

2 comments:

smallestLIGHT said...

Thx for another great blog, If I may I have a huge request. Please could you do a thorough examination on the absolute best use of the hyper-terra and dyson planet creations. I know data on these is abundant in the forum and such, but your data is the one i would trust.

Anonymous said...

I have enjoyed reading your blog. I'm at level 436 and have deliberately slowed down my leveling.
Regarding attack -- spending nearly a 4.5 billion credits per day to get 500 extra in attack isn't worth it. better to use the credits to get more artifact planets and use the rescued prisoner artifacts on Tactical Officers/Engineers. My stats unruffled are:
3207 / 3293
Attack: 4249
Defense: 4842
Scan: 5875
Cloak: 4149
Cargo: 7721 / 9430
Upkeep: 4.6B
97 occupied planets with about 10 I don't defend/cloak hoping someone will take them and another 40 that will not be missed. I will not occupy less than 2X mega now.