aliens

Author Topic: [Documentation] UFO and Craft Shields  (Read 2150 times)

Online ohartenstein23

  • Commander
  • *****
  • Posts: 1828
  • Flamethrowers fry cyberdisk circuits
    • View Profile
[Documentation] UFO and Craft Shields
« on: November 21, 2016, 05:38:19 pm »
Based on a discussion on the Piratez Discord channel, I've coded a new feature for interceptions - rechargeable shields!  The changes include the ability to define shield levels for UFOs and player craft in the ruleset, set effectiveness of craft weapons against shields, new palette-effect GFX for the interception window, and shield percentage information in craft status windows.  This is built against OXCE+ 3.3.

Edit 161220 (especially for Meridian later  :) ) - I've re-staged the edits on top of OXCE+ 3.5, now into a single commit, found in this branch of my repository.  The executables below are out-of-date, and I don't feel like recompiling right now.

Edit 170130 This is now included in OXCE+, so the urls for my repositories will be deprecated as I clean up to make room for writing new code features.

The ruleset options are:
  • (craft/ufo stats) shieldCapacity: 0 - defines the number of shield points a craft has, similar to damageMax.  Defaults to 0.
  • (craft/ufo stats) shieldRecharge: 0 - defines the percent chance of recharging a point of shielding per game second during an interception.  Values under 100 are the percent chance, for over 100, every +100 means an automatic +1 to shields per GS.  Thus shieldRecharge: 250 means +2 shields/GS, with a 50% chance of +1 more.  Defaults to 0.
  • (craft/ufo stats) shieldRechargeInGeoscape: 0 - similar to shieldRecharge, but acts every 5 seconds in the Geoscape.  Giving it a value of -1 means instant recharge as soon as 5 seconds pass!  Defaults to 0.
  • (craft/ufo stats) shieldBleedThrough: 0 - defines the percent of damage that passes the shield when it goes down.  A value of 0 means that with even just 1 shield point, any single hit will be blocked, while 100 means 100% of the damage left after the shield blocks it will go on to damage the craft.  Defaults to 0.
  • (craft) shieldRechargedAtBase: 1000 - defines how many shield points are recharged at base per hour for player craft.  Recharge happens on the hour, whether or not the craft is damaged.  Defaults to 1000 (meant to be all shields require just an hour to recharge)
  • (craftWeapon) shieldDamageModifier: 100 - defines the percent of power that a weapon does to shields.  Default is 100.
The shieldCapacity, shieldRecharge, shieldRechargeInGeoscape, and shieldBleedThrough parameters can also be defined as a stat bonus by race for UFOs or put on craft weapons (to simulate adding shield generators).

Here's a link to a copy of the Windows and Ubuntu 14.04 executables I've compiled, with a mod and save to test out some of the new features.

Edit: Had to fix a bug with not having proper default color handling, added the commit for that and updating the testing package.

More Edit:  Here are the extra strings for this and my previous interception window tweaks, since those don't have their own thread:
Code: [Select]
extraStrings:
  - type: en-US
    strings:
# Interception window strings
      STR_UFO_HIT_NO_DAMAGE: "BOUNCED OFF THE HULL!"
      STR_UFO_HIT_GLANCING: "GLANCING HIT!"
      STR_UFO_SHIELD_HIT: "HIT THE SHIELDS!"
      STR_UFO_SHIELD_DOWN: "ENEMY SHIELDS DOWN!"
      STR_INTERCEPTOR_SHIELD_HIT: "OUR SHIELDS ARE HOLDING!"
# Craft info window strings
      STR_SHIELD: "SHIELD>{ALT}{0}"
« Last Edit: November 10, 2017, 03:57:07 pm by ohartenstein23 »

Offline Arthanor

  • Commander
  • *****
  • Posts: 2560
  • XCom Armoury Quartermaster
    • View Profile
Re: [EXE] UFO and Craft Shields
« Reply #1 on: November 21, 2016, 09:00:23 pm »
Cool stuff! The static damage reduction shields that were added to enemies have drastically changed the air combat, in a way that crippled my air force (made mostly of ships with heavy weapons with good total applied damage because of high number of shots).

Having the possibility to deplete shields instead of them just subtracting a number from hits would help a lot with that and returning some value to weapons like the beam laser which is fairly expensive to make and turns into something useless even against mid-level military shipping.

Would love to see lasers as the shield depleter weapons (bonus against shield) and missiles as the "crap against shield" one, to favour more dynamic combat with interceptors: First you use your light weapons with beams to blow up their shields and then you enable the missiles to breach the hull and crash them. Would also make crafts with heavy weapons useful again as a mean to charge in and deplete shields before the interceptors launch their missiles.

Online ohartenstein23

  • Commander
  • *****
  • Posts: 1828
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [EXE] UFO and Craft Shields
« Reply #2 on: November 21, 2016, 09:07:26 pm »
I'm sure Dioxine already has some ideas for which weapons are and aren't good against shields; he was the one who suggested the damage modifier in the discussion.  Even without the modifiers, the fast-firing weapons are better against shields, but more in the economical sense - why fire missiles against the shields when the damage is reduced by regeneration?  Or maybe pop a missile or two to quick nuke down the shield before it regenerates.

As for the heavy weapons, have you not yet found out about the joys of railguns and obliterator cannons?

Offline Arthanor

  • Commander
  • *****
  • Posts: 2560
  • XCom Armoury Quartermaster
    • View Profile
Re: [EXE] UFO and Craft Shields
« Reply #3 on: November 21, 2016, 09:30:02 pm »
I've got railguns, but when I designed my air force, beam lasers were better (lower damage, but if you do acc*#ofShots*damage, they come ahead of railguns due to much twice the accuracy and # of shots, plus they don't use ammo). That was before shields made them entirely useless against military targets, the only targets for my heavy crafts. So I'm stuck with an ill-equipped fleet of dragons and krakens. I'm currently considering moving to 1 dragon (with all the railguns I have) + 3 Brave Whalers to sink up to cruisers with a bunch of missiles.

As for obliterator cannons, I'd love to have some, but in all the years of my game I haven't seen a boomgun, so that part of the tree is locked away for me... I need to gather the courage to assault a merc base, I think.

Online ohartenstein23

  • Commander
  • *****
  • Posts: 1828
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [EXE] UFO and Craft Shields
« Reply #4 on: November 22, 2016, 08:08:37 pm »
Found an issue in my code, but I'm not sure how to fix it.  In DogfightState.cpp, I define two new colors for the range of colors in drawing the shields.  If there's no associated definition in the ruleset for the dogfight interface (e.g., when running this on the vanilla ruleset), I get a CTD when the program tries to search for them in the ruleset.  How do I check the ruleset (a RuleInterface class) for whether or not a certain YAML node is there?  There doesn't seem to be any handling in the RuleInterface class for an element that doesn't exist in the ruleset file.

Edit:  More specifically, the getElement() method of RuleInterface class is meant to get a certain part of the interface by a defined "id" node under the "elements" node of the ruleset file.  However, when searching for a id that is not contained in the ruleset, a fatal error occurs.  I tried to handle the error with a try-catch statement in DogfightState.cpp, but the crash still happens, and I don't see a simple way to check the ruleset to see whether or not the element id exists first before trying to load it using the methods already implemented.


More Edit: I just didn't know how to do error handling with getElement() properly, proper fix will be put on github and included in the package linked in the first post by tomorrow.
« Last Edit: November 22, 2016, 11:04:43 pm by ohartenstein23 »

Online ohartenstein23

  • Commander
  • *****
  • Posts: 1828
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [EXE] UFO and Craft Shields
« Reply #5 on: November 28, 2016, 08:15:27 pm »
Tried doing some of my workflow with git instead of just drag/drop files onto GitHub to make this stuff compatible with OXCE+ 3.5, here's a link to that commit, also included in my OP.

Offline RSSwizard

  • Colonel
  • ****
  • Posts: 439
    • View Profile
Re: [EXE] UFO and Craft Shields
« Reply #6 on: November 29, 2016, 01:13:05 am »
If I might suggest somehow changing the Shield Recharge rate so that it can be defined in units of time outside the interception combat?

Like for example setting it to 3600 seconds should make it extend to a full Hour even after leaving an air interception.

This way it works against sending in one fighter after another or going back to base to reload so you can go attack the same UFO again and chip it down some more.

Have to finish off a UFO in one fight, or at least follow it up very quickly because if you retreat their shields will restore

Likewise your own craft can benefit from the dynamic too... having lightweight shields so that you can soak up 30 or 50 damage per fight, retreat and patrol a little bit then go back into the fight with the shields restored.

I think this has a much better dynamic potential for air combats than simply adding another layer of damage reduction to an existing fight. It would allow more or less for UFOs to "Heal" after a fight if you dont really stick to it with them.

Half or more of a UFO's damage capacity could be in its shields. If you dont fight hard enough you may not even scratch their hull and they could survive multiple interceptions without any progress being made to bring them down at all.

Online ohartenstein23

  • Commander
  • *****
  • Posts: 1828
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [EXE] UFO and Craft Shields
« Reply #7 on: November 29, 2016, 01:49:39 am »
Sure, that sounds like a reasonable change, but it would have to be a separate ruleset parameter, since geoscape time has no meaning when a interception window is maximized.  I'll probably set the defaults such that player shields don't recharge (so you don't cheese air combat by waiting - waiting extra time is boring anyways) and that ufo shields have instant recharge (goal being to maximize difficulty, because hating on the player is X-Com).

Online ohartenstein23

  • Commander
  • *****
  • Posts: 1828
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [EXE] UFO and Craft Shields
« Reply #8 on: November 30, 2016, 05:39:37 pm »
Added geoscape recharge as a separate ruleset parameter, it acts just like the dogfight shield recharge, but in 5 second intervals to match how geoscape time advances.  Setting the parameter to -1 makes shield recharge instant as soon as geoscape time advances at all.  @RSSwizard: it doesn't go by percent of total shields, but by a fixed amount, defined by ufo.  This just matches how I implemented recharge for dogfights.

Also, added shields as extra damage capacity for UFOs doing a base attack run.  Make sure you build extra defenses!