Skip to content

fix balance issues associated with dinky shockwaves - #7833

Draft
Goober5000 wants to merge 6 commits into
scp-fs2open:masterfrom
Goober5000:fix/shockwaves
Draft

Goober5000 wants to merge 6 commits into
scp-fs2open:masterfrom
Goober5000:fix/shockwaves

Conversation

@Goober5000

@Goober5000 Goober5000 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #7830, #7831, and #7835; in draft until those are merged.

Background

Retail quartered the shockwave damage of a bomb that was shot down by another weapon, and multiplied it back by 4 against huge ships (maybe_shockwave_damage_adjust). Both halves date from the same Volition check-in, so small craft near an intercepted bomb took a quarter of the damage while capital ships took all of it.

The 2005 dinky shockwave system absorbed that rule, and three later changes moved it away from retail:

  1. Make Dinky Shockwaves not dinky by default. #2201 (fixing Dinky shockwaves aren't retail-compatible #774) changed the default dinky multiplier from 0.25 to 1.0. Dinky shockwaves aren't retail-compatible #774 argued that the retail divide-by-4 could never execute, because weapon_hit() is never called with a weapon as the other object. That is true, but the retail condition also tests WF_DESTROYED_BY_WEAPON, which collide_weapon_weapon sets before the bomb detonates through weapon_detonate(). Since 19.0.0, shot-down bombs have done full damage to small craft and, because the x4 is still there, four times the damage to huge ships.
  2. Since November 2005, the reduction also applied to area-effect weapons that have no shockwave (in retail FS2: Stiletto II, Infyrno, Infyrno D). Retail never reduced those.
  3. Since November 2016, bombs killed by beams have been flagged as destroyed by a weapon (needed for "don't spawn if shot"), which also made them use the dinky shockwave. Retail beams detonated bombs at full strength.

The multiplier was also baked into each weapon when the table was parsed, so it could not vary per mission, and the dinky copy went stale if a later TBM changed the weapon.

Design goals

  • An explicit setting always takes priority.
  • A mission balanced during the buggy years keeps the rules it was balanced under.
  • Outside that window, with nothing explicit, retail behavior applies.

What this PR does

Retail default. $Dinky Shockwave Default Multiplier: in game_settings now defaults to 0.25.

Per-mission multiplier. ai_profile_t gains dinky_shockwave_multiplier, initialized from the game_settings value. The default dinky damage is computed at detonation as the regular shockwave damage times the profile's multiplier.

New ai_profiles flag, $consistent dinky shockwaves:, enabled by default for mods targeting 27.0.

With the flag on:

  • Any shot-down weapon uses its dinky shockwave: area-effect weapons without a shockwave, weapons killed by beams, and weapons that have $Arm time/distance/radius.
  • Huge ships take the regular shockwave damage from a shot-down weapon, but only if the dinky damage was left at its default and the weapon had otherwise armed. This replaces the literal x4 and extends to the area-effect path.
  • Dinky damage that a table specifies explicitly is applied as written to every ship.
  • A weapon that failed to arm gives its dinky damage to every ship, huge or not.
  • Area effects use the dinky shockwave's damage type.

With the flag off, behavior is retail: area-effect weapons and beam kills are not reduced, and the x4 against huge ships is kept.

Multiples of regular damage, small craft / huge ships, for a weapon shot down after arming with default dinky damage and multiplier M:

Case Flag off Flag on
Shockwave weapon, shot by a weapon M / 4M M / 1
Area-effect weapon, shot by a weapon 1 / 1 M / 1
Killed by a beam 1 / 1 M / 1

Era window. When a mission is loaded in-game, mission_apply_era_adjustments() looks at its $Modified: date. A mission last saved while a buggy rule was in effect gets that rule back on its transient profile:

Rule Missions modified from
Shot-down area-effect weapons reduced by the multiplier 2005-11-08
Beam kills count as shot down (dinky, x4 on huge ships) 2016-11-28
Multiplier 1.0 2019-12-17

All three windows end at ERA_DINKY_END, which must be set to this PR's merge date. $Modified: was chosen over $Created: because the last save is the most likely balance pass. The two era rules are internal profile flags that are never parsed.

Opt-outs: a profile that writes $consistent dinky shockwaves: (either value) gets no era adjustment. A game_settings table that writes $Dinky Shockwave Default Multiplier: keeps its value; the other two rules still apply to in-window missions, since those mods balanced under them.

Fixes that apply regardless of the flag:

  • Dinky shockwave fields that a table does not specify are inherited from the regular shockwave after all tables are parsed, so a TBM that changes $Damage or the shockwave fields now carries through.
  • $Disarmed ImpactSnd: falls back to the regular impact sound when not specified. A shot-down bomb has been silent by default since 2005. An explicit -1 still means no sound.

Behavior changes for existing mods

  • Mods that set nothing, missions modified before 2005-11-08 or after the merge: retail arithmetic. For missions from the 1.0 era, nothing changes except that beam kills now get the x4 against huge ships they had in practice.
  • Missions modified 2005–2019 in mods that set nothing: the multiplier goes from 1.0 back to the 0.25 they were balanced under.
  • Mods targeting 27.0 (flag on): shot-down bombs with $Arm parameters become dinky; the x4 against huge ships becomes a restore to regular damage; explicit dinky damage loses its x4.
  • All mods: shot-down bombs play the regular impact sound unless a disarmed sound is given.

Implementation notes

  • weapon_armed() is built from two helpers, one for "shot down" and one for "failed to arm"; its callers and the Lua isArmed() are unchanged.
  • Beams set a new Destroyed_by_beam weapon flag alongside Destroyed_by_weapon, so the retail path can tell the two apart while "don't spawn if shot" and scoring keep working.
  • With the flag on, SW_WEAPON_KILL means "huge ships take the regular shockwave damage" and is only set when that applies.
  • The shockwave object still stores the dinky damage, so the subsystem damage pool in do_subobj_hit_stuff() is unaffected.
  • parse_shockwave_info() records which fields it parsed (SCI_* bits), and shockwave_create_info_inherit() fills in the rest in weapon_do_post_parse().
  • ai_profile_t::explicit_flags records which flags a table wrote, so the era code can tell "set to NO" from "not mentioned". mission_parse_date() reads the C-locale MM/DD/YY date that both editors write.

Testing

  • Unit tests: WeaponsParseTest.dinky_inheritance (a +nocreate entry changes a weapon's damage, outer radius and shockwave speed, and the dinky shockwave picks them up while keeping the one field it specified) and MissionParseTest.parse_date.
  • In-game on MediaVPs 4.7.x with a scripted mission and temporary damage logging. Ten cases against a fighter and an Orion: Cyclops and Stiletto II detonated normally, shot down, and killed by a beam; a bomb with $Arm time detonated before arming, shot down before arming, and shot down after; and a bomb with explicit dinky damage shot down. Run with the flag off and on at multipliers 1.0 and 0.25, then with a mission dated 1999 (retail arithmetic), a mission dated 2027 with nothing explicit (all three era rules), the same mission with an explicit 0.25 multiplier (multiplier kept, other two rules applied), and a regression pass on the flag-on mission. All 160 results matched the tables above.
  • The disarmed impact sound fallback was checked in-game.

🤖 Generated with Claude Code

Goober5000 and others added 6 commits October 6, 2026 19:37
…y index

The_mission.ai_profile becomes ai_profile_index, with a const ai_profile()
accessor.  This removes MAX_AI_PROFILES, Num_ai_profiles, and
AI_PROFILES_INDEX.  Also, parse_mission_info now stores the profile in the
mission being parsed rather than always in The_mission.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
set-friendly-damage-caps modified the shared table profile, so its changes
persisted into every later mission until the game was restarted.  It now
modifies a per-mission copy, created on demand by
mission_get_transient_ai_profile() and tracked by the runtime-only
Has_transient_ai_profile flag.  mission::Reset() removes the copy.

Inactive mission flags (Unused_1-5 and the new flag) are now cleared when
a mission is loaded and omitted when it is saved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The radius curve was always read from the weapon's regular shockwave, so
a curve specified under $Dinky shockwave: had no effect.  Store the curve
on the shockwave itself.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Retail quartered the shockwave of a bomb shot down by another weapon and
restored full damage against huge ships.  The dinky shockwave system
absorbed that rule, but later changes drifted from it: the default
multiplier became 1.0 (PR 2201), area-effect weapons without a shockwave
were reduced too, and beam kills began to count as shot down.

* Route the dinky multiplier through a new ai_profiles field,
  dinky_shockwave_multiplier, initialized from the game_settings value.
  The default dinky damage is now computed at detonation rather than
  baked into the weapon at parse time.
* Add the "$consistent dinky shockwaves:" ai_profiles flag, enabled for
  mods targeting 27.0.  With it, any shot-down weapon uses its dinky
  shockwave, including area-effect weapons, beam kills, and weapons with
  $Arm parameters.  Huge ships take the regular shockwave damage only
  when the dinky damage was not explicitly specified.  Area effects use
  the dinky damage type.
* Without the flag, behavior is retail: area-effect weapons and beam
  kills are not reduced, and the x4 against huge ships is kept.
* Dinky shockwave fields that a table does not specify are inherited
  from the regular shockwave after all tables are parsed, so later TBM
  changes carry through.
* The disarmed impact sound falls back to the regular impact sound
  unless one is specified.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The game_settings default for the dinky shockwave multiplier is now 0.25,
the retail value.  Missions last modified while the earlier rules were in
effect get those rules back through the transient AI profile:

* 2005-11-08 onward: shot-down weapons without a shockwave have their
  area damage reduced too (Era_reduce_shot_down_area_effects)
* 2016-11-28 onward: weapons destroyed by beams use the dinky shockwave
  (Era_beam_kills_count_as_shot_down)
* 2019-12-17 onward: the multiplier is 1.0, unless game_settings
  specifies one

A profile that specifies "$consistent dinky shockwaves:" opts out of all
of them.  The two era flags are internal and never parsed.  The window
ends at a placeholder date that must be set to the merge date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Goober5000 Goober5000 added this to the Release 27.0 milestone Oct 7, 2026
@Goober5000 Goober5000 added fix A fix for bugs, not-a-bugs, and/or regressions. refactor A cleanup/restructure of a feature for speed, simplicity, and/or maintainability Requested by Active Mod A feature request that has been requested by a mod that is actively in development. labels Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A fix for bugs, not-a-bugs, and/or regressions. refactor A cleanup/restructure of a feature for speed, simplicity, and/or maintainability Requested by Active Mod A feature request that has been requested by a mod that is actively in development.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant