AI Path Prediction

So all my other questions have been answered, apart from the previous one since I wasn’t able to turn it into a solution so I figured I’ll ask one more before I move onto the animation portion of my game. So I’m attempting to craft an addition to my AI system, specifically what I’m looking for at this time is to allow AI to predict where the player is going to be based on their current trajectory. The idea being that if the player is running forward, any AI will aim for where the player is going to be in .25 of a second from now. In practice, this should result in rushdown enemies intercepting you with their bodies and long range enemies intercepting you with their projectiles. I’m doing this so the AI isn’t overly difficult, they’re supposed to be fairly intelligent but not to the point that they can’t be beaten. Having AI intercept you in a relatively simplistic way should be fine. So for example, the system allowing you to run forward for three seconds but then as an AI begins to try to intercept you, you change course to throw them off, that should be a valid strategy. Just so long as the AI knows where to aim up until the point they begin their attacks.

the way i did this was since all of my characters are like, command based (there’s no direct input ever), i do a quick navpath check and then multiply my char’s speed * time to get a rough point along the navpath to predict where they’ll be in (time) from now.

if you’re using direct input for a character then you could just have the AI get the forward vector of the character and do the same thing where you just add movementspeed * time to that forward vector (and you could even involve a line trace to check for potential wall collisions for stopping short, etc)

1 Like