Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: z64555 on February 21, 2016, 03:05:42 am

Title: AI Shield Management
Post by: z64555 on February 21, 2016, 03:05:42 am
While poking around the shield management code for my flavor of auto shield management to compete with Nixprime's Auto Equalize Shields (https://github.com/scp-fs2open/fs2open.github.com/pull/324), I found that the players are penalized 2% per second while equalizing their shields. Shield quadrants are only equalized when they are not equal to each other, and thus the penalty only activates when energy is being transferred between quadrants.

Surprisingly, this is only applied to players, and not to any of the AI, which use a process similar to equalization called balancing. Shield balancing is augmented over time vs. Shield Equalize's instant effect.

Vote, Discuss, do what you will. :P
Title: Re: AI Shield Management
Post by: niffiwan on February 21, 2016, 03:16:16 am
Can you explain that "per second" thing some more? I would have thought that a shield equalisation would have occurred in a single frame only, which case the penalty would become ~0.034% (2*.017) per equalisation @ 60 fps, and thus be practically meaningless?
Title: Re: AI Shield Management
Post by: z64555 on February 21, 2016, 04:16:32 am
It really is that, 2% per second. Meaning, if you hold down the button to do the equalization, it'll dock 2% from the first instant and will apply the penalty every second the shields are equalized.

There's a safegaurd in place that prevents the player from draining their shields once they have been equalized.
Title: Re: AI Shield Management
Post by: niffiwan on February 21, 2016, 04:19:48 am
:wtf:

Sense this does not make! :p

I'm in favour of nuking that odd, counter-intuitive behaviour entirely.
Title: Re: AI Shield Management
Post by: FrikgFeek on February 21, 2016, 05:06:59 am
That's just weird as ****. Also, does the AI even equalise its shields that much? AFAIK they prefer to directly put power in a specific quadrant that's under attack rather than equalising. I didn't even know you can hold down the equalise shields button to keep them equalised though, I thought you just had to mash it like mad.
Title: Re: AI Shield Management
Post by: z64555 on February 21, 2016, 05:08:51 am
That's just weird as ****. Also, does the AI even equalise its shields that much? AFAIK they prefer to directly put power in a specific quadrant that's under attack rather than equalising.

If the AI has been attacked recently, it transfers energy to the shield quadrant that was hit.

If it hasn't been attacked, then it "balances" the shield. As I've said in the OP, balancing is the same as equalization, but done over time (the comments say about 10 seconds) instead of instantly.

Retail behavior has the AI balancing their shields continuously.
Title: Re: AI Shield Management
Post by: Spoon on February 21, 2016, 11:39:39 am
:wtf:

Sense this does not make! :p

I'm in favour of nuking that odd, counter-intuitive behaviour entirely.
+1 and
I didn't even know you can hold down the equalise shields button to keep them equalised though, I thought you just had to mash it like mad.
this too.
Title: Re: AI Shield Management
Post by: Droid803 on February 21, 2016, 12:25:46 pm
What you lose 2% every time your shields equalize?
Plzfix.
Title: Re: AI Shield Management
Post by: Phantom Hoover on February 21, 2016, 01:07:38 pm
It's worth removing just because the effect is so tiny nobody would ever notice it.
Title: Re: AI Shield Management
Post by: Spoon on February 21, 2016, 01:44:23 pm
It also means the player is constantly getting that minus 2% effect in WoD because shields are being auto equalized by script.
Title: Re: AI Shield Management
Post by: FrikgFeek on February 21, 2016, 01:48:19 pm
hah! I knew there was a good reason to disable that script :P
Title: Re: AI Shield Management
Post by: Spoon on February 21, 2016, 01:54:20 pm
Actually, Axem just told me that:
[20:51] <AxemP> also note, the wod script i dont think is affected by this
[20:52] <Spoon> why not?
[20:52] <AxemP> because it doesnt go through V's equalization function
[20:52] <AxemP> the script gets the total amount of shield points and divides them evenly across all quads

So I was wrong about that!
Title: Re: AI Shield Management
Post by: Galemp on February 22, 2016, 11:37:19 am
IMO we should keep the penalty. Otherwise there's no reason not to keep shields constantly equalized, which means there's no reason to have shield quadrants at all.
Title: Re: AI Shield Management
Post by: z64555 on February 22, 2016, 12:48:26 pm
IMO we should keep the penalty. Otherwise there's no reason not to keep shields constantly equalized, which means there's no reason to have shield quadrants at all.

I just want to point out that having constantly equal quadrants would not behave the same as mono-section shields. A quadrant can be depleted by a hit and damage will push through to the hull, whereas with a mono shield the hull will only be damaged if there is no shield energy.

This does, however, raise the question of why there is a penalty. Maybe to promote the use of manual shield transfers?
Title: Re: AI Shield Management
Post by: Phantom Hoover on February 22, 2016, 01:24:16 pm
IMO we should keep the penalty. Otherwise there's no reason not to keep shields constantly equalized, which means there's no reason to have shield quadrants at all.

A 2% per second penalty is so tiny you'd never notice it to adjust your behaviour. And anyway, I'm not convinced shield quadrants are that worthwhile to begin with.
Title: Re: AI Shield Management
Post by: FrikgFeek on February 22, 2016, 01:50:02 pm
Shield quadrants are completely instrumental to Freespace balance and most mods on the engine though. It's why a double treb/tornado shot can kill fighters even though it often doesn't do as much damage as their full shield+hull hp. Same for the PromS 6 bank shot that will break a single quadrant on Shivan ships even with their high shielding and instakill their squishy hull.
Title: Re: AI Shield Management
Post by: Familiar on February 24, 2016, 06:53:04 am
Have anybody thought that shield equalizing should not be instant?

As for now, it is no brainer - just equalize it, push the button and you're safe...

However it will destroy all the missions balance,  so...  blasphemy,  yeah
Title: Re: AI Shield Management
Post by: FrikgFeek on February 24, 2016, 08:05:58 am
It's only really a no-brainer when you're playing on lower difficulties or flying something with very heavy shields.
Most of the time having 4 weak shield quadrants that can't absorb a hit is far worse than having 1 shield quadrant that can actually survive a hit and 3 emtpy ones.
Title: Re: AI Shield Management
Post by: chief1983 on February 24, 2016, 09:35:54 am
Maybe we shouldn't talk about AI shield equalization so much as giving the AI the ability to direct shield energy to the quadrant a threat is coming from.  Imagine if bombers would intelligently throw shields to the rear when you drop in behind them, and dump to front as soon as they get in flak range.
Title: Re: AI Shield Management
Post by: FrikgFeek on February 24, 2016, 10:38:42 am
They kinda already do that, though only after they've recieved damage. The AI shield manage delay is only 0.1s on insane so it's pretty noticable. It's much higher on the lower difficulties by default(2.5 seconds on medium, an eternity when under fire) which makes it seem like the AI can't manage shields at all. Obviously you can just tweak the tables to make them better at shield management on all difficulties.

Not sure how much of a boost predictive shield management (before taking damage from that direction) would be or how difficult it would be to implement.