Previous Blog Next Blog
Prev/Next Blog
by date

New features to the Tactical AI Kit

New features to the Tactical AI Kit
Name:bryce
Date Posted:Jun 08, 2008
Rating:5.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for bryce

Blog post
Hello GarageGames Community!
I thought that it's about time that I posted another .plan on the site. I've been working on and off on my Tactical AI Kit, and since August I have made a lot of progress that's worth talking about. New features:
--(improved) Usage of cover
--Alternating fire on enemies between two allies
--Using radius damage to the NPC's advantage
--Basic grenade throwing
--Weapon switching

Usage of Cover
AI Players can use pre-placed and compiled cover points to fire at an enemy and move back into cover when needed. Currently, this system supports firing from the sides of cover (e.g. firing around a wall) and firing over cover (a small crate, car, barrel, etc.). When the map is made, cover points are inserted in by the developer where an AI Player would want to take cover. Once they are placed, setUpCoverPoints() is called via console and a series of raycasts determine what kind of cover the object is and whether an NPC could fire over it or not. This information is saved to the cover point using dynamic fields so an AI Player can just jump in and use it. Works like a charm.


Alternating fire on enemies between two allies
When two NPCs on one team are attacking other NPCs on a different team, the two will form a temporary team (if not already part of a squad, which I will give a shot at implementing later). When one NPC needs to reload or gets pinned down by enemy fire, the other will continue their fire.

Using radius damage to the NPC's advantage
When an NPC's target is behind cover and they happen to have a grenade or rocket launcher, firing it directly into the cover isn't always effective. Instead, my NPCs will look at the geometry around the target to find a nice spot to fire to damage or kill him. If an NPC's target is hiding behind a road barrier, the NPC will notice that he can launch his rocket-propelled grenade to the side of the cover and damage the opponent.


Basic grenade throwing
I'm very proud of myself for figuring this out before we even covered parabolic trajectories in my algebra class...NPCs can figure out at exactly what vector to "throw" a grenade so it can wipe out an enemy behind cover. The reason I say basic is because the NPC is pretty much ignoring all level geomety in the way of the grenade...They blow themselves up a lot. What I'm going to do eventually is have a function that pre-generates random grenade trajectories from a cover point to all others within 60 meters around it. If that trajectory would land a grenade where we want it, it's a good trajectory. This system would let NPCs bounce grenades into a room, drop them from a balcony, throw them through a window, etc.


Weapon switching
An NPC, when spawned, is given a primary weapon and a secondary weapon. In a fight, both weapons are scored on several characteristics. They get scored from 0 to 10 on range, damage, rate of fire, reload time, and weight in lbs, depending on the situation. The weapon with the highest average score is the best for the fight. For example, a foot soldier is spotted 300 meters away, and we have a Dragunov sniper rifle and an RPG. The sniper rifle has the best range for this target, will inflict appropriate damage (We try to avoid overkill), is lighter, etc, so it is chosen to take out the threat. Then we notice an enemy tank down the street 60 meters. The RPG, despite having long reload time and heavy weight, gets a good score on damage and range and is chosen. This system allows for a lot of weapon variety during a firefight.

(Using an AK47)

(Now using an M4)

Videos: (Sorry about the quality)
1; Outdoor, long range fighting www.youtube.com/watch?v=4XP_3Ivz8fg
2; Indoor, closer combat www.youtube.com/watch?v=CKaGiriCQ7Y

Well, this is it for my showing off session. If you have any questions or remarks, post a comment. Please rate!

Recent Blog Posts
List:08/06/08 - Tactical AI Kit Demo is in the Works!
07/24/08 - Tactical AI Kit Squad Support is In!
06/08/08 - New features to the Tactical AI Kit
07/12/07 - Interactive AI!

Submit ResourceSubmit your own resources!

Scooby Brown   (Jun 08, 2008 at 23:37 GMT)
Whoa Ive been watching this for awhile...

Nice

When can we get our hands on this?

Tom Eastman (Eastbeast314)   (Jun 08, 2008 at 23:43 GMT)
Bryce, you know screenshots aren't enough for us... I demand a video!
Nice work!

bryce   (Jun 09, 2008 at 00:00 GMT)
@Scooby: Not so sure yet. I'm going to end up rewriting most of my code into C++ as soon as I can figure it all out. It's still going to be a while; I've got a lot on my to-do list.
@Tom: As you wish, uploading to YouTube now. Once it is officially posted I'll give a link to it.

Mike Rowley   (Jun 09, 2008 at 00:49 GMT)
Wow, this is impressive. I've been reading a lot lately, about ai taking cover and such. It seems like you have a really good handle on how to actually make this look real. Cudos to you and good luck porting to C++. What language are you using btw?

Edward Smith   (Jun 09, 2008 at 00:52 GMT)   Resource Rating: 5
WOW this sounds really good. I'm very impressed and excited this is something that TGE(A) really needs.

Morrock   (Jun 09, 2008 at 00:57 GMT)
Woot, finally another update bryce, I've been long awaiting what you'd do next. The radius damage intelligence sounds great. Hope you get the grenades done soon, grats on the parabolas.

@Mike, this is all C++ and TorqueScript btw. I don't know how else bryce could've implemented them into Torque without C++.

Morrock   (Jun 09, 2008 at 00:59 GMT)
Ahaha, just searched youtube and watched the vid, uploaded 2mins ago. Very Nice. A little dark though, can't see everything that's going on.
Edited on Jun 09, 2008 01:00 GMT

Chris \"C2\" Byars   (Jun 09, 2008 at 00:59 GMT)
HOT.

bryce   (Jun 09, 2008 at 01:00 GMT)
www.youtube.com/watch?v=4XP_3Ivz8fg
www.youtube.com/watch?v=CKaGiriCQ7Y
Edited on Jun 10, 2008 21:24 GMT

Benjamin L. Grauer   (Jun 09, 2008 at 03:28 GMT)
I can't see anything. Too dark.

bryce   (Jun 09, 2008 at 13:09 GMT)
Sorry about the screens and videos.....It didn't look bad on the computer I took them on. I'll see if I can fix it tonight

Ross Pawley   (Jun 09, 2008 at 19:38 GMT)
@Bryce, good show man. How close are you to being able to purchase the engine now?

bryce   (Jun 09, 2008 at 21:32 GMT)
I finally bought it back in September, but I'm still trying to learn the C++....it's all so confusing!

Ross Pawley   (Jun 09, 2008 at 21:41 GMT)
@Bryce, ah that's cool, you met one of your goals at least. Grats!

As to learning C++ I suggest taking a look at Thinking in C++, which as free PDF versions online (here's volume one, and volume two). Read through them and make sure to do the exercises and you'll be well on your way.

You might also want to pick up Ed Maurina's new book, which deals with the engine/C++ side of things this time(the "Multiplayer Gaming and Engine Coding for the Torque Game Engine").

Just as a quick tip, usually what you to do between the C++/script split is have your C++ do anything that is expensive, then expose those functions to script (using ConsoleMethod/ConsoleFunction). So for instance, you might move large loops or raycasts into C++ then just expose those to give you the result in script.

bryce   (Jun 09, 2008 at 23:07 GMT)
@Ross: That's what I was thinking. The pre-calculated grenade trajectories would take forever to execute in script. I may move object analysis and visibility to the C++, too. I don't want to add too much because having to re-compile code all the time sort of hurts the amount of flexibility.

bryce   (Jun 09, 2008 at 23:14 GMT)
Sorry about that, video fixed.

Ross Pawley   (Jun 10, 2008 at 00:16 GMT)
@Bryce, yeah visibility and object testing stuff should be in C++. You wouldn't have to recompile that much after you get your C++ functions working right. After that you can just change your scripts.

You must be a member and be logged in to either append comments or rate this resource.