I’m trying to make an AI enemy that when certain conditions are met will be triggered and quickly get to the location of the player killing him (something like an insta-kill game over). I only have two issues , the one being that because the AI is quite fast it sometimes overshoots the player.
The second issue being that the AI can’t exactly understand when the player is on an elevated area meaning it gets stuck and get navigate properly (for example a ramp) and I would like to learn how to improve AI Pathing (finding the best path to the player).
Since this is my first time playing around with AI logic, I have no clue if im doing it correctly. So any kind of tip would be helpful.
AI Move to Player Logic
Can you elaborate this one? What you mean exactly with overshoot?
- Player standing on a surface doesn’t really means AI can navigate or reach that point. Sometimes cause of Z elavation and if there is no navlinks to that point it can fail. Also AI agent (Radius) can effect which points are navigatable from where. Make sure all areas where player can go is navigatable by AI (Navmesh + Navlinks)
Look into navinvokers and set up some better path finding by customizing the way the path is chosen.
The most direct path is not likely to ever be the fastest unless the object can fly…
directing the AI move To with a bit more intelligence helps. But no you aren’t doing it right.
You need to setup a blackboard script and all the bells for it to work more correctly.
By “overshoot,” I mean that when the enemy’s walk speed is set very high (which is what I intend to do), the enemy passes beyond my player character missing him completly. Which results in the enemy not hitting my character.
As for the AI pathing I found a solution.
Oh got it, so its so fast on tick it misses point where it should stop since tick distance delta’s are quite big.
Some solution
- Make acceptance radius as big as possible without ofcourse breaking immersion.
- Secondly stop on overlap/ cancel movement
- Thirdly make BrakingDecelerationWalking very high for this movement specifically and back to normal at the end. Since low decelaration for sure overshoots aswell.
- And as last as fallback, get path length and calculate (accumulate) distance traveled every tick for movement. If DistanceTraveled > PathLength stop movement.