Aatu / FieryVoid

A browser game based on AOGwars
8 stars 12 forks source link

Ships try to intercept shots that has 0 or less hit change to begin with #38

Closed Aatu closed 9 years ago

Aatu commented 12 years ago

Fix it.

Zero1627 commented 12 years ago

I'd say ones that after interception have 100% or above to hit should not be intercepted too - unless it can change damage dealt (Pulse or Antimatter weapons, usually)

Aatu commented 12 years ago

True on 100%, but how do I decide the exceptions where it should be intercepted and how heavily I weight in in compared to other weapons?

Zero1627 commented 12 years ago

Would have to invent some weighting algorithm. It may not be perfect, of course, but so is life. I think reducing to-hit above 100% should be weighter lower than chance of actual interception of any incoming shot.

I assume there is some algorithm already. It can be supplemented by (if there remains unallocated interceptors after existing algorithm): take an incoming weapon for which reduced to hit is meaningful even above 100% (a flag with weapon would probably be best) and can be reduced most (interceptor degradation kicks in in some cases) and intercept it. If same reduction - go for lowest to-hit (usually best chance of actually achieving anything). Crude but should do.

Also, there's issue with intercept-capable weapons that don't fire every turn. I have no idea what to do about them - unless allow player to declare manually that they're in intercept mode, and otherwise not allocate them? (intercept mode cancelled after 1 turn automatically). There's not very many of them anyway (in official B5Wars at least).

Proposition of full interception algorithm (skip reading if it's unneded) :

I assume that procedure above , when combining weapons, counts current total intercept rating (2 ratings, rather: with degradation and not) and current number of weapons (needed for calculating degradation for additional weapon). In fact, if new weapon adds 0 to degraded rating, algorithm may seek ballistics only (for gunfire ther should be no change at this stage). I assume when calculating intercept effectiveness, already allocated interceptors are taken into account (example: 2 bolts incoming, to hit both 10. Interceptor MkII allocated first - let's say to first incoming, stopped potential is the same. Second such interceptor, under algorithm above, would allocate to 2nd shot - as allocating to first one would cause smaller reduction. 3rd Interceptor would again allocate to first. If, on the other hand, there was 3rd incoming shot, with weaker weapon - interceptor would allocate to it rather than one of earlier bolts only if 20% of its damage potential is greater than 15% of bolts' damage potential).

Of course this may be refined, but should work.

Aatu commented 12 years ago

Thanks, this makes sense. Some clarifications though:

Currently system just calculates average damage stopped. So if you reduce 10% hit change and damage is 100, you reduce 10 points of damage. This ensures that mag guns, plasma and such are high priority. Pulse weapons are also often intercepted, because their damage is (for HPC) 15-90... pretty damn high! With current weapons it has worked actually suprisingly well, but I am sure we need to refine it to take into account damage modes and other things.

All and all the algorithm to automate intercepting is one of the most hardest parts to code, but on the other hand it does not have to be 100% perfect. As long as there are no obvious loopholes, it should suffice.

Zero1627 commented 12 years ago

All and all the algorithm to automate intercepting is one of the most hardest parts to code, but on the other hand it does not have to be 100% perfect. As long as there are no obvious loopholes, it should suffice. - my thoughts exactly

I forgot that ballistics interception is done by player as firing orders - so that simplifies things somewhat (all relevant interception suffers degradation). Interception with weapons firing slower than 1/turn is rarely done, I doubt anyone would mind if they're left as You say (unless a race appears which has serious interception based on such weapons... hmm, actually such a race exists - Brakiri with overpowered Pulsars).

How do You count average damage stopped? Straight middle between minimum and maximum? (just curiosity - about any would work well enough, it doesn't have to count real average). Really all my algorithm adds to Yours is probably a way to grade interception over 100%, and perhaps some tweaks if You like what I said. As for refinement: I think getting perfect allocation is not necessary, if it works reasonably well it's enough. As for firing modes and weapon classes: yes, it would be nice if that was taken into account. But not a priority. It may be taken into account either by given order of resolving ties, or by simply multiplying damage weighted by multiplier dependent on class and mode (so more dangerous weapons are simply counted as doing more damage: eg. Plasma x1.1, Pulse x1.1, Raking x0.8 (cumulative, so Plasma Pulse weapon would have interception priority based on DMGx1.1x1.1)). Or both. (above values for multipliers are only examples, not well thought of).

What IS important (I think) is getting weapons that do no damage (or are much more dangerous than damage suggests) into abovementioned algorithm. Only thing I can think of right now is adding extra (hidden) weapon attribute containing "damage threat" (damage value that should be used by interception algorithm). But if such value is added, it can be simply filled for other weapons too and algorithm itself would be simple (just most "damage" intercepted, tie resolution method would be irrelevant, simply first incoming would do (as long as it takes into account degradation)).