I had an article about rogue-like pathfinding that could be applied to other games and all. But well, the site went down. It's similar to dijkstra and a*. I call it aura path finding. I had vector path finding as well, but it was best used on non-tiled environments.
For rogue-likes, I'd go with an implementation of any aura casting methods. You can enhance it, however. to make things more interesting.
First of all, you want to make sure that if an enemy has visual contact, it ignores the original path finding. Second, you want to do the cast phase only once and use it for all creatures. Third, you can cast it once every 10 turns or so, so you don't have a huge path finding overhead.
Lemme give some practical examples.
Consider this map:
1 2 3 4 5 6 7 8 9
*------------------*
1| |
2| ########## ## |
3| ## ## | Each two spaces equals one tile.
4| ## ## |
5| ## ## |
6| ## ## |
7| ## |
8| ## ## ## |
9| ## ## ## |
0| ## ## |
1| ########## ## |
2| |
*------------------*
Now we place our hero (@@) and our monsters (M1, M2, M3) somewhere.
1 2 3 4 5 6 7 8 9
*------------------*
1| |
2| ########## ## |
3| ## ## | @@ = Player
4| ## ## | M1 = Monster 1
5| ## @@ ## | M2 = Monster 2
6|M1## ## | M3 = Monster 3
7| ## |
8| ## ## ## |
9| ## ## ## |
0| ## ## |
1| ########## ##M3|
2| M2 |
*------------------*
First thing we do, is that we create a byte map with an aura cast from the player, starting with 0 and increasing with every direction. This map can be updated like every few rounds. Doesn't have to be precise... All it gotta do is get the monsters into line of sight so they can take a more direct method.
1 2 3 4 5 6 7 8 9
*------------------*
1|121110 9 8 7 6 7 8|
2|13########## 5## 9|
3|14## 4 3 2 3 4##10|
4|15## 3 2 1 2 3## 9|
5|14## 2 1 0 1 2## 8|
6|13## 3 2 1 2 3## 7|
7|12## 4 3 2 3 4 5 6|
8|11## 5## 3 4 5## 7|
9|10## 6## 4 5 6## 8|
0| 9 8 7## 5 6 7## 9|
1|10########## 8##10|
2|111213121110 91011|
*------------------*
First thing you will notice is that you know the walking distance for each monster to the player. This is the most basic path finding you can do for your monsters in a rogue-like.
The problem is. It's not very realistic as the monsters would have some super ability to know where the player is. Plus take monster number 2. He can go either left or right. How would he decide. Here's were we can have more fun with this. You can have a byte map for noises the player make. His smell trail. Blood trails, etc.
Lets say the hero did something at square (3,7) like triggering a trap that created 10 points of noise. Also lets say walls absorb 2 points of noise. So we cast a map for it that could decrease by 1 point every couple rounds, for example. Just so the monsters remember where the noises are coming from.
1 2 3 4 5 6 7 8 9
*------------------*
1| 1 2 1 |
2| 1###3#2#1## 1## |
3| 2#3 6 5 4 3 2## |
4| 3#4 7 6 5 4 3## 1|
5| 4#5 8 7 6 5 4#1 2|
6| 5#6 9 8 7 6 5#2 3|
7| 6#710 9 8 7 6 5 4|
8| 5## 9#6 7 6 5## 3|
9| 4## 8#5 6 5 4## 2|
0| 5 6 7#4 5 4 3## 1|
1| 4#3#4#1#2#1 2## |
2| 3 2 3 2 1 1 |
*------------------*
This can help monsters decide which path to take. A great thing is that it also defines a range for the noise. And if you want to be more realistic, you can use an exponential decay rate to simulate reality a bit better. But how can we apply this to the aura cast? That's simple. We just subtract these numbers from the aura byte map.
We can also say the hero is stinky from fighting and leaves a smell trail of 15 points that decay by one point per turn (which is a bit too fast, I wouldn't use that, maybe one point every 10 turns for that value) and that decay by two when cast from the player.
1 2 3 4 5 6 7 8 9
*------------------*
1| |
2| ########## ## | Path the player might have taken.
3| ## ## |
4| ## ## |
5| ##//--@@ ## |
6|M1##|| ## |
7| ##|| |
8| ##||## ## |
9| ##||## ## |
0|//--//## ## |
1|||########## ##M3|
2||| M2 |
*------------------*
1 2 3 4 5 6 7 8 9
*------------------*
1| |
2| ########## 1## | Notice how the path he took is much more smelly
3| ## 911 7 5 3## | than the rest of the room.
4| ##121311 7 3## |
5| ##1415@@ 7 5## |
6| ##131311 9 7## |
7| 1##1211 9 7 5 3 1|
8| 3##11## 7 5 3## |
9| 5##10## 5 3 1## |
0| 7 8 9## 3 1 ## |
1| 6########## ## |
2| 5 3 1 |
*------------------*
This could also be subtracted from the pathfinding map... Then all monsters gotta do is follow the nearest lower value. In this case, M2 would go left for example. Following both smell and sound the hero just made.
You can also avoid the aura cast at all, in that case, they would only follow by sound, smell and other senses. Meanwhile they could move around randomly or patrol until they actually saw/heard/smelled the player and so on. If there was some sort of alarm, you can then cast the huge aura to the player and let it work somewhat like L4D zombie rush, where every monster goes towards the player.
This can be used for a lot of things, btw. Like pointing out areas of interest for the monsters, or threat areas they should avoid, places they should gather, etc.