Game Development Community

dev|Pro Game Development Curriculum

Storm Tanks: ShapeBaseImages Secondary Turrets

by Tim Dix (Raverix) · 09/02/2010 (9:31 pm) · 9 comments

tp.cantanogames.com/images/stdev/blogheader.jpg

In the last incarnation, I had used the turret resource originally developed by Paul Dana, with some custom modifications. I was about follow suit again and port the resouce to T3D, but then I recalled an issue I had with the original.

Old Method: Basically, I would spawn the tank, and spawn the secondary turrets, mount the secondary turrets, and then mount the images to the secondary turrets, then pass the trigger information from my tank, to the turrets. Between this and all the other net traffic, the client just had a bit of lag before getting the turret mount information, so the player would get control of the tank, and then see the turret mounted a tick or two later. There was also just a small bit of lag sometimes where the I didn’t get the turret’s update in time, so they were animated a bit off.

So, I started thinking if I could strip out some unneeded functionality and streamline the net code for the turrets. For my use, all I need is to have the secondary turrets to aim to the same place where the main turret is pointing. Once I realized this, I was golden. Why have an extra shape base derived turret for every single weapon?

New Method: Added two nodes to the weapon model itself, one for the turret rotation, and one for the weapon rotation. When the main turret moves, the code iterates through all the mounted images, finds the appropriate nodes, and rotates them to align with the main turret. This means I can cut out the turret code entirely, and only use the stock shape base image code for my weapons. Result?



  • For every secondary weapon, one less turret datablock for me to create, maintain, load or send to the client.
  • For every player spawn, three less objects to create, mount, and network the updates.
  • For every player in the game, three less objects to write/read packets
  • The turrets are always in perfect sync with the main weapon on both the server/client.
  • One less resource to port.
Me: 1
Code/Network Bloat: 0


And here’s what it looks like in game:

Note: The video recorded a little dark, I'm not sure why. You can see the way this map looks here: Storm Tanks Screen Shots

tp.cantanogames.com/blog/stdev/img/3/0.giftp.cantanogames.com/blog/stdev/img/3/1.giftp.cantanogames.com/blog/stdev/img/3/2.giftp.cantanogames.com/blog/stdev/img/3/3.giftp.cantanogames.com/blog/stdev/img/3/4.giftp.cantanogames.com/blog/stdev/img/3/5.giftp.cantanogames.com/blog/stdev/img/3/6.giftp.cantanogames.com/blog/stdev/img/3/7.giftp.cantanogames.com/blog/stdev/img/3/8.giftp.cantanogames.com/blog/stdev/img/3/9.giftp.cantanogames.com/blog/stdev/img/3/10.giftp.cantanogames.com/blog/stdev/img/3/11.giftp.cantanogames.com/blog/stdev/img/3/12.giftp.cantanogames.com/blog/stdev/img/3/13.giftp.cantanogames.com/blog/stdev/img/3/14.giftp.cantanogames.com/blog/stdev/img/3/15.giftp.cantanogames.com/blog/stdev/img/3/16.giftp.cantanogames.com/blog/stdev/img/3/17.giftp.cantanogames.com/blog/stdev/img/3/18.giftp.cantanogames.com/blog/stdev/img/3/19.giftp.cantanogames.com/blog/stdev/img/3/20.giftp.cantanogames.com/blog/stdev/img/3/21.giftp.cantanogames.com/blog/stdev/img/3/22.giftp.cantanogames.com/blog/stdev/img/3/23.giftp.cantanogames.com/blog/stdev/img/3/24.giftp.cantanogames.com/blog/stdev/img/3/25.giftp.cantanogames.com/blog/stdev/img/3/26.giftp.cantanogames.com/blog/stdev/img/3/27.giftp.cantanogames.com/blog/stdev/img/3/28.giftp.cantanogames.com/blog/stdev/img/3/29.giftp.cantanogames.com/blog/stdev/img/3/30.giftp.cantanogames.com/blog/stdev/img/3/31.giftp.cantanogames.com/blog/stdev/img/3/32.giftp.cantanogames.com/blog/stdev/img/3/33.giftp.cantanogames.com/blog/stdev/img/3/34.giftp.cantanogames.com/blog/stdev/img/3/35.giftp.cantanogames.com/blog/stdev/img/3/36.giftp.cantanogames.com/blog/stdev/img/3/37.giftp.cantanogames.com/blog/stdev/img/3/38.giftp.cantanogames.com/blog/stdev/img/3/39.giftp.cantanogames.com/counter.php?blog/4tp.cantanogames.com/images/stdev/blogfooter.jpg

#1
09/03/2010 (12:07 am)
It would seem that would work also for a walking 40-ton weapon of mechanized destruction easily. :)
#2
09/03/2010 (12:09 am)
Absolutely, this is similar in effect to the way Freelancer handled their weapons as well.
#3
09/03/2010 (1:05 am)
That is all rather cool. I'm mainly a foot-slogger but have a soft spot for armour ... which might be an oxymoron :S
#4
09/03/2010 (3:18 am)
Thats a great trick Tim... that level is looking really nice as well.
#5
09/03/2010 (3:45 am)
@Steve - Armor all the way, I'm constantly thinking back to my many, many hours of Mech Warrior.

@Tom - Thanks! GeoControl2 did most of the work, but you can see why I wanted my side projection terrain so badly :)
#6
09/03/2010 (4:56 am)
Awesome work! And great explanation -- gives me a few ideas :)
#7
09/03/2010 (8:11 am)
That looks like so much fun, who doesn't love tanks bristling with guns :)
#8
09/03/2010 (12:22 pm)
Someone asked: "Is there room for any more guns?"
The answer, as always: "Yes." :)
#9
09/04/2010 (11:21 am)
this looks cool, good work you did :)