Open dusty22 opened 8 years ago
I think this is because of performance. Imagine each arc of lightning having to trace against every surface in sight..
Is there no such thing as an EFX clip brush shader... or a surface parm that would simply "clip" the EFX? And then perhaps play a separate decal EFX on the wall for "wall/surface splash"?
No
then by what mechanisms do blaster bolts terminate at walls, etc. and leave decal marks? Can't Force lightning be handled the same?
They're drastically different effect types. There's no specific clip brush for blasters, and the proposal wasn't about adding a new clip brush where lightning could only collide with certain surfaces.
Blaster projectiles don't need to perform any collision detection. They're attached to an entity ingame and rendered at that entity's position each frame.
When the entity collides with something, the server generates an event entity defining the material properties: EV_MISSILE_HIT
, EV_MISSILE_MISS
, EV_MISSILE_MISS_METAL
When the client receives this event entity, it spawns a new effect. Some of these effects have a decal stage for example.
Lightning would need to perform maybe a hundred traces for each source and respond to that collision. There is no code in place to determine what happens upon collision, so the EFX format would likely have to be extended.
It absolutely can be done, but I personally don't plan on investigating (with what little time I have) only to reach 10fps on a feature I'd see no use of.
So the game knows the power is going through a wall, but doesn't do anything for the visual effect.
The damage is not based on the visual effect at all. At force level 1 (and 2?) a single ray is cast from the player to their crosshair target. If it collided with anything before that, no damage is dealt. At force level 3, a ray is cast from the player to each target within a certain angle. If it collided with anything before that, no damage is dealt. The same approach can not be used for the visual effect.
hmm... is the lightning FX a particle FX, sprite or what?
As long as it's just a trace to the beam's line and not every little lightning segment (which will definitely absolutely destroy performance) I can't see why not.
A straight-line trace of each lightning segment from its origin to its end point could work. Better yet though, couldn't the lightning effect be bounded by some ray casts creating a 2d fan shape around the player to get an average distance the effect can travel before hitting a wall?
The problem is tracing is expensive. Ray casting is the same as tracing.
@xycaleth : Say there are 50 lightning bolts on screen in a given frame (which would be 2-3 force users doing 2-handed lightning 3 at the same time). Each one is given a straight line-trace from it's origin point to it's end point, not accounting for any zig-zags in the visual of the lightning bolt but literally just going in a straight-line. And then it checks if it crossed a wall for each 3 units of game distance.
How expensive might that be? 50 * 50 * (200 units range / 3 units) = ~50 * 50 * 65... okay that is pretty expensive. More than 125,000 calculations in a single frame...
Or alternatively, how about estimating? What if a sort of blocky fan-shape was projected outward for the player based on the range of the lightning attack area, and was contorted by any walls nearby? And each lightning bolt wouldn't be allowed to draw past the bounds of that fan?
Operating system and version: All.
Is this for single player or multiplayer? Both.
Description of the enhancement: The visual effects for both Force Lightning and Force Drain go through walls and map brushes. However, they do not do damage/work on targets through walls. So the game knows the power is going through a wall, but doesn't do anything for the visual effect.
What should happen instead? Have the visual effects of the "electricity" type in efx files observe wall hits like other particles.