Fun with laser towers
by Geom · 10/06/2009 (5:36 pm) · 12 comments
Orcs vs. Martians now sports some nifty animated laser towers for the Martians.
Each tower consists of a stationary column and a rotating weapons platform. The weapons platform holds a side-mounted laser gun, and on the opposite side, some big ol' cylindrical capacitors to charge up the laser. The tower moves with 3 degrees of freedom: the weapons platform swivels around the z axis, the gun pitches up and down around the X axis, and when fired, the gun barrel recoils aong the Y axis.
It rotates and shoots lasers, what more could one want??
Animated .gif showing the firing / recoil animation:

Implementation
I ended up implementing this sweet little machine in two objects. The core tower is an RTSUnit-derived object. The weapons platform is a client-side TSStatic object. The platform isn't mounted to the tower, in the normal Torque sense. Since neither object ever actually "moves" in the (x,y) plane, I just place both objects in the world in the right spots, and that's good enough. Of course, the RTSUnit-derived class for the tower has a pointer to the platform object. (and handles network traffic for it) But they're not "mounted" in the Torque sense.
Rotation of the weapons platform is done by the conventional SceneObject rotation mechanisms. Rotation for the side-mounted gun, and recoiling of the barrel, are done by DTS animation.
I like the two-object approach (as opposed to using a single DTS for the whole tower) because I want to mix-and-match towers with weapon platforms. As you upgrade firepower, the weapon platform will change to have more impressive-looking guns. This way the artist just has to make several platform models, without worrying about the tower part. Well, I might support multiple core tower DTSs, too, but I don't have that implemented yet. The point is that the artist can make tower and platform models independently.
Models
So far I've made one tower and four weapon platform models: (1) one w/ a single gun barrel, (2) one with double gun barrels, (3) one with a jumbo barrel, and (4) one w/ triple gun barrels.


The last model, the triple-barreled job, also spins around like a gatling gun when fired, in addition to recoiling. W00t! Looks pretty cool.
I hope to share this game with the community soon! I'm eager to hear more feedback. The beta is coming; now I'm mostly trying to polish it and optimize it.
Each tower consists of a stationary column and a rotating weapons platform. The weapons platform holds a side-mounted laser gun, and on the opposite side, some big ol' cylindrical capacitors to charge up the laser. The tower moves with 3 degrees of freedom: the weapons platform swivels around the z axis, the gun pitches up and down around the X axis, and when fired, the gun barrel recoils aong the Y axis.
It rotates and shoots lasers, what more could one want??
Animated .gif showing the firing / recoil animation:

Implementation
I ended up implementing this sweet little machine in two objects. The core tower is an RTSUnit-derived object. The weapons platform is a client-side TSStatic object. The platform isn't mounted to the tower, in the normal Torque sense. Since neither object ever actually "moves" in the (x,y) plane, I just place both objects in the world in the right spots, and that's good enough. Of course, the RTSUnit-derived class for the tower has a pointer to the platform object. (and handles network traffic for it) But they're not "mounted" in the Torque sense.
Rotation of the weapons platform is done by the conventional SceneObject rotation mechanisms. Rotation for the side-mounted gun, and recoiling of the barrel, are done by DTS animation.
I like the two-object approach (as opposed to using a single DTS for the whole tower) because I want to mix-and-match towers with weapon platforms. As you upgrade firepower, the weapon platform will change to have more impressive-looking guns. This way the artist just has to make several platform models, without worrying about the tower part. Well, I might support multiple core tower DTSs, too, but I don't have that implemented yet. The point is that the artist can make tower and platform models independently.
Models
So far I've made one tower and four weapon platform models: (1) one w/ a single gun barrel, (2) one with double gun barrels, (3) one with a jumbo barrel, and (4) one w/ triple gun barrels.


The last model, the triple-barreled job, also spins around like a gatling gun when fired, in addition to recoiling. W00t! Looks pretty cool.
I hope to share this game with the community soon! I'm eager to hear more feedback. The beta is coming; now I'm mostly trying to polish it and optimize it.
#2
10/06/2009 (7:39 pm)
Thanks! Yeah, making the guns be distinguishable in-game has been a chore. They would look great in Blender, but in-game the gun barrel would turn out to be like 3 pixels big. Those are exactly the issues I've run into.
#3
10/06/2009 (7:49 pm)
Yup, I know how that goes. What I learned from making RTS games was that it's all about stage makeup, exaggerate in some way the elements that distinguish the personality of the subject
#4
I would agree with Todd about exaggerating certain aspects of the differing turrets/guns in order to make them more distinguishable from a distance.
Oh, and what about that alien model running along in the back -- looks like it's part of the turret's health bar? or was it just a coincidence that it lined up that way?
10/06/2009 (9:14 pm)
That's cool, I like it! :DI would agree with Todd about exaggerating certain aspects of the differing turrets/guns in order to make them more distinguishable from a distance.
Oh, and what about that alien model running along in the back -- looks like it's part of the turret's health bar? or was it just a coincidence that it lined up that way?
#5
10/06/2009 (9:29 pm)
Dude, I need one of them for the cats that haunt my back yard.
#7
10/06/2009 (10:19 pm)
very cool, im interesting more in how the turret works, because the current resources dont works all the times, you can share your code to check them (c++ and torquescript)?
#8
10/06/2009 (10:43 pm)
Very cool =)
#9
10/07/2009 (1:02 am)
Sweet... I Could Have Some Fun With Those... >:D
#10
Matt F - thanks; it's been a long time coming (3.5 years) but I think the game is looking pretty cool too. Once the game is in its last stage I plan to turn a "real" artist loose on it and hopefully it will look even cooler.
Matt Y - they are pretty fun :) When the beta's ready I'll blog about it; check it out!
10/07/2009 (6:01 am)
Javier - thanks. Unfortunately, it is quite difficult to share my game code, as I've modified many parts of Torque and my game code hooks into those parts. Also I have an entire class hierarchy derived from RTSUnit, and the Building class is about 3 levels deep in that hierarchy. So yeah, it's hard to pull out a feature like the tower/turret to share, without pulling everything with it.Matt F - thanks; it's been a long time coming (3.5 years) but I think the game is looking pretty cool too. Once the game is in its last stage I plan to turn a "real" artist loose on it and hopefully it will look even cooler.
Matt Y - they are pretty fun :) When the beta's ready I'll blog about it; check it out!
#11
What I liked the most, is the tree droping debris and receiving impact with movement, really cool!
10/07/2009 (7:18 pm)
Geom, as always, excellent work!What I liked the most, is the tree droping debris and receiving impact with movement, really cool!
#12
10/08/2009 (3:10 am)
Thanks Novack! There's lots of falling debris in the game when things get damaged. The game makes heavy use of particles. Buildings, if hit hard enough, also shake a bit.
Torque 3D Owner Todd Pickens
Since it's an RTS and the camera is pulled out a bit, you may want to do something to distinguish the differences between the versions of the laser a little more so that the player can recognize it at a glance.
Making the gun part bigger would probably do it, particularly if each has a distinct animation like the gatling one.