beyond-all-reason / spring

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

Optimization for beamlaser and lightningcannon units #969

Open 6AKU66 opened 1 year ago

6AKU66 commented 1 year ago

Beamlaser and lightningcannon type of weapon is pretty heavy. Most obvious way for optimization for beamlaser and lightningcannon is apply damage only once in 2-3 ticks. While visually it's gonna be updated every tick.

This is how it's looks if i try do this via gamefiles. https://www.youtube.com/watch?v=eKO0IO8J8zw (Hit every 1 tick) https://www.youtube.com/watch?v=vhzk0N9XxKU (Hit every 3 tick) For (Hit every 3 tick) i applied this setting for armbanth unit: beamburst = true, beamdecay = 100, beamtime = 0.07, burst = 300, burstrate = 0.0999,

P.S I don't know if this possible to solve via gameside or it's need to be solved via engine.

sprunk commented 1 year ago

Most obvious way for optimization for beamlaser and lightningcannon is apply damage only once in 2-3 ticks.

Lightning cannon already applies its damage in a single tick and then leaves a graphical effect for N frames that does not do any damage or collision checks, just that BAR specifically configures it to instead spawn N lightnings instead with a lifetime of 1 frame. This doesn't necessarily mean it can be solved gameside because the lingering lightning is essentially static (ha) and thus somewhat ugly (compare with ZK which so far still uses the ugly lightning, cloakassault for a unit name example).

For beamlaser the "damage and raytrace each tick" behaviour is important because mechanics may depend on it:

6AKU66 commented 1 year ago

@sprunk Lightning cannon rays itself not staying though. https://youtu.be/OfLrNsLFJC8

sprunk commented 1 year ago

set beamTTL=3 or however much you need

6AKU66 commented 1 year ago

Ok, it's working. The only problem that it's looking too slo-mo'ish because lightning ray don't changing shape. https://youtu.be/1L3tdh_wEXo

sprunk commented 1 year ago

Yes, that's what I meant when I said it's static and ugly. I don't think this can be fixed gameside just via weapon def tags.

6AKU66 commented 1 year ago

And this is BeamLaser type of weapon (beamTTL=3). https://youtu.be/r_pnpdUQFgc