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: | or 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!
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: | 10/01/08 - Play the *working* Tactical AI Kit Demo! 09/18/08 - Play the Tactical AI Kit Demo 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 your own resources!| Scooby Brown (Jun 08, 2008 at 23:37 GMT) |
Nice
When can we get our hands on this?
| Tom Eastman (Eastbeast314) (Jun 08, 2008 at 23:43 GMT) |
Nice work!
| bryce (Jun 09, 2008 at 00:00 GMT) |
@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) |
| Edward Smith (Jun 09, 2008 at 00:52 GMT) Resource Rating: 5 |
| Morrock (Jun 09, 2008 at 00:57 GMT) |
@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) |
Edited on Jun 09, 2008 01:00 GMT
| Chris \"C2\" Byars (Jun 09, 2008 at 00:59 GMT) |
| bryce (Jun 09, 2008 at 01:00 GMT) |
www.youtube.com/watch?v=CKaGiriCQ7Y
Edited on Jun 10, 2008 21:24 GMT
| Benjamin L. Grauer (Jun 09, 2008 at 03:28 GMT) |
| bryce (Jun 09, 2008 at 13:09 GMT) |
| Ross Pawley (Jun 09, 2008 at 19:38 GMT) |
| bryce (Jun 09, 2008 at 21:32 GMT) |
| Ross Pawley (Jun 09, 2008 at 21:41 GMT) |
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) |
| bryce (Jun 09, 2008 at 23:14 GMT) |
| Ross Pawley (Jun 10, 2008 at 00:16 GMT) |
You must be a member and be logged in to either append comments or rate this resource.



5.0 out of 5


