beyond-all-reason / spring

A powerful free cross-platform RTS game engine
https://beyond-all-reason.github.io/spring/
Other
199 stars 98 forks source link

Feature: shield CEG impact filter #1594

Open GoogleFrog opened 1 month ago

GoogleFrog commented 1 month ago

CEGS have the boolean flags air, unit, ground, water etc.. to let the ceg appear or not depending on what is at its spawn location. If the weapon that spawned the ceg hits a unit, and the ceg has unit=true, then the ceg is drawn.

I would like a shield flag, for cegs spawned by weapons that hit shields, because otherwise hitting a shield is indistinguishable from exploding mid-air. The flag would not have to do some expensive test for a nearby shield boundary, it would be fine if shield were only set for weapons that explode on shields, as that information is already known. I don't know exactly how flags like unit interact with underwater, but shield should probably have the same interactions as unit, since both unit and shield involve hitting a barrier in the world, rather than a terrain situation.

lhog commented 1 month ago

otherwise hitting a shield is indistinguishable from exploding mid-air

But shields are usually visible, aren't they? Why is it indistinguishable then?

sprunk commented 1 month ago

The CEG can't distinguish. For example consider ZK nuke with tags for subcomponents like

BIG_MUSHROOM = { -- successful hit
  unit   = true,
  ground = true,
  -- shield = true, -- doesn't exist
  air    = false,
  particles = blabla,
},
JUST_A_LOT_OF_FAILED_SMOKE = { -- intercepted mid-air by anti
  unit   = false,
  ground = false,
  -- shield = false, -- doesn't exist
  air    = true,
  particles = blabla,
}

Now when it hits a shield, the CEG thinks it exploded mid-air and uses the failed "intercepted by anti" smoke instead of a proper mushroom cloud even though it's a successful hit.