Sign in to follow this  

AI for a roguelike game

Recommended Posts

nethackpro    102
I am developing a roguelike game from scratch, and Im having difficulty with getting the AI to find and walk through doorways while also, at the same time, seek out the players. Any help?

Share this post

Link to post
Share on other sites
Talyssan    122
Two ways spring to mind:
1) Have the monsters "cheat" by always knowing the direction that player is in and have them move towards that point.

2) Give each monster a line of sight (to save time, perhaps do this within a certain distance of the player) and have them move toward anything interesting they see.

Doing 2) is extremely tricky in practice I've found, especially when dealing with doors. What I came up with to "solve" it was complete hack that will only work for simple "rogue-likes" but it is very fast. In truth it doesn't make for more or less interesting behaviour unless you put a lot of effort in to make it use the LOS information.

Hope that helps,

Share this post

Link to post
Share on other sites
Steadtler    220
Here is another idea:

Let the player leave an undisplayed "trace" or "smell" when it walks around. Let it fade a bit each turn. When a monster "smells" the track of the player, make it move toward the strongest smelling point, effectivelly tracking the player.

For the actual pathfinding in rogue-like games... good old A* should do the trick.

When a monster doesnt smell anything, let it explore rooms around. Perhaps explore "doorways" instead of rooms. For the monster, each room is just something it have to cross in order to explore another doorway ;)


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this