7even / endless-ships

Online reference to the Endless Sky game
http://endless-sky.7vn.io/
GNU General Public License v3.0
20 stars 10 forks source link

Add afterburner outfit table and antimissile "rate" column #14

Closed rezecib closed 1 year ago

rezecib commented 1 year ago

Afterburner is pretty self-explanatory, see preview: image

New anti-missile column and sorting (multiplies fire rate and antimissile strength, which captures the overall rate of shredding missiles): image

(this was split from https://github.com/7even/endless-ships/pull/12)

Zitchas commented 1 year ago

How useful would you find having these multiplied out? With the way missiles and anti-missiles work, I am a little concerned that this value might mislead people a bit.

For instance, the Pug Anti-missile has an "anti-missile rate" of 150, which is awesome against things like meteors; but its anti-missile value of 5 will be vastly less effective against heavy munitions than the Chameleon anti-missile's 16, despite this later having an "anti-missile rate" of only 64.

Zitchas commented 1 year ago

Just to elaborate a bit, here's the official documentation on how the system currently works.

"missile strength": how hard a projectile is for an anti-missile to destroy. If this is 0, the projectile cannot be destroyed by anti-missile.

The tool tip for missile strength: How resistant this missile is to anti-missile shots.

anti-missile: weapon's ability to shoot down missiles. The anti-missile succeeds if a random integer less than this value is greater than a random integer less than the missile's strength.

The tool tip for anti-missile: How powerful this anti-missile system's shots are. Some missiles are harder to destroy than others.

Purchasable or easily acquirable in numbers anti-missiles range from 5 to 42. Purchasable or easily acquirable in numbers missiles have a missile strength ranging from 3 to 200, although the vast majority are below 100. (there's one at 280 as well as one at 1, but neither can be acquired easily or in significant numbers)


edit: While I'm dubious about the value of the AM modification, the addition of the afterburner table would definitely be useful. As rezecib points out, we actually have a pretty decent selection of afterburners in-game now; and I as far as that goes I think there's a faction planned that has afterburners built into its engines, too.

rezecib commented 1 year ago

How useful would you find having these multiplied out? With the way missiles and anti-missiles work, I am a little concerned that this value might mislead people a bit.

For instance, the Pug Anti-missile has an "anti-missile rate" of 150, which is awesome against things like meteors; but its anti-missile value of 5 will be vastly less effective against heavy munitions than the Chameleon anti-missile's 16, despite this later having an "anti-missile rate" of only 64.

Ah, I was mistaken about the mechanic here. I had thought it was a simple missile hp and missile damage system where the antimissile would whittle missiles down, and the "rate" seemed to line up much better with the pricing/tech tiering.

But, looking into the code a bit more, does appear to be incorrect. Instead, it looks like it rolls a random number up to the antimissile strength, rolls similarly for missile strength, and only destroys the missile if the antimissile rolls higher. Which is much trickier to evaluate...

The expected chance for an antimissile of strength a to defeat a missile of strength m can be represented as the area of the table a x m where a is greater, this comes out to p = (T(min(m, a-1)) + m*max(0, a-m-1))/(a*m), where T(k) = (k+1)*(k/2) (kth triangular number). The expected number of shots ("trials before success") is simply 1/p, and the expected time to defeat a missile with fire rate r becomes 1/(p*r). Although probably the better metric is missiles destroyed per second, which inverts that for p*r.

I graphed these out to estimate how they scale the missiles destroyed per second metric:

So multiplying by rate seems completely correct here, the question is how to best account for the nonlinearity of the scaling of antimissile strength. I have two ideas for this:

  1. Pick a "canonical missile strength", and calculate the missile destruction rate for that missile strength.
  2. Given that a's scaling goes from a^1 to something like a^.5, pick some intermediary exponent and use that instead (such as a^.75).

For the most part, though, the antimissile rate I show in the table is actually a pretty good representation of the effectiveness:

image

The different tables are varying by the exponent on a when calculating the adjusted rate, (a^k) * r. the color coding is red for <= 0.5, because you're probably getting hit by that, and green for >= 3, because that missile is unlikely to touch you; shaded in between with pure white at 1, where you maybe deflect half of the missiles.

Exponents don't really seem different enough to be worth fiddling with, the exponent of 1 seems good enough. Sheragi anti-missile is a bit of an outlier in all of them because it's entirely outside of the a < m scaling range, though.

Link to that spreadsheet if you want to play with it yourself: https://docs.google.com/spreadsheets/d/1_Gmyy9Bu6WguuWL2u9Ekhn92b2ctjkgWzMYH97W4elU/edit?usp=sharing

Not sure if you can see the custom function attached to it, but it's here:

function TIMETOANTIMISSILE(a, r, m) {
  var t = Math.min(m, a-1)
  var p = ((t + 1)*(t/2) + m*Math.max(0, a - m - 1))/(a*m)
  return 1 / (p * r)
}
Zitchas commented 1 year ago

That looks about right. It basically boils down to "are you going up against missile swarms, or tough missiles?" and then correspondingly prioritizing either a fast fire rate or a strong antimissile, respectively. Which one is better overall (excluding the Drak and T3 ones which aren't easily obtainable) is thus a matter of where you happen to be spending your time.

7even commented 1 year ago

I'd suggest using some fixed missile strength for now (maybe some average value for novice players who are still wandering in the human space, @Zitchas what do you think?), and allow to change it in some select field above the table in the future. Trying to calculate anti-missile effectiveness against all existing missiles into one number doesn't seem like something that can be helpful to a common player - this calculated rate doesn't always correlate with turret's effectiveness against some given missile strength (especially for low missile strength).

Another option would be to visualise AM effectiveness with a graph with missile strength as X and "average missiles destroyed per second" as Y, where each line represents some particular anti-missile turret - but it's a bit harder to implement right now in endless-ships since it does not have any graphs yet.

These are the values for missile strength for all missiles that are in the game now:

Weapon name Missile strength
Shard Fabricator 1
Javelin Pod 3
Javelin Mini Pod 3
Meteor Missile Launcher 6
Meteor Missile Pod 6
Thunderhead Launcher 12
Sidewinder Missile Launcher 12
Sidewinder Missile Pod 12
Hai Tracker Pod 16
Heavy Rocket Launcher 16
Heavy Rocket Pod 16
Torpedo Launcher 30
Torpedo Pod 30
Cluster Mine Layer 35
Korath Minelayer 35
Pug Seeker 40
Typhoon Launcher 40
Typhoon Pod 40
Finisher Pod 50
Finisher Maegrolain 50
Firelight Missile Bank 60
Piercer Missile Launcher 73
Korath Piercer Launcher 73
EMP Torpedo Bay 80
Shunt-Strike Turret 80
Ka'het EMP Deployer 80
Teciimach Bay 95
Teciimach Pod 95
Firestorm Battery 115
Nuclear Missile 200
Ka'het Emergency Deployer 280
Zitchas commented 1 year ago

Having a fixed comparison in the AM table listing the statistical average "kills per second" vs a fixed missile strength could be useful for new players, so long as it is clearly indicated that it is merely against one example strength rather than a universal thing. Having a selector that allows one to pick the missile and see how well each AM performs against it would be awesome. I would probably suggest 16 as a typical value to use for a static table, since Heavy Rockets are the toughest of the fast & deadly human aresenal. (a meteor sneaking past is typically manageable. A heavy rocket tends to be a bit more problematic...) While the torpedoes are significantly tougher, they're also much slower and dodgeable.

It might be worth having the actual descriptions of the unique attributes under the table. For instance, under the missile table have

"missile strength": how hard a projectile is for an anti-missile to destroy. If this is 0, the projectile cannot be destroyed by anti-missile.

And then under the anti-missile table, have:

anti-missile: weapon's ability to shoot down missiles. The anti-missile succeeds if a random integer less than this value is greater than a random integer less than the missile's strength.

7even commented 1 year ago

Ok, so I've played a bit with this calculation and this is what I came up with.

Снимок экрана 2023-01-06 в 02 33 11

@rezecib this is not exactly your formula but something similar I derived myself trying to represent all possible combinations as a matrix; it yields the same results (I compared them with your spreadsheet) and it's a bit more understandable from my point of view..

rezecib commented 1 year ago

Awesome! It might be good to explain the implication of choosing 16, for example:

Against tougher missiles, outfits with higher antimissile ratings may be more effective than they appear here.

Also while delving into the math on this, it occurred to me that it'd be good to include missile strength in the secondary table as well. Although this is probably somewhat complicated by the multi-stage ones.

7even commented 1 year ago

Against tougher missiles, outfits with higher antimissile ratings may be more effective than they appear here.

I'm not sure this is the right wording - one might think that, say, Point Defence Turret will be more effective against torpedoes than it is against heavy missiles, which is incorrect. I'd rather say the effectiveness of some particular AM turret in relation to effectiveness of other AM turrets will be different against missiles with different strength - but if we include the description of "missile strength" and "anti-missile strength" @Zitchas proposed, this should become more obvious in my opinion.

it'd be good to include missile strength in the secondary table

Yep, I also noticed it's missing, I'll add it.

7even commented 1 year ago

I merged changes from all 3 pull requests as part of a separate branch I was working in.

Apart from pull requests and AM effectiveness we discussed above, I also added descriptions for missile strength, anti-missile strength and anti-missile effectiveness columns in outfit tables, added 6 new sections to outfits list (Reverse Thrusters, Solar Panels, Outfit Scanners, Cargo Scanners, Tactical Scanners, Fuel tanks) and updated the browser tab title to include ship/outfit title from the current page.

New version is already deployed to http://endless-sky.7vn.io/ - it corresponds to 0.9.16.1 version of the game. I also generated the site for current master version of the game but it introduced some new licenses that need to get some colors; thus I didn't update http://dev.endless-sky.7vn.io/ yet.

@rezecib @Zitchas thank you for your contribution.