Guys I need to have 4-6 enemies to surround a Player while attacking him, but currently, only those one or two Enemies getting to him first are doing actual attack. Others are just struggling to get to him stacking behind each other doing some ugly sliding. I tried turning on RVO avoidance with radius of 500, weight 0.5 but they still just slide and slide. Please help!
Hi, did you try crowd avoidance?
Do you mean I have to use Detour Crowd AI Controller instead of standard AI controller? Nope. I will try.
Ok I reparented my AI controller class to Crowd Avoidance one, but it didn’t seem to change anything much. Enemies still clump behind each other… or should I tweak some parameters too?
There is also some setting to allow crowd avoidance to resolve collisions, don’t know whether or not that is enabled by default though.
Additionally it might be better to not let all your AI move to the player, but to a location near the player (e. g. predefine X locations on a circle around the player and choose a random one for each AI, or just choose a random location in a certain radius around the player and move to that). Since the player can be moving you would then constantly need to check that the location the AI is moving to is still close enough to the player and if not, update it (basically the same that MoveTo with actor does, there you also have a “tether distance” and when the actor the AI should be moving to is too far away, then it will update).
To get good combat behavior, you need to be a little more detailed than just “move to actor.”
For example, you can have a per-actor “enemy attack position” subsystem (component / blueprint / whatever) that allocates one of six optimal positions, and each enemy that wants to attack picks the closest-available “slot” to move to.
You’d then get the world-position of the allocated slot, and move to that position as your AI move to target.
Once an enemy dies, or runs away, or is generally too far away from the slot after having been “in” it, the slot system would have to make the slot available again to whatever enemies are available.
So, some kind of function on your player: “AllocateAttackSlot” that chooses one for a given monster, and remembers the monster in question (or returns “no slot found”)
Then some kind of notification from the monster when it dies to free up the slot.
Then let the monster AI chase the position of the slot, and attack the player when it’s close enough to the player AND close enough to the slot position.
Thanks a lot man, I’m relatively new to Blueprints but this sounds doable to me! I will try it definitely!
This sounds fantastic though might be a bit advanced for my level of blueprint knowledge, so first I will try to not move to Actor object but rather to some random point in navigable area with some radius around my player (as Chrudimer advised). If it will not work as expected I will try my best to set up that awesome multi-slot system you’re suggesting. Do you by any chance know of any tutorials or guides on how to set up such system by the way?
I know of no tutorial for that – it’s such a specialized feature that there’s probably not a lot of people who had that problem, and then developed a solution, and then took the time to write a tutorial.
I’ve seen some “guard” behavior demos in the past where three guards would cluster around a single “VIP” entity, but I can’t recall where I saw it. Might actually have been some other system, like Havok Physics, so that probably doesn’t help much.
@jwatte No problem, makes sense. In theory, even enabling RVO on my enemies should have had some positive impact, but weirdly enough it didn’t. Ok I will continue digging and searching materials. Thanks a lot for taking your time and giving advise anyway!