Game Development Community

T3D AI

by Justin P Greer · in Game Design and Creative Issues · 08/27/2010 (7:55 am) · 7 replies

Ok I know this is a Noob Question but there really is not that much documentation on this for a noob and the editor.

I see that the T3d has all the AI scripting done but how do you use it? There is no option in the editor.

#1
08/27/2010 (3:08 pm)
Yeah, this isn't actaully handled in any docs directly ...

If you look in game/scripts/server/gamecore.cs you should see some script that has been commented out - it all relates to "AiManager" and you want to uncomment that.

MissionCleanup.add(AIManager);
    AIManager.think();
And the AiManager.delete() somewhere else in the file.

Now AiPlayer.cs tells you what is required for an Ai to spawn - but to cut to the chase ...

Go into the world editor and under Level->System add a new simgroup/set and call it "Paths".
Under Level->Level and a Path and call it "Path1", drag it into "Paths" if it isn't already in there.
Now also under Level->Level make some PathNode/Markers and set them around in a circle. If you have "Path1" highlighted whilst you do this, the node/markers should end up inside "Path1", if they don't just drag them all in when you're finished.

When this happens ... hopefully ... an Ai will spawn called "Shootme" (look in aiplayer.cs for the name/spawning) and will just run around the path, to prvoide you with some moving target practise.

For more info on getting Ai to do basic things check out old info at TDN's basic Ai Section (you have to log in then go to the link - which is annoying), search this site for old resources like "Killer Kork" and "Ai Guard". There's also the Universal Ai Kit, which whilst I haven't used, seems to get a lot of good feedback.
#2
08/27/2010 (6:40 pm)
Wow, I really would of that that this would be in the Doc's Somewhere..

I have read so much on Getting AI to work with torque and "Gamecore.cs" was never mentioned at all. i was looking in the wrong places the whole time.
Yes this helped a lot.. Once I get this working I might have to make a TUT on this for T3D, because there is literally nothing on it.

Thanks man, you saved my from going bald.
#3
08/27/2010 (6:57 pm)
If you don't want to deal with the gameCore to gameType (unused) functionality and use a game.cs script file that is more similar to what is found in older versions of Torque -- and also has the AIManager re-enabled check out this game.cs replacement Resource.

The pathed AI that Steve describes is pretty much the stock functionality of AI in Torque. The scripted AI Resources,Improved AI Guard and/or Killer Kork, are great extensions and learning material for shooting, guarding, patrolling, etc bots.
#4
08/27/2010 (7:46 pm)
Thanks Mike,

I looked into the Game.cs Replacement and it looked promising until I got to the bottom with the outstanding issue's. The playerlist.gui, I guess it aint really a big deal and if it was I could just simply make a custom one to fit my needs. I will try it out right now and see what I can do with the AI Thing.. The improved AI guard is an amazing resource to by the way. I have to start small before I jump into the pit. lol

Thanks guy for your input it has helped me out a lot

#5
08/27/2010 (8:01 pm)
OK I got the AI working. It is funny to watch him drive too! I ran into way to get the ai not to Mount to vehicle here on the forum somewhere I will have to find it. Just that I would let you guys know that I finally got it..
Thank you
#6
08/27/2010 (8:41 pm)
Cool, glad to know you got it working. You'll find most of us try and be helpful around here.

The playerList problem is partly my fault since I'm the one who added the additions to it that are found in Torque3D. The original score gui only showed scores, I added the bits were it can show deaths and kills as part of the package override. It's really fairly simple to fix it, just have to find the differences between what was being overridden in the gameCore package and move them into the same named 'core' script methods.

There are several ways to make vehicles mountable only by players. Could do a classname check and only allow players or even use a custom onAdd() for bots that sets the mountVehicle bool to false are just a couple easy ideas.

Have fun learning & experimenting and good luck.
#7
08/29/2010 (12:53 pm)
So since I got it working I looked into the "Improved AI" by Twisted and I ended up making a resource that is scripted for T3D you can check it out here www.torquepowered.com/community/resources/view/20211
Again thanks for your guys help getting this going!