Beam weapons?
by Wysardry · in Torque Game Engine · 08/15/2004 (10:05 am) · 18 replies
I was just wondering if it's possible to create "beam" weapons - such as lasers or phasers - using scripting alone.
I haven't explored the particle system too deeply yet, but from what I have read about it (in the 3DGPAI1 book), it doesn't seem as if it would produce the desired effect.
I haven't explored the particle system too deeply yet, but from what I have read about it (in the 3DGPAI1 book), it doesn't seem as if it would produce the desired effect.
About the author
#3
Knowing my luck, I'd change something and find out two days later that there's a simpler/easier way using scripting alone. If I didn't break something in the process.
I've saved that resource anyway though, so thanks for that.
08/15/2004 (2:53 pm)
I was kind of hoping to explore the limits of what can be done with TorqueScript a little further before modifying the engine code.Knowing my luck, I'd change something and find out two days later that there's a simpler/easier way using scripting alone. If I didn't break something in the process.
I've saved that resource anyway though, so thanks for that.
#4
www.gamebeavers.org
08/15/2004 (4:52 pm)
Er, its already added in to the Beaver Patrol alpha code. Just tweak your /player.none.cst file to have 8000 pts or so and you can get the laser beam weapon. We used that resource.www.gamebeavers.org
#5
08/16/2004 (12:54 am)
Wys - you can fake it with a model, as I mentioned. The "best" solution, though, is to do the projectile thing.
#6
Assuming the player doesn't try firing into the air that is.
08/16/2004 (2:37 am)
Modelling isn't my strong point, so maybe I have the wrong end of the stick here, but wouldn't that mean if the weapon was used outside the beam model would have a static width but could potentially be any length from a fraction of an inch to a mile or so?Assuming the player doesn't try firing into the air that is.
#7
08/16/2004 (8:50 am)
Yes... Use a StaticShape or something with a cylinder model and scale its length appropriately.
#8
08/16/2004 (10:00 am)
Once you've made it that far, it might be good to render the weapon directly in openGL, instead of using a model. That way, you can scale the UV coords appropriately and have a cool texture on the cylinder without having it stretched or squashed silly. Or you could just draw openGL lines with some chaos for lightning... many effects are possible. Then again, you don't want to break anything in engine code... so I guess this is for other people who will look at this post.
#9
After I've finished that, I'm going to start on an FPS using what I've learned and an existing (non TGE) game as a reference.
This will include a couple of features that aren't explained in the book, but are used in the reference game (such as beam weapons).
Once that's complete, I'm going to attempt an action CRPG, and then finally a full CRPG.
That final game is the reason I purchased a TGE license, and by the time I start creating it I hope to be confident and proficient enough to modify the source.
However, I'm probably at least six months away from that point, possibly even a year or more (depending on how much time I can devote to learning and using TGE).
08/17/2004 (3:57 am)
Like a lot of people here, I'm currently working my way through the code examples in the 3D Games Programming All In One book, after having read/skimmed through it quickly first.After I've finished that, I'm going to start on an FPS using what I've learned and an existing (non TGE) game as a reference.
This will include a couple of features that aren't explained in the book, but are used in the reference game (such as beam weapons).
Once that's complete, I'm going to attempt an action CRPG, and then finally a full CRPG.
That final game is the reason I purchased a TGE license, and by the time I start creating it I hope to be confident and proficient enough to modify the source.
However, I'm probably at least six months away from that point, possibly even a year or more (depending on how much time I can devote to learning and using TGE).
#10
08/17/2004 (4:15 am)
Plan B Games is actualy working on a beam weapon content pack. We have been using the current beam weapon resource (we have been for like a year actualy) and we have never been too impressed with it. It's awesome because its free and all, but it's kind of a hack job and a little buggy. For instance, you cant see the beam unless you shoot something far away. We've built a new beam weapon class which offers a more robust look with more features and customizable options then the resource one. We were planning on packaging it with a gun and selling it as a content pack for around $10, what do you guys think of that? Sound like a fair price? would many of you be interested in something like that? Oh yeah, we were also planning on supporting it with TSE too.
#11
Whether $10 is a fair price would depend on how much of an improvement it is compared with the free version. In my particular case, the gun model would be of limited use, as the beam would be used with a rod, staff or wand.
Whether I'd purchase it would depend on how closely it fitted my needs. I would need to see some screenshots and/or a short video of it being used first.
$10 may not be much, but if you purchase several products at that price which turn out to be of limited use, it soon mounts up.
08/17/2004 (5:10 am)
Hmm, without knowing more details, the answer to both your questions would have to be "It depends."Whether $10 is a fair price would depend on how much of an improvement it is compared with the free version. In my particular case, the gun model would be of limited use, as the beam would be used with a rod, staff or wand.
Whether I'd purchase it would depend on how closely it fitted my needs. I would need to see some screenshots and/or a short video of it being used first.
$10 may not be much, but if you purchase several products at that price which turn out to be of limited use, it soon mounts up.
#12
I have had trouble scaling static meshes dynamically in code. If I do it in the level editor it works. But setting the properties through script does not work. I know I'm missing something simple. Is there a setscale() function that I have not run accross?
For example modifying a datablock seen below:
Setting scale to
Scale = "0.5 0.5 0.5";
or
Setting scale to
Scale = "5 5 5";
does not seem to work either. Perhaps there is a difference between the projectile and explosion data blocks? If so I'm going to try and use your idea for the GB laser.
08/17/2004 (10:15 am)
Ben,I have had trouble scaling static meshes dynamically in code. If I do it in the level editor it works. But setting the properties through script does not work. I know I'm missing something simple. Is there a setscale() function that I have not run accross?
For example modifying a datablock seen below:
datablock ExplosionData(grenadeExplosion)
{
explosionShape = "~/data/shapes/weapons/explosions/disc_exp.dts";
playSpeed = 1.0;
Scale = "1 1 1";
lifeTimeMS = 1500;
faceViewer = true;
shakeCamera = true;
camShakeFreq = "10.0 11.0 10.0";
camShakeAmp = "1.0 1.0 1.0";
camShakeDuration = 0.5;
camShakeRadius = 20.0;
// Dynamic light
lightStartRadius = 6;
lightEndRadius = 3;
lightStartColor = "0.5 0.5 0";
lightEndColor = "0 0 0";
};Setting scale to
Scale = "0.5 0.5 0.5";
or
Setting scale to
Scale = "5 5 5";
does not seem to work either. Perhaps there is a difference between the projectile and explosion data blocks? If so I'm going to try and use your idea for the GB laser.
#13
I'm not in a place where I can look at the scaling thing, but you might consider using setScale() in the onAdd() if setting scale in the datblock is not working.
or even...
Although I'd check to see if the scale value in the DB isn't getting hosed up some how first.
-Ed
oops - typoed
08/17/2004 (10:41 am)
Britton,I'm not in a place where I can look at the scaling thing, but you might consider using setScale() in the onAdd() if setting scale in the datblock is not working.
function xyzData::onAdd( %DB , %Obj )
{
%Obj.setScale("0.25 0.25 0.25");
}or even...
function xyzData::onAdd( %DB , %Obj )
{
%Obj.setScale(%DB.scale);
}Although I'd check to see if the scale value in the DB isn't getting hosed up some how first.
-Ed
oops - typoed
#14
Yeah good idea I think for most of the objects placed in a level that should work. The problem is not so much the objects your place in the level, but objects created at run time. Like the projectile's explosion data object. You fire a gun the projectile pops out and it explodes showing an animated dts file. I dont think the on add function would apply here.
08/17/2004 (4:04 pm)
@Ed,Yeah good idea I think for most of the objects placed in a level that should work. The problem is not so much the objects your place in the level, but objects created at run time. Like the projectile's explosion data object. You fire a gun the projectile pops out and it explodes showing an animated dts file. I dont think the on add function would apply here.
#15
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6280
08/19/2004 (1:36 pm)
Hey guys, my latest plan might be of interest to all you beam junkies. It has info and a demo of our latest workhttp://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6280
#16
Projectiles might be able to be scaled in the datablock though I forgot the variable.
I recently made a beam weapon for Realm Wars (kind of out of theme) and i simply used a model of 3 planes intersecting in the middle and a texture w/ alpha with falloff towards the sides. Although the projectile fires like a normal projectile I did think about the alternate way of doing a raycast and then scaling the model to that length. (use a static shape for it and scale it AFTER you add it)
A problem with that idea is that the scaled "projectile" will fade in fog, so you might want to break it into smaller pieces depending on view distance of your map (but not too small so that you have so many that it lags when you create them...)
08/23/2004 (10:06 am)
I don't think its possible to scale explosions/images.Projectiles might be able to be scaled in the datablock though I forgot the variable.
I recently made a beam weapon for Realm Wars (kind of out of theme) and i simply used a model of 3 planes intersecting in the middle and a texture w/ alpha with falloff towards the sides. Although the projectile fires like a normal projectile I did think about the alternate way of doing a raycast and then scaling the model to that length. (use a static shape for it and scale it AFTER you add it)
A problem with that idea is that the scaled "projectile" will fade in fog, so you might want to break it into smaller pieces depending on view distance of your map (but not too small so that you have so many that it lags when you create them...)
#17
I was wondering if there were any plans to make beams the way they are done in the Freedom Force engine? I forget the name of that engine but I knew it well at some point. Irrational? Anyway, the way it *seems* to be done is that there is a flat 2D image that is rendered "billboard" style towards the user as the beam heads for its target. It has a head image and a source image and the midpoint both scales and travels, which overall produces a wonderful effect, if you are familiar with the game. Most of the art for it was amazing.
08/08/2006 (12:54 pm)
Would definitely fork $10 for a beam resource :)I was wondering if there were any plans to make beams the way they are done in the Freedom Force engine? I forget the name of that engine but I knew it well at some point. Irrational? Anyway, the way it *seems* to be done is that there is a flat 2D image that is rendered "billboard" style towards the user as the beam heads for its target. It has a head image and a source image and the midpoint both scales and travels, which overall produces a wonderful effect, if you are familiar with the game. Most of the art for it was amazing.
#18
08/08/2006 (1:03 pm)
There's a few working laser beam resources floating around that work pretty well, if you were interested.
Associate Kyle Carter
(Obviously, the best solution would be to add a BeamWeapon class in C++ and use that.)