Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Potential bug with Entropy Amplifier visuals  (Read 493 times)

Nicke535

  • Commander
  • ***
  • Posts: 240
  • Degenerate Core
    • View Profile
Potential bug with Entropy Amplifier visuals
« on: February 01, 2021, 08:16:17 AM »

Hello there. While searching around for an issue with some of my modded visuals, I accidentally stumbled across a potential vanilla-side issue with how the Entropy Amplifier handles its jitter. To be more specific: the entropy amplifier uses this anonymous BaseEveryFrameCombatPlugin to make sure its damage buffs stay active even if the ship carrying the Entropy Amplifier gets shot down:

Code: java
if (Global.getCombatEngine().isPaused()) return;
if (targetData.target == Global.getCombatEngine().getPlayerShip()) {
    Global.getCombatEngine().maintainStatusForPlayerShip(KEY_TARGET,
            targetData.ship.getSystem().getSpecAPI().getIconSpriteName(),
            targetData.ship.getSystem().getDisplayName(),
            "" + (int)((targetData.currDamMult - 1f) * 100f) + "% more damage taken", true);
}

if (targetData.currDamMult <= 1f || !targetData.ship.isAlive()) {
    targetData.target.getMutableStats().getHullDamageTakenMult().unmodify(id);
    targetData.target.getMutableStats().getArmorDamageTakenMult().unmodify(id);
    targetData.target.getMutableStats().getShieldDamageTakenMult().unmodify(id);
    targetData.target.getMutableStats().getEmpDamageTakenMult().unmodify(id);
    Global.getCombatEngine().removePlugin(targetData.targetEffectPlugin);
} else {
    targetData.target.getMutableStats().getHullDamageTakenMult().modifyMult(id, targetData.currDamMult);
    targetData.target.getMutableStats().getArmorDamageTakenMult().modifyMult(id, targetData.currDamMult);
    targetData.target.getMutableStats().getShieldDamageTakenMult().modifyMult(id, targetData.currDamMult);
    targetData.target.getMutableStats().getEmpDamageTakenMult().modifyMult(id, targetData.currDamMult);
}

This is all fine and good, but the problem is that this does not include the target-side visual jitter graphics: those are handled slightly below that code, inside the main advance loop of the EntropyAmplifierStats file.

Under normal circumstances this doesn't cause any issues, but I've found two specific cases where this can cause bug-like visual behaviour:
  • When the ship carrying the Entropy Amplifier dies, but the debuff has yet to end (this creates a de-sync between the mechanical effects and the visuals)
  • When time-mult is involved, and high enough (This apparently causes a de-sync between the "application" and "consumption" of the jitter on a ship, causing a flicker-like effect). Hard to spot in vanilla due to time-mult increasing systems usually having their own visual jitter, but becomes clearer when adding time mult to other ships without jitter

This should be fixable by adjusting the anonymous everyframe script to also include desired jitter level and set the jitter at the same time as other debuffs and effects.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Potential bug with Entropy Amplifier visuals
« Reply #1 on: February 01, 2021, 10:03:53 AM »

Thanks for the report!

The way this works is the ship system is shut off when the source ship is destroyed, so the damage buff does *not* stay active after the ship is shot down. IIRC it's set up this way to ensure that there's no weird case (such as the source ship getting removed from the combat engine by code) where the damage modifier remains leftover indefinitely.
Logged

Nicke535

  • Commander
  • ***
  • Posts: 240
  • Degenerate Core
    • View Profile
Re: Potential bug with Entropy Amplifier visuals
« Reply #2 on: February 04, 2021, 02:22:00 AM »

Ah, makes sense!