I recently discovered and began playing the roguelike "Incursion". After reading some things on the site about it, a specific paragraph about the AI stands out to me as ingenious.
Quote:
--
"Monster movement is determined by a “sum of gravities” algorithm. Every thing that the monster is attracted to within its line of sight – an enemy it wants to attack, a magical item it wants to pick up, a portal it wants to jump into – asserts what is essentially a gravitational pull on the monster. Each target has a priority, which determines the base strength of the pull; the attraction gets stronger the closer the monster is to the target in question, meaning that it will “go for” nearby enemies in favor of far-distant ones of higher priority. If none of the monster’s targets are within its line of sight, it remembers the last known location of each target and will attempt to go to that location.
'If it is stymied even in this – it can’t reach the last known location, or it reaches the location and still can’t see the target, having no idea where it might be now – or if it just has no targets to begin with, then it will create its own. The monster will choose a random point on the map and attempt to walk toward that point. When it gets stuck and can go no further, it will consider that point resolved and choose another one. Further, when no actual real enemies are in sight, a monster will never step away from a wall. These factors together essentially allow the monsters to explore the dungeon on their own – by “following the right wall” and striving to reach random points on the map, they can navigate the dungeon on their own accord.
'When they are severely injured, or become scared as a result of a magical fear effect, monsters will turn and flee from their attackers. This is accomplished by turning the gravities of enemies into negative values, making them repel the monster instead of attracting it. When monsters are troubled by injury or maladies such as disease or blindness, they can diagnose this and will correct it if they have the means available to do so. For example, a monster struck by a poisoned sword will then drink a Potion of Neutralize Poison if it has one in its possession. Monsters can also fix maladies among their allies – an orc shaman might cast cure critical wounds on its fellows in battle, for instance."
--
This really stands out to me because it's simple, yet it mirrors to reasonable extent the way we act in real life.
It seems to me that it would be too intensive for Dwarf Fortress given all the other stuff it runs (the gravities algorithm would have to be run for every creature), however, since it seems to work so effectively, both in concept, and in the actual game, I thought it was worth mentioning here.
Go to the Incursion page, then click on th link that says "White Paper". Search for "Monster AI" on that page and you should find the whole write-up about the game's AI system. Seems pretty cool to me.