#Significant performance impact when NavigationAgent3Ds bunch up

11 messages · Page 1 of 1 (latest)

dawn saffron
#

i have a whole bunch (50+) of NavigationAgent3Ds in my game that are constantly navigating towards the player (nav.target_position = player.global_position).

This performs fine, except for when they can't seem to navigate directly to the player and get bunched up.
example: when i jump on a block, everything's fine until the enemies start bunching up around it, then my frames plummet to 3fps. when i jump down again though, it's smooth as butter after a second.

Can anyone give me some ideas on how to fix this? Any help would be appreciated.

pseudo dune
#

bunching up is a physics performance hazard, it does not affect pathfinding, and if enabled nly theoretical affects avoidance.

#

Do you have navigation mesh on top of your "blocks"?

#

If yes all your agents will search through far more navigation mesh polygons than usual trying to find a path to the disconnected navmesh on top your blocks.

#

Basically everytime you jump on such a disconnected navmesh islan suddenly you experience the real pathfinding cost of your navigation mesh. Because when a path is reachable your pathfinding will do exit as soon as a path is found hiding its cost. If no path is possible it will search everything that is connected until it finally gives up.

dawn saffron
pseudo dune
#

if your enemies will never have any ability to jump on top of such a block and your player also has no movement done by navmesh you should remove the navmesh on top of those blocks.

#

the way to get things more performant is to reduce the number of navmesh polygons.

#

how you do that is your own project science. E.g. if you use grid tiles for your world merge those flat polygons. if you have many small polygons due to very detailed geometry add simpler geometry, so less polygons are needed when baked.

#

like that entire flat surface in your image could be done with 3-4 polygons, but if it is done with a gridmap is is likely a few 100+ polygons.

dawn saffron