#### Archived

This topic is now archived and is closed to further replies.

# Best Way of Developing Pathfinding AI

This topic is 5559 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I was recently working on a 3D game where a sniper attempt to shoot another sniper in a small town. Since this is in 3D then what is the best way that I should tackle this problem? Do you have any suggestions to what AI libraries I should use and what functions I should use?

##### Share on other sites
Whoooo.... that''s a whopper.

When you say that "this is in 3D", do you mean that the agents can go up and down to different levels of buildings, etc. i.e. the map is multi-tiered?

If so, that is a big part of your problem. In a way, if you have a sniper situation, he is more concerned with choosing a correct location for sniping and just moving to that. In that case, the pathfinding is just a matter of moving to the points that allow you go to go up/down to the different levels until you are on the level you have selected... then going to the location.

As far as functions and libraries, A* will do the trick with a little modification for the levels. Analyzing the map to determine where he should go to is a different issue entirely - but that''s not what you were asking for.

Unrelated question... do you really mean 2 classic snipers? That game will come to a stalemate really quick as they both find camping places that can''t see each other... and each waits for the other.

Dave Mark - President and Lead Designer
Intrinsic Algorithm -
"Reducing the world to mathematical equations!"

##### Share on other sites
quote:
Original post by InnocuousFox
Unrelated question... do you really mean 2 classic snipers? That game will come to a stalemate really quick as they both find camping places that can''t see each other... and each waits for the other

Wouldn''t giving them a certain time-out value where they''d decide to just get up after a while and try to find an other location solve the problem?

Well, that would be a bit stupid in an IRL situation because a sniper that runs around just... y''know... isn''t a sniper But then again, no-one has infinit patience.

##### Share on other sites
...or infinite food and water either.

Anyway, a node map with an adjacency matrix (and maybe direction matrix) for the pathfinding, and use a series of weighted nodes to choose the destination?

ToohrVyk

##### Share on other sites
Watched ''Enemy at the Gates'' recently? Anyhow, I''d have pre-defined locations that the AI sniper can chose from (such as spots on roof-tops etc), which would be planted using a map-editor. Then the AI uses A* to navigate to it''s chosen position. Or, you could simply develop a waypoint system that leads between sniper positions like a net. You''d probably still need A* to navigate the net, but it would be faster. Of coure, there is the problem that the player, after playing on the same level several times, will begin to learn the sniper locations. But this can be solved simply by laying tons of these sniper-points down.
As for the stalemate - yeah, massive problem wich equals bordem. There has to be something to draw the snipers out and get them moving. Else the player will sit in the one spot for ages, bored, and thinking negatively about your game. I suggest using scenarios like this:
1 sniper defends a flag, while the other one attepts to sneak in and grab the flag. This makes for some interesting gameplay. More so if you have, say, 2v2 snipers. For each team, 1 could find a position near their flag while the otherone goes after the enemy flag.

1. 1
2. 2
Rutin
20
3. 3
khawk
17
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633756
• Total Posts
3013710
×