Avoidance for turn based combat system

The game i am workin on is a sort of xcom type game, without any grid system.
I try the 2 avoidance system on ue4 rvo and detour.

Rvo works good but i am afraid it’s not what i am searching for.
Even detour is not working good, i try with 2 troops one still and the other moving and it works, but when i try to avoid 4 unit in row (those immoble) it will fail.

In any cases i don’t think this could be my option, i also need to show the path with a spline and as far as i know those type of avoidance work on real time and based on distance to obstacles.

Recast can recreate it self every time an acotr move, but i saw that this won’t happens on actor/character.
Is there a way to let it recreate even on character movement? Do you think it could be a good idea use this type of “avoidance”?
In any cases if you know a better solution please let me know.

It seems that treating characters as obstacles and rebuild navmesh on characters movement would get you what you need. And it’s supported :smiley:
All you need to do is to make sure you have runtime generation of navmesh enabled, and your characters have bCanAffectNavigationGeneration set to true. Of course Characters need to have any kind of collision component for it to work.

Cheers,

–mieszko

EDITED.
Sorry i read it before but did not fully understand the answer!
Now everythings is clear.
Thank you so much!

I partially solved my issue. Now the navmesh is currectly regenerated and the controller count as obstacle, but they have really strange behaviour during movement… Random yaw rotaytion, frequently change of path and they took really long time to reach the destination. Is there a way to fix that?

I can’t really way without more information. A video with all possible debug drawing enabled would be ideal. If you don’t want to share it publicly just send me an email at mieszko.zielinski at epicgames.com

Well is very easy to replicate i just took the “top down project” (default) and changed “RecastNavigationMesh” enabling rebuild at runtime and set true Can affect Navmesh generation on MyCharacter.
Then run, you could see that when you just click (not hold) in a position the char seem not be sure where to go and begin to do many small rotation before start walking. Also when you pass near an obstacle of the example map it will take a lot try before avoid it…
I can provide a video but i think you could just do those modifcations to see the behaviour.
Just a note in my project i use AiController for that but it does exactly the same.

Sorry for my bad english!

I’d appreciate a video very much. Any time I’d use up setting up even simplest repro-case is time I won’t spend fixing engine AI bugs and adding awesome AI features :wink:

Ok i will do it, any “debug” feature request?

So i created a video, i am sorry for the low quality of it but i did not check it before upload…

I created a test project for you (i can even send it) just to show the behaviour of the ai, if you took a look on minute 0.16 you can see that the char (the small cube mesh) is below an obstacle and when i click above of the obstacle the pawn start moving in a sort of random movement before reaching the point.
This happens ONLY with navmesh rebuilt in runtime and Can affect Navmesh on the char.

This is our first project on UE4 we came from a different engine, so i don’t have any experience on that. Probably is my fault but i cannot understand what i am doing wrong, i also try to draw the line of the path but i failed as my line won’t show :frowning:

If you need any other infos please let me know.

I hoped you’d at least show navmesh debug drawing on the video (console command show navigation).
Anyway, my guess is that the jitter is caused by AI getting multiple paths in short span of time: first one when the move is requested and following ones on every navmesh update.

In general it’s not recommended to have characters affect navmesh if you have dynamic characters. If your characters cut holes in the navmesh, and move around, all the time then navmesh gets rebuild all the time as well.

So, why do you need your characters to affect navmesh again? Maybe you want a kind or avoidance instead? If so look for information on UE4’s RVO and Detour Crown integration.

–mieszko

In this project i must show the path before the confirmation (xcom style for example) and as far as i know RVO and Detour are realtime avoidance, so the path i show before won’t match the real path.

I don’t really need that my char recreate the navmesh every movement (as there will be just one moving char per turn) i need the navmesh to recreate when the char stop. Is there a way to do this? A function to call to do this?

P.s.
Detour failed to avoid 3 char still side by side.

Whether your character affects navigation can be controlled dynamically with Pawn.SetCanAffectNavigationGeneration function, so all you need to do is call it with true when AI stops and false when the character starts moving.

Finally got it. Thank you so much!