apetavern / grubs

A worms-inspired artillery game for s&box with randomly generated levels.
MIT License
34 stars 7 forks source link

Improve explosion radius #289

Closed DrewBritt closed 1 year ago

DrewBritt commented 1 year ago

Addresses #269.

ExplosionHelper.Explode() and ExplosiveGadgetComponent have had their float ExplosionRadius parameter/property split into float DestructionRadius and float DamageRadius. DestructionRadius functions the same as ExplosionRadius did, controlling the size of the explosion's terrain destruction, while DamageRadius controls the size of the damage check to surrounding entities. The DestructionRadius of all explosive gadgets has been left to be the same as their previous ExplosionRadius, but the DamageRadius for gadgets has been set anywhere from 10-25 units higher than its corresponding DestructionRadius.

To retain previous behavior, if a Grub is within the DestructionRadius of an explosion, they are guaranteed to be damaged, even if they're behind terrain (that is destroyed by the explosion). However, if a Grub is only within the DamageRadius (but outside the DestructionRadius), a line-of-sight trace is done to ensure the Grub should actually be damaged (shrapnel from the explosion, basically).

https://github.com/apetavern/sbox-grubs/assets/43252311/eab77a2c-ef3d-4426-a56c-9405b3dc9f89

ExplosionHelper.Explode() has also had its damage falloff tweaked, from a linear falloff to a parabolic curve (1 - x^2), shown below. This helps retain higher amounts of damage even when further away from the explosion, and makes explosive weapons feel more impactful overall. I planned for knockback force to also use this curve, but this led to much too powerful explosion knockbacks, so I reverted this to a linear falloff.

image