Game Development Community

Turrets?

by Adam · in Torque Game Engine · 02/27/2002 (8:32 am) · 71 replies

I haven't been able to find much in the way of turret info on the boards, and after a look through the engine and scripts, I see nothing related to turrets, in fact the inclusion of the turrets.cs file from Tribes 2 crashes the build. Is there any kind of core turret functionality in the engine at the moment?
#41
01/05/2003 (10:55 am)
Due to additional compication I belive that TurretObjectType Needs to be added in more area, do a search for VehicleObjectType and add the TurretObjectType in almost all the same place.


such place like in

main.cc 'bool initGame()'

MissionAreaEditor.cc 'onRender'

camera.cc

gameconnection.cc 'commanderscopeCallback'

GuiCrossHairHud.cc
GuiVehicleHealthBar.cc (If you are using it it can work for turrets too)
the reason I mention this is because I could not get my TurretObjectType to be able to be targeted with my heat seeking missile, after I added the type to the other location things started behaving propertly
#42
01/05/2003 (11:03 am)
Anthony do you have this fixed? and if so coulc you release the full code?
#43
01/05/2003 (11:06 am)
working on it even as we speak
#44
01/05/2003 (11:07 am)
Excellent thank all who are have worked on this.
#45
01/26/2003 (11:35 pm)
Has the code been fixed and finished yet? :)
#46
01/27/2003 (12:49 am)
Back a long time ago (last March I think it was) I heavily modified the player class to work as a Turret class. It was on an old head release of Torque. It worked fine, mounting barrels, player control, Activation/Deactivation/Destruction/Power states/animations. I also modified the old AI client class to auto-attach to the turret when one spawns. If it's given a target (should be done via script) it'll attempt firing at the target provided it's within range and it'll lead the target based on velocity. Also works with ballistic projectiles (like a mortar in Tribes 2). In fact it's pretty similar to Tribes 2 (I recommend using a T2 turret to test it out in fact).

It'll need moficiation to work with the newest head. The AI may no longer work due to the changes which have been made (I haven't been keeping up with them). It also needs some work on rotation interpolation for the networking. While it works fine networked, it looks a little blocky when it's being controlled.

Anyway if anyone's interested I can link the code up on my site.
#47
01/27/2003 (1:48 am)
Awesome everyone wants turrets on vehicles and in there games in one way or another. Cept for fantasy game projects... But every sci-fi project WANTS turrets REALLY bad. Kool thanks
#48
01/27/2003 (8:12 am)
Luigi I would love to see you turret code. Right now we to have made a turret class so far all is fine, except their is a minor twitch when moving the turret and mounting the turret on a vehicle causes some minor problems. We would love some input on the code if you have chance
#49
01/27/2003 (2:24 pm)
I wrote a turret class/script that works perfectly for what I'm trying to accomplish. It's not like a tank turret or anything...just like a base turret that fires at something if it's in range and unobstructed. We're making a Tribes-like game, so it's basically a mirror of the T2 spiderclamp turret except you can't control it, but you can deploy it on terrain.

The code is done, but the script still needs 2 things: proper aiming, and rotation of the turret on deploy so that it sits flat on what it's attached to.

It's basically a heavily modified staticShape class and modifications to the player class for stuff like deployment conditions.

Is this what people are looking for?
#50
01/27/2003 (3:23 pm)
Hi Anthony,

I've posted the source code and a brief description on my site. Click here for a direct link :)
#51
01/29/2003 (1:45 am)
Awesome, turrets are great for futuristic games.
#52
02/26/2003 (12:12 am)
does anyone has the image files of a turret?
#53
02/27/2003 (10:28 am)
Chris, I would like to take a look at this simple turret you created. Im sure other would as well. Could you share it?
#54
03/12/2003 (6:48 pm)
Has anyone actually managed to complete creating a turret? One that can rotate and shoot and be mounted on a vehicle.
#55
03/12/2003 (8:53 pm)
Believe it or not...yes.

I have been working on a Turret class for my own game as well as for games by Shinobi, vinci_smurf, and for Robert Brower. These turrets can be fixed on ground or mounted on a vehicle. A player can walk up to a turret and will mount it. The turret will run its "activate" animation and then the user will be controling it. The user hits jump to dismount. These turrets can also be controlled via AI. The turret methods are exposed to script.

I have been working on this on and off since begining of Jan 2003. I started with some code that vinci_smurf gave me and I also referenced the code by Luigi.

The stuttering problem with previous turret implementations had to do with client/server mismatch. Also some problems were caused by the required "elevate" and "turn" blend animations. This plus the fact that the Milkshape exporter does not allow BLEND animations motivated me to change the way the turrets work to not require the blend animations. Thanks to Clark F. and Joe M. from Brave Tree for some help and code snippits. They shared some code from Think Tanks that allows you to control animation nodes manually rather than with an animation sequence.

Here is where I am to-date on this project

1. Mountable by player - done
2. Fix stuttering - done
3. Remove blend anims - done
4. Create test turret in milkshape - done
5. Ability to mount on moving vehicle - done

6. C++ can drive via. pitch/yaw or moves - in-progress
7. Auto-aiming code in turtet class itself - to-be-done
8. Expose turret methods to script - to-be-done
9. Control from AI - might-do

10. Have AIPlayer control - NOT-ever-going-to-do-dont-need

What does this mean? This means that with the code as-is you can make:

1. static turrets players can walk up to and use
2. Tanks where one player drives and another shoots

Once I get #6 done you will be able to:

3. Make tanks where one player drives and shoots
4. Write your own AI code in C++ to control a turret.

Once I get #7 and #8 done you will be able to:

4. Make vehicles with mounted turrets that can auto-aim
5. Write your own AI code in script.

I may make a formal AITurret object simialr to what Luigi made but I am not sure any of us need that. I have not plans to extend the AIPlayer class so that an AIPlayer can walk up, mount, and use a turret like a player does...however once i get #6 done that will be an easy thing to do for anyone who wants to take it on.

When will I be done with this stuff? Hard to say, but I will be needing #6 at least and probably #7-#8 in the coming 4 weeks.
#56
03/12/2003 (9:13 pm)
Paul:
What you have done is exactly what I am trying to do for my project but am having difficulties. Will really appreciate it if u can share your resources. What i need is actually to be able to control a mounted turret , and the vehicle (one to drive the vehicle and another to control the turret at the same time) but I am having great difficulties to pass control to a turret and mount the turret. Also, I'm new to using Milkshape, so I can only create a simple image of a turret and export it into .dts file. Is that sufficient for use?
#57
03/15/2003 (7:57 pm)
I am also a Milkshape newbie. You must do more than just make the shape. You must create "joints" in milkshape. You will have to attach the points in your mesh to the joints. You will do this to define which part of the model turns when the turret turns and also which part elevates when you aim the gun. You must give the joints (in torque called nodes) specific names: codeTurret and codeWeapon to let the code know which joint is for turning the turret and which one is for elevating (aiming) the gun. I will have these details in a readme.txt when I am done with my stuff. I may not have the time to write up a full-up resource for this (see my note above about being greedy with my time) but I may coax one of the three people who will benefit from this code to do that work.
#58
03/31/2003 (7:56 am)
I have made excellent progress on Turrets and AI Turrets. Before it is useful for everyone else I need to add some more options...like min/max pitch and yaw to optionally limit turret rotations, etc. I will post a message here when I have something ready for sharing
#59
03/31/2003 (9:00 am)
Great to hear that. I'm sure the community will shower you with gifts when you share your work. :)
#60
04/02/2003 (1:20 pm)
You the funny man.

I have added all the needed options. I have made the files involved available to Robert Brower and some other Torque developers. Right now it's just a pile of source code. All the changes I have made are marked with comments, but the parts that are my game, working title Droids, and the parts that are Turrets/AITurrets are not that clear to see. Robert is going to help me turn it into a decent resource. Be fore-warned that there are a lot of files to change. Many of them are one-line changes where you put the TurretObjectType flag back into some collision mask at the top of a source file, but on top of that there is a lot of code to splice in.

If anyone is interested in getting access to this pile-of-changed-code, email me at paul@crimsongames.com and I will provide access to these files - but not support.