Inside3D!
     

Weird issues with LightningDamage()

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Orion



Joined: 12 Jan 2007
Posts: 413
Location: Brazil

PostPosted: Fri Feb 05, 2010 12:19 am    Post subject: Weird issues with LightningDamage() Reply with quote

Hi people, I always asked myself why the hell does the lightning gun checks for damageable entities in a different way not like the axe or the shotguns.

On an attempt to figure out what LightningDamage() does, I put a TE_LIGHTNING2 effect on each traceline() of that function. I have some screenshots.

The result was lightnings coming from the wall, or from yourself but pointing to the sides, or even backwards!

When I saw that phenomenon, I thought 'WTF?!? Was that Id's FAIL attempt on making the lightning gun a shoot-through weapon, or even a hitscan weapon that the lightning ricochets walls?'

For me the LG is meant to be a simple hitscan weapon, no shoot-throughs like q2 railgun, nor "reflecting" lightnings on walls.

I alwas replace that LightningDamage() line to this:

Code:

if (trace_ent.takedamage)
{
 particle (trace_endpos, '0 0 100', 225, 120);
 T_Damage (trace_ent, self, self, 30);
}


Real simple. No more than 5 lines of code. Razz

See the screenshots:
http://img231.imageshack.us/gal.php?g=wtf4.jpg

If you see the screenshots, you'll notice that any entity between these flying lightning beams *will* get damaged! I also get myself caught damaging 2 monsters at the same time. (w/o this modification).
_________________
There's no signature here. Stop looking for one.
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Fri Feb 05, 2010 12:44 am    Post subject: Reply with quote

due to trace_ent / other mixups in the quakeworld qc code, when you stand on the secret door on dm6 then shoot it, the door goes flying upwards! great fun... and fundamentally fubar.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Fri Feb 05, 2010 12:52 pm    Post subject: Reply with quote

This is both an issue with the lightning gun code and with the engine-side implementation of TE_LIGHTNING2.

What the lightning gun is actually doing, is shooting 2 beams parallel to the original beam. There is a page on SDA that documents where it goes wrong, but the fail starts when f is normalized but the value isn't put back into f.

TE_LIGHTNING2 ignores the start co-ordinates of the beam, and instead will use the origin of the entity specified as the start point of the beam. Which is why the beams look as if they fly at strange angles. Also, some engines will only display 1 beam per entity. So the correct way to make them all display is to have 2 additional entities for the 2 beams.

But yes, the easiest thing of all is to just remove the extra beams...
_________________
<ekiM> Son, you're writing data structures your CPU can't cache.
Back to top
View user's profile Send private message
Supa



Joined: 26 Oct 2004
Posts: 122

PostPosted: Fri Feb 05, 2010 3:51 pm    Post subject: Reply with quote

http://speeddemosarchive.com/quake/misc/lbug/

Code:

   f = p2 - p1;

   // Supa LG fix begin: kids, this is why you need to stay in school and pay attention in Maths class
   f = normalize (f);

   tmp = f_y;
   f_y = f_x;
   f_x = tmp * -1;
   
   f_z = 0;
   // Supa LG fix end
   
   f = f * 16;


HTH. HAND.
Back to top
View user's profile Send private message Send e-mail
c0burn



Joined: 05 Nov 2004
Posts: 158
Location: Liverpool, England

PostPosted: Fri Feb 05, 2010 4:19 pm    Post subject: Reply with quote

I never really understood what the function was trying to accomplish.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Wazat



Joined: 15 Oct 2004
Posts: 732
Location: Middle 'o the desert, USA

PostPosted: Sat Feb 06, 2010 1:23 am    Post subject: Reply with quote

It's probably laden with vestigial code that was meant to go past walls/multiple targets/etc, but was never finished, or was cut back insufficiently at the last minute.

Quake is rich with such "features". Wink
_________________
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group