Combat AI target position selection
Posted: 05 Nov 2018, 18:03
Current combat AI logic considers only actor position to attack and random world position to flee. It doesn't consider possibility to reach target. This leads NPC to stay at one position if it can't find path to target position. Current pathfinding logic contains a lot of hacks to avoid this situation which leads to problems like https://gitlab.com/OpenMW/openmw/issues/1997 . To resolve this I suggest to select target position for actor in combat using utility function optimization. Minimum set of factors could be following for this function:
1. Is this position reachable for NPC?
2. Can NPC attack from this position? Should consider available NPC weapon, magic, mana and arrows.
3. Can opponent attack NPC at this position? How much NPC should know about opponent? Is it only visible behavior? Example rules: If my opponent is wearing a sword, it should attack me only by melee. If I saw my opponent wearing a bow, it can attack me by range.
My idea is to avoid situations when NPC can't reach target and to make them less vulnerable to a player. I hope it doesn't brings a lot of gameplay difference to original morrowind and we can implement it in the game engine.
1. Is this position reachable for NPC?
2. Can NPC attack from this position? Should consider available NPC weapon, magic, mana and arrows.
3. Can opponent attack NPC at this position? How much NPC should know about opponent? Is it only visible behavior? Example rules: If my opponent is wearing a sword, it should attack me only by melee. If I saw my opponent wearing a bow, it can attack me by range.
My idea is to avoid situations when NPC can't reach target and to make them less vulnerable to a player. I hope it doesn't brings a lot of gameplay difference to original morrowind and we can implement it in the game engine.