I have in goal to make a sort of 3D RTS style of game which would require hundreds of AI navigating the map.
I created a 600 x 600 plane and then wrote a script to randomly scatter 500 five meter cubes on it as obstacles, bake a navmesh and then randomly scatter 100 NavAgents, all with the goal to reach Vector3 . ZERO as a way to test performances. I then used the following code to make them move:
func move(delta):
nav_agent.set_target_location(destination)
velocity = translation.direction_to(nav_agent.get_next_location()) * speed
self.translation += velocity * delta
I have a pretty beefy PC yet FPS drop at around 25 FPS as soon as navigation starts.
All of the settings are set to default in regards to navigation agents. I tried this on Godot 3.5.1 and Godot 4.0beta5 and it yields the same result.
Am I doing something wrong? Is there a better way to go at this? Surely the navigation server should be able to handle way more than this or maybe there is a way to optimize it. Is there any source of information on how to handle navigation for large amounts of agents in Godot? If old games like Age of Empires and Stronghold could handle multiple hundreds of NPC pathfinding then surely Godot has a way to do it, right?