I’m currently learning about AI behaviour trees and created a simple tree walks around and attack all targets.
Right now, that it somewhat working however its looks very “forced”. This is due to there being multiple AI that all follow the same path or atleast have the same target. So they all walk up and want to attack the target at the same location even though there are better places to attack, this is obvious as I havent told it anything more than go here and play this animation. I’m struggling to find a way to add this into the AI.
I’m wondering if there is a way to add some varience to this action, I increase the acceptable radius and tired to play around with the overlap setting with the target actor but got no luck.
One method often used for enemies is to add “slots” on the targets that the enemies occupy. Means you can prevent too many enemies from attacking the same target.
Hi, one basic way to add more variance would be to let your AI not all move the the same location (the target actor), but sample a location in a random radius around the target and let your AI move to that location instead or to go even further from that, maybe use an EQS query to sample a location around the target and let it move to that (but I would start with a random location to see that it works first).
Of course then you need to check on a timer, that the location the AI is currently moving to is still close enough (whatever “close enough” would be for you) and if not, then run the logic again to find a new location (so basically manually do there what MoveTo actor does under the hood).
You could even think about first sampling a location in a larger radius around the target and once the AI reached that location, let it move to a closer one.
By the way, if what you store in your blackboard is of type actor, then you can set that in the blackboard and then directly access it via GetBlackboardValueAsActor. There is then no need to get it as object and casting it to actor.
Sorry for late response took me some time to work this out. Thanks for the advice, I created those attack point around the element so when they are there it looks a lot more natural.
The route to the path is still quite stiff but I’m getting there. I’m looking into that Envionment query system but might be a bit to advance