I have a large, randomly generated world so I am using a Dynamic NavMesh powered by Navigation Invokers. I noticed that performance really begins to take a hit when you have many of these Invokers so I was simply wondering if anyone had any tips to share/knew which settings are most important etc.?
After playing around with all of the Navigation Mesh settings, I was still struggling to reduce their overhead. Ultimately, I have mostly worked around the problem to an acceptable level by altering the Tile Generation Radius around these NPCs based on their distance from the player - NPCs in the distance have a small generation radius, meaning they can still be seen moving and it still gives the impression of life, but only once they’re close to the player does their generation radius increase to what I was originally hoping it would be. It works quite well, but I just wanted to make sure I’m not missing any other useful optimisations.
Random thought, have to tried unregistering those NPCs within a certain area and having a general invoker for that location register and encompass the NPCs so they still move, and have it toggle dynamically similarly to how you have it now with tile radius changes? That way its only one larger invoker dealing with the generation instead of smaller ones all trying to calculate at once? Or did you solve this by other means? Let me know what you think or have figured out.
I did try quite a few different approaches, although I can’t remember if I tried exactly what you’re suggesting. I’ll give it a whirl when I get a bit of free time. For now, I got it working well enough using the method I mentioned - reducing nav generation radius when NPCs are far from the player, and only increasing it once the player gets close enough for it to matter. I think it was just a matter of playing with the values to find that sweet spot between what you want in an ideal world and what’s acceptable, performance-wise.
Right on! It’s not something that I’ve had to really overcome, myself, but I thought about it and that’s the solution that made sense to me. Mainly because sometimes with the lower radius, the AI can get confused with certain obstacles. However, if you’re not having to deal with them getting stuck on everything, then your approach could just be the best bet!
Can I ask which function did you use to change the generation radius at runtime? I am thinking if I can change the radius according to the LOD level of invokers.