Game Development Community

AI teams, AI attack, and AI hiding

by Joe · in Technical Issues · 12/22/2005 (5:37 pm) · 6 replies

How would I make AI that would react differently to different situations. How could I make it so that there were two AI bots, and the player character hides behind cover, one will supress the the player character's position, and the other willl try to flank the player's position.

#1
01/04/2006 (8:32 am)
I think the first thing to figure out is the range of actions you want your AI to execute, and then figure out how your AI gets it's information in-world. Once you have that, you can script your AI to react to stimuli any way you want.
#2
02/04/2006 (7:15 pm)
Maybe putting atag on things that the AI could hide behind would work.
#3
02/11/2006 (9:48 am)
I've got an old pdf file on how the bots in Counterstrike were designed, not much code but alot of info on decision making and how the levels were planned to achieve what you are looking for. It's pretty interesting to see how alot of the "A.I." was just clever placement of dummy objects in the level. If your interested just drop me an email at chriskuy@comcast.net.
#4
02/16/2006 (9:58 pm)
To hide from the player....

You could put a series of waypoints in your game world, and then do a line test from the waypoint to the current player position. If the line intersects the geometry of a game object that has been identified somehow (a flag?) as cover, then you have the AI seek the waypoint. To attack the player, you may have the AI move to a waypoint with a clear shot, make the shot, then move back to the cover waypoint.

To have a mutual attack, you will have to have two enemies be aware of each other and define their roles. You may have the enemy itself look for another enemy to be its partner, or have some routine go through the enemies and pair them up. Define one as cover fire, the other as flanker.

When you detect that there is geometry between the player and the enemies (create a line between the player and enemies, if geometry is between them then player is "hiding") and that this situation has existed for some time (or just that no enemy has a clear shot), set up the enemy roles (cover fire enemies and flanker enemies). Then find a waypoint via a line test close to the player with a clear shot (line from waypoint to player does not collide with geometry). Have the cover fire enemy fire at the player's location. Have the flanker enemy pathfind to the waypoint with the clear shot, firing when there's a clear shot.

Hope that helps.
#5
02/27/2006 (12:16 pm)
Look on the web for "cooperative AI".

Personally, I have a liking for a hierarchical scheme. Meaning that you have a third AI that is not attached to a specific bot, but instead make decisions for the team.
#6
05/15/2006 (6:36 am)
[edited for uselessness :) ]