beyond-all-reason / spring

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

[FR] CEG: boolean tag for trails to inherit projectile speed #1072

Open sprunk opened 12 months ago

sprunk commented 12 months ago

See description. A boolean trait that makes CEG trails inherit velocity from their parent projectile.

lhog commented 11 months ago

Can you link an example effect & unit that needs that?

sprunk commented 11 months ago

Prompted by Hornet on the BAR discord, perhaps he can give specific examples https://discord.com/channels/549281623154229250/692380056001052693/1173066490740736112

I haven't delved too deeply into it personally but I assume it would be useful for trails of projectiles than can have differing speed (high trajectory cannons that slow to near zero at peak; or missiles that start very slow but get acceleration; anything controlled by Lua). It would also be convenient if tweaking the speed of a weapon didn't require to tweak the CEG too.

TheSilverHornet commented 11 months ago

Essentially, anything nonlinear cannot have effects that keep up with it. If it's a straight line then [[dir]] and velocity can fake it, as long as you always update the effect in tandem, as Sprung said, and that also prevents effect reuse on anything non-identical.

My use case was reworking flame weapons, which I worked around with consistent speed, growing particles, and directional velocity in the end. It would be highly useful for giving say an antinuke (which both accelerates, and turns multiple times) a smoke trail that initially matches missile speed. That can then be tuned with airdrag, negative vertical gravity, a bit of directional jitter, semi random fadeout and particle growth to make a realistic trail that 'naturally dissipates'.

In that flame process I did find a huge bug with d which I need to document, thankyou for the reminder.