I’m currently working on making AI automatically walk around and interact with objects in a procedurally generated and dynamic world (Already implementated a 200x200 grid using Cellular Automata, that gets model assignment before splitting up into chunks of 20x20 instances so performance doesn’t drop when creating/destroying an instance vs having it be one huge instance array) , and have been using Find Path to Location Sync in order to both get points of a path to see the AI’s current travel destination, as well as the very important validating that the AI can indeed reach a target object’s location pulled from an array.
All of that seems to work well until I create or destroy an object/wall tile that causes the navmesh to update, which causes the FPS to drop to insanely low levels until the navigation is done generating. I’ve pinpointed it to the Find Path to Location node, after cutting that check out and just simply having the AI move directly to the object (placing or destroying an object/wall during the standard AI move with out the Find Path to Location doesn’t cause a performance drop at all)
It’s been pretty frustrating as my game right now is completely reliant on whether or not I can get the Find Path to Location node to function for validating reachable objects and displaying the AI’s paths. I did try using the Is Navigation Being Rebuilt bool as a hackmethod to skip the check if true, but it seems even that doesn’t properly function in shutting off a Find Path to Location in time.
I tried as a manual way to control when the navigation mesh will regenerate using the Initial Building Locked option in Navigation System settings, but there seems to be absolutely no blueprint option to ReleaseInitialBuildingLock() or something similar in manually turning on or shutting off dynamic updates for the nav mesh.
Attached is the segment in question that causes major performance issues while the navigation mesh is being updated. Removing the FindPathToLocationSync and check eliminates performance issues although will completely break things as it’s the only real way I can find so far to validate manually first that an object is indeed reachable before ordering the AI to target and move to it. Frustratingly, a MoveToLocation works just fine by itself but seems to have no way of pulling its path points from it.
Any help/suggestions/input would be much appreciated on the matter! I’m about this close to scrapping the navmesh system and floodfill the grid area for validation.