AI pursue into a structure?
by Charlie Higdon · in Technical Issues · 10/08/2008 (2:39 pm) · 7 replies
I'm having no trouble getting AI to chase, attack, wait, etc in the wide open outdoors.
I am having issues when I run into a building or something. Unless I am extremely close to the bot it usually runs into a wall and keeps walking til it slides through the door. Is there any way, short of placing waypoints at the door of every building, and the juncture of every stairway, closet, hallway?
I did some searching and nothing seemed to match quite what I was looking for. I was hoping someone might could provide some suggestions or some advice to get me going the right way.
I am having issues when I run into a building or something. Unless I am extremely close to the bot it usually runs into a wall and keeps walking til it slides through the door. Is there any way, short of placing waypoints at the door of every building, and the juncture of every stairway, closet, hallway?
I did some searching and nothing seemed to match quite what I was looking for. I was hoping someone might could provide some suggestions or some advice to get me going the right way.
About the author
#2
10/08/2008 (4:56 pm)
Check out Dan Keller's Flexible A* resource great pathfinding and takes about 10 minutes to implement. And of course research A* while you're at it, it's one of the most popular of all path-finding algorithms and great to know about.
#3
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=14495
10/08/2008 (6:34 pm)
And if you are using TGE there is also this Astar code:www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=14495
#4
10/09/2008 (12:54 pm)
You have to set up a navigation mesh before thinking about A*. A navigation mesh can be as simple as manually marking the level at every turn, or as complex as Paul Tozour's "Building a Near-Optimal Navigation Mesh" from AI Game programming Wisdom. A good tip is making sure no waypoints are left orphaned. In other words, make sure a path exists between all waypoint pairs when executing a simple A* or Dijkstra search.
#5
10/09/2008 (2:36 pm)
In my Improved AI Guard Unit resource, I've now upgraded the bot's ability to turn corners. In the vast majority of situations, it should no longer slide along the walls. This resource doesn't have to use any kind of navigation mesh or waypoints.
#6
11/07/2008 (3:15 pm)
Yes like everyone is saying, an A* search is the best bet. Its really neat how it works too.
#7
And I have tried in the file aiPlayer.cc as follows but its not happening ........
function AIManager::spawn(%this)
{
%player = AIPlayer::spawnOnPath("Kork1","MissionGroup/Paths/Path1");
%player.followPath("MissionGroup/Paths/Path1",-1);
$player1=%player;
echo("*************************************************");
echo($player1);
%player.mountImage(CrossbowImage,0);
%player.setInventory(CrossbowAmmo,1000);
%player = AIPlayer::spawnOnPath("Kork2","MissionGroup/Paths/Path2");
%player.followPath("MissionGroup/Paths/Path2",-1);
$player2=%player;
echo("*\&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
echo($player2);
%player.mountImage(CrossbowImage,0);
%player.setInventory(CrossbowAmmo,1000);
return %player;
}
and from the missiongroup I have changed the path2's co-ordinate too.... but still its not working.
11/11/2008 (4:48 am)
I m using Torque 1.4, and I want to create an another aiPlayer........ so how would I do??And I have tried in the file aiPlayer.cc as follows but its not happening ........
function AIManager::spawn(%this)
{
%player = AIPlayer::spawnOnPath("Kork1","MissionGroup/Paths/Path1");
%player.followPath("MissionGroup/Paths/Path1",-1);
$player1=%player;
echo("*************************************************");
echo($player1);
%player.mountImage(CrossbowImage,0);
%player.setInventory(CrossbowAmmo,1000);
%player = AIPlayer::spawnOnPath("Kork2","MissionGroup/Paths/Path2");
%player.followPath("MissionGroup/Paths/Path2",-1);
$player2=%player;
echo("*\&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
echo($player2);
%player.mountImage(CrossbowImage,0);
%player.setInventory(CrossbowAmmo,1000);
return %player;
}
and from the missiongroup I have changed the path2's co-ordinate too.... but still its not working.
Torque Owner Timothy Castagna
TK Games LLC