Advertisement

having the bots find the player

Started by September 12, 2006 01:52 PM
4 comments, last by GameDev.net 18 years, 2 months ago
I've got my nodes planted at the intersections of my game map and the bots walk the map based on those nodes. I can only assume I need the player class record the last known node it hits. So the best the bot can do is move towards the last known position of the player. Would that be considered a good approach?
This is a fairly common and low-CPU way of addressing the issue. However, if your bots are slower than the player, or if your player is trying very hard to get away from the bots then it will lead to predictable and static AI.

To add a bit of juice to the setup without any real 'intelligence', get the bot to visit the last node the player touched only if the bot is one node away from it. Otherwise, send your bot to a random node adjacent to said player node. This may cause the bots to look stupid some of the time, but it at least prevents them giving a vain and transparent chase and will keep the player on his toes.

A better system would determine which node the player appears to be heading towards, and set the crosshairs there.
Better yet, in a pseudo-continuous uniform graph (such as a fine grid, but not a road-junction system) you could extrapolate the player's position according to his velocity/previous positions in an appropriate manner to determine where she will be so that the bot can arrive there coincidentally.

If you give us more details on the nature of the graph, you may get a more useful answer.

Regards
Admiral
Ring3 Circus - Diary of a programmer, journal of a hacker.
Advertisement
I like what you suggested. I'm working on a zombie FPS so the bots are zombies. Some zombies will be randomly walking around, others will be standing in place. I figure once the zombie see's the player, he will chase the player to a certain degree. They will loose interest once the player is out of sight and will continue in the player's general direction but in random walk state.

The map is a high rise office building so it will be hallways, rooms and a stairways leading down to the next floor.
Since you have many bots, you could always take the "pacman" approach, which was fairly successful!

Its been told innumerous times, but here goes

1-Some bots move toward the players last known position
2-Some of the bots try to guess where the player is heading and go there
3-Some of the bots look at random
4-Some of the bots cover areas the player is likely to go, even if he wasnt anywhere near there.

Cooperation fer the win!
the way I do it is this:

1.get the yaw from the bot to the players current position and do 2. (below)
2.find next waypoint from the bot that is closest to this yaw and head to it. If the player can be seen then shoot/whatever else do 1. again.

zombie rush...
if a zombie can see the player, run towards him
if he loses sight of the player, random walk at the last place he was seen
if a zombie can see running zombie but not player, follow the leader

This topic is closed to new replies.

Advertisement