fs2open.github.com icon indicating copy to clipboard operation
fs2open.github.com copied to clipboard

Nixprime's auto equalize shields

Open z64555 opened this issue 9 years ago • 9 comments

  • [ ] Verify singleplayer operation
  • [ ] Check with multiplayer
  • [ ] Check localization support and XSTR's
  • [ ] Should this be a default enabled or default disabled feature?

Original Post follows: Salvages PR #111, whose author hasn't updated in some time. PR #310 added needed functionality to enable controls within a .tbl/.tbm that are disabled by default (either through controlsconfigdefaults.tbl or hard-coded).

z64555 avatar Aug 25 '15 23:08 z64555

Some notes, concerns from the PR #111 conversation:

niffiwan: Should auto-equalize be controled by a mod_table setting? Should the default-to-off setting be controled by a mod_table setting?

Yes, it is controlled by controlsconfigdefaults.tbl, and the original commit has the control enabled by default. PR #310 added the functionality needed to enable default-disabled items, so this can be done.

MageKing17: there appears to be no way to interact with auto-equalization via script

He managed to add the control in lua.cpp, but I don't believe there's a way to activate the command yet.

MageKing17: It should just require not enabling the defaults by default and adding "+Enable" capability... is this the sort of thing that should wait for the antipodes merge?

Antipodes doesn't have this capability, as PR #310 was based on master. Going ahead with PR #319 won't affect this PR.

z64555 avatar Aug 26 '15 00:08 z64555

Ok, 2/3 concerns addressed, now all that's left is the scripting support

z64555 avatar Sep 14 '15 15:09 z64555

A new concern that cropped up regards multiplayer. If auto-equalize shields is active, then the server can handle the shield management like it does with AI. I am not sure at the moment how the additions behave, whether the hit player sends a packet with shield info to the server or the server already handles the equalization.

z64555 avatar Sep 14 '15 16:09 z64555

Ok, AI shield management, along with other AI controls, is handled by the host server and checked at a semi-regular frequency. AI adjust their shields by diverting power to the quadrant that was most recently hit. The ai code also suggest they balance their shields if not hit within a second, but I haven't observed them doing so in some past tests.

I'd like to try to use the AI's shield management routine instead of the new auto-equalize routine since it'll be a consistent behavior. Essentially, this would enable a portion of AI that will handle the player's shields for them. Could possibly add a flag to always equalize when hit to achieve this PR's original goals.

z64555 avatar Sep 24 '15 19:09 z64555

Actually I was under the impression that the AI had a difficulty multiplier for how long they wait to equalize shields, which on Very Easy scales down to 'never', and on very hard can be nearly immediate.

chief1983 avatar Sep 24 '15 20:09 chief1983

Yes, it actually does have a difficulty multiplier on there. Friendlies in single-player are hardcoded to stay at the "average" difficulty while hostiles vary.

z64555 avatar Sep 24 '15 20:09 z64555

Ok, I might be able to enable the AI shield management routines by turning on the Player_ai and setting it to a new AIM mode that would only activate the shield management. This would require moving things around a bit in ai_frame so as to not trigger things that would interfere with movement, etc.

I'll get that going in a separate PR, and maybe make a pair of test builds for folks to compare the two methods to see which one they like.

z64555 avatar Feb 19 '16 10:02 z64555

Rebased onto current master.

z64555 avatar Nov 27 '16 22:11 z64555

After a discussion with jg18 in the forums, I'm comfortable with my decision to get this merged in before I look for an AI alternative.

I'll need to do a bit of maintenance on it beforehand, however.

z64555 avatar Dec 30 '16 17:12 z64555