Game Development Community

GG Guys need your help :)

by Justin DuJardin · in Torque Game Engine · 04/03/2002 (1:40 pm) · 1 replies

Ok, i was looking through weapon projectiles in the T2 scripts, noticed that the laser rifle's beam was hardcoded into the engine.. I was wondering if you could give me some incite as to how it was accomplished, i'm trying to duplicate it for our legends project. Thanks a bunch in advance guys :)

Below is a bit of the T2 script for the beam to refresh your memories :)

datablock SniperProjectileData(BasicSniperShot)
{
directDamage = 0.4;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.0;
velInheritFactor = 1.0;
sound = SniperRifleProjectileSound;
explosion = "SniperExplosion";
splash = SniperSplash;
directDamageType = $DamageType::Laser;

maxRifleRange = 1000;
rifleHeadMultiplier = 1.3;
beamColor = "1 0.1 0.1";
fadeTime = 1.0;

startBeamWidth = 0.145;
endBeamWidth = 0.25;
pulseBeamWidth = 0.5;
beamFlareAngle = 3.0;
minFlareSize = 0.0;
maxFlareSize = 400.0;
pulseSpeed = 6.0;
pulseLength = 0.150;

lightRadius = 1.0;
lightColor = "0.3 0.0 0.0";

textureName[0] = "special/flare";
textureName[1] = "special/nonlingradient";
textureName[2] = "special/laserrip01";
textureName[3] = "special/laserrip02";
textureName[4] = "special/laserrip03";
textureName[5] = "special/laserrip04";
textureName[6] = "special/laserrip05";
textureName[7] = "special/laserrip06";
textureName[8] = "special/laserrip07";
textureName[9] = "special/laserrip08";
textureName[10] = "special/laserrip09";
textureName[11] = "special/sniper00";

};

#1
04/03/2002 (1:53 pm)
The beam weapon in T1 & T2 was a special projectile. I believe it was a normal ghosted object which when created (or fired) on the server, stored off the original firing source object/item and end point. It then ghosted source object id, item index # and end point to all clients. If the source object didn't exists on the client, it would sent a start point. The object would hang around for a few seconds, then delete itself.

Another way of doing it would be to generate events instead of ghosting a projectile... In this case the beam projectile is not ghosted, but simply blasts out events to all "visible" clients. The event contructs an the beam projectile image on the clients which delete's itself after a few seconds.