I’m trying to create a system that allows distant NPCs to travel around the map at minimal CPU cost, and the solution that occurred to me was to maintain two navmeshes for the world, a high-resolution mesh used for player-observable pathfinding, and an exceptionally low-resolution mesh that allows AI to travel through the world in a pseudo-realistic way without taxing the system.
Is there an obvious way to do this? I’ve been looking through the navmesh bounds volume’s settings, and all I see are ways to alter the brush shape and collision behavior, nothing about the actual resolution of the mesh.
Edited to add: Okay, I’m a moron; cell sizes are changed by editing the actual mesh, not the volume generating it.
That having been said, is there a way to maintain multiple meshes for the same geometry? I basically want one mesh to be detailed enough to let NPCs walk around convincingly, and one to be incredibly coarse, with maybe one node per room/building, so NPCs that aren’t visible to the player can travel the world by plotting cheap paths on the coarse mesh instead of expensive, realistic ones on the detailed mesh.
I’m not familiar enough with this to really give a definitive answer, however It seemed to me that the work of NavMesh is done before hand when it auto-calculates the navigation. In other words it shouldn’t add overhead if it isn’t rendering it in game, like static shadows my assumption (usually wrong) is that once generated that should be it for the render.
In UDK days NavMesh used to take upwards of hours on complex scenes to generate, and I would put in multiple navMeshes for my game because of the size, so that I had nine navMeshes for my large game scene, and I would render one NavMesh at a time (if memory serves). Trying to do all at once then would end up in failure.
However, the new NavMesh isn’t even something we have to render, it is automatically calculated based on changes in your scene and renders it almost instantly. It is one of the best changes in UE4 that I have seen.
I suppose though that if i got into heavy scenes again I might try to stream in and out Navmeshes with different areas of geometry that i have turned off, I’m not sure how this would work out considering the new nature of NavMesh which always updates.
Other solutions -
Maybe another way to have the distant NPCs travel might be in another solution? You could have targets for them, and randomly spawn them start at different locations when they are turned on in their vicinity, and turn them off when they are not needed to remove the overhead of NPCs being calculated when they aren’t even on screen. A trigger could stream them in or turn them on at one of those spots giving the illusion of some randomness of the game. You could store a variable that knows their “last location seen” and then have them respawn there as well.
Another thing you could do if you want to stream them in and out is to save their position through save game techniques, then when you return to the area where you saw a dude chopping wood, he would be there again chopping wood. If you use save game it will save using classes (talking blueprints here) and that way if there are several NPC classes it will automatically save their positions, and reload them as needed.