Automatic Waypoint generation (from NavMesh)

Hi all,

i am trying to port a solution i built for Unity and another engine to UE4. Basically it creates two kind of Waypoint-Graphs, one dense graph for local spatial tactical decisions and another skeleton graph of the walkable area so i have spatial knowledge of what “corridors” are blocked or how to split troops to block open corridors and the like. Very valuable spatial knowledge :slight_smile: This screenshots show the basic results. Since they are simple graphs i can also easily build cheap heat maps and the like or query the graph for places to be defended to prevent breakthroughs. Also flanking tactics and the like are a easy to create and run this way. So it is obvious why i want to port that?


So now to my problems…
I am just starting with unreal engine but i have to make sure this feature will work so i have to dive into the hard stuff right away.

Short description of my current problem:

I need to pass data during the NavMesh-Creation Process. So i have to change the engine-sources. I found the part in RecastNavMeshGenerator.h and i was able to add a UPROPERTY to RecastNavMesh.h to reference a AActor. During the Recast-Tile-Creation Process i now know that there exists a property set to some AActor (or not).

So now in my project i would need to have a AActor subclass which could handle rcCompactHeighfield (a recast class) and spans, cells, constants of recast. AND the recast part i described above would have to know about this AActor subclass and that it is able to handle a rcCompactHeighfield as argument so that it can pass it over.

So basically how could i possibly pass over data from changed source code files like a RecastNavMesh over to a project class or how could i approach this in a proper way?


I ended up creating a AActor Subclass (AZecastProcessor) and add it to the source in /Runtime/Engine/Classes, /Runtime/Engine/Private. Then i changed the source of RecastNavMeshGenerator and subclassed FRecastNavMeshGenerator to hold a weak pointer of AZecastProcessor. I also added a UPROPERTY in ARecastNavMesh to hold a pointer to AZecastProcessor. So now i can subclass AZecastProcessor in my Project and add it to the scene and select the RecastNavMesh and assign it my AZecastProcessor in the editor. I changed the RecastTileGenerator to call the AZecastProcessor if it exists and hand over each rcCompactHeightfield for further processing.

Don`t know if this is a sensible approach but at least it works and now i can start my processing of the heighfield to eventually in the end i will get my waypoint-graph like in Unity :slight_smile: