Combat AI: fallback behaviour

Everything about development and the OpenMW source code.
Post Reply
User avatar
akortunov
Posts: 438
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation
Github profile: https://github.com/akortunov

Combat AI: fallback behaviour

Post by akortunov » 11 Feb 2018, 14:17

Hello!
In both OpenMW and Morrowind archers and mages try to fall back if the enemy is too close.
OpenMW behaviour has two problems:
1. If there is an obstacle behind, NPC runs on place endlessly. In Morrowind NPC just stops in this case.
2. NPC can run off the cliff. This issue is not present in vanilla game.

Take a look at this branch.
I managed to solve the first issue: NPC stops and still uses evading (side) movement if there is an enemy nearby. Sometimes NPCs manage to evade obstacle via side movement.
slide0.png
slide0.png (4.29 KiB) Viewed 1539 times
Unfortunately, I had to use physics raytesting, so I'm aware of performance cost of this solution.

Feel free to test the branch and provide any feedback.
Also please share any ideas how to solve the second issue, or improve solution for the first one.

EDIT: to solve the second issue, I tried to modify approach from the first one:
slide.png
slide.png (4.81 KiB) Viewed 1543 times
Angle A should be more than sMaxSlope.
If the vector has no collisions, there is a cliff nearby.
Unfortunately, it works only partially for now (or I am just dumb).
Also there should be a more more generic place for this code since the normal movement should use it too.
Can we stop the actor during physics simulation?

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests