I’m working on a top-down arcade style shooter and I’m having issues getting the type of enemy behavior I want for my ranged enemies. I’m trying to create a ranged grunt that attempts to keep its distance from the player.
I can get them to attack but I can’t get it to properly evade attempt to evade the player while not just running straight into a wall and sticking there.
I’ve been looking into EQS for this but I’m not having much luck. Normally I’d keep fighting with it but I’ve got a deadline for the end of this week to meet up with a potential financial backer and I don’t want to present completely idiotic ranged AI that either just sit there, wander aimlessly, or chase the player the same way the melee grunts do.
Any tips, tricks, tutorials or anything else would be greatly appreciated.
What I would then do for your setup: When the bot is too close (or too far away) to the player it calls an EQS Query in the behaviour tree to find a new point, with line of sight on the player, and moves to that point
Depending on how you want to do this you could generate a circle (“Points: Circle”) around the player (with your desired distance as radius) and the let the bot move to the point closest to it (I think that would be the easiest way to keep a fixed distance to the player but you also may try using a grid).
I would use a trace test to filter by visibility (the context would be the player, so it will do a trace from the point to the player and checks whether it the trace hits something on the way). And for this, in the context you used to get the player you may need to override the “Provide Single Location” function and return the player location there.