[Xpilot-hacks] laser hacks

Kimiko Koopman kimiko at xpilot.org
Mon May 5 10:54:55 ADT 2003


On Friday  2 May 2003, at 11:33, Kristian (ksoderbl at niksula.hut.fi) wrote:
>	I was wondering, why isn't the laser treated as a normal shot for
>to hit purposes ?

Because a laser pulse is not a point object. Almost all objects (except
ships) are treated like points with some diameter added. In order for a
laser pulse not to be a big moving ball (like an asteroid), it is stored
separately from other objects. The actual laser code checks collisions
by repeatedly generating tiny objects all along the length of the pulse.
I'm not sure the polygon code can handle shots of that speed and still
detect collisions correctly (the old code couldn't).

>This could allow removing of a lot of code
>from src/server/laser.c. Also then we could add options pulseSpeed,
>pulseLength (used for drawing purposes), pulseLife, maybe even bouncing
>laser pulses.

All those variables/constants are already in the code, you only need to
turn them into options. I wonder if it is useful to add all of them
though. Note that pulseLength, -Life and -Speed are related (it's a
bit odd to have a short pulse jump from frame to frame).

>I'm trying to implement this for polygon xpilot now.

Good luck.

More realistic would be to make pulses that exist only for one frame and
extend as far as possible (until they hit something not reflective). But
that might hold up the game too long on maps that are nearly empty.
Reflective walls would be cool though (laser fight in a hall of mirrors).

Kimiko



More information about the Xpilot-hacks mailing list