Godot Pathfinding Slow? 10,000 Agents, No Frame Spike | Vav Labs Skip to main content<br>Get in touch
Back to blog<br>Interactive demo and data<br>Try the benchmark scene<br>Interactive Godot pathfinding demo, up to 10,000 agents<br>Run the browser version, drag the shared goal, toggle naive versus scheduled mode, and push the scheduled mode up to 10,000 agents in your browser. The native JSON below remains the source for the published benchmark numbers.<br>Open the interactive demo<br>10,000-agent scheduled stretch capture<br>Native 10,000-agent stretch capture for the shared-field mode. It is supporting evidence for the visual scale, not the source of the benchmark numbers.
Moving 10,000 agents in Godot source project<br>Runnable Godot 4.6 project containing the web demo scene, benchmark mode, deterministic blockers, shared field overlay, and native benchmark harness.
Download Godot scene
Moving 10,000 agents in Godot benchmark data<br>Native Godot 4.6.2 benchmark artifacts: scheduled runs from 500 to 20,000 agents, the 500-agent naive baseline, a budget sweep, and stretch captures. Use these JSON files as the source of measurement claims.<br>Native Godot 4.6.2 benchmark - Windows, AMD Ryzen 5 2600X. Narrow evidence for this article, not a product-wide performance claim. Case Average Iterations 500 agents - per-agent AStarGrid2D query p95 4581.507 ms, p99 4870.586 ms, max 5770.735 ms, 100% over 16.6 ms. 670.291 ms median 5 runs / 1,000 sampled frames 500 agents - scheduled shared field p95 6.849 ms, p99 8.190 ms, max 9.956 ms, 0% over 16.6 ms. 2.028 ms median 5 runs / 1,000 sampled frames 1536 field-step budget p99 7.926 ms, max 10.191 ms, 0.0% over 16.6 ms. 2150 ms median field latency budget sweep 10,000 agents - scheduled shared field p95 7.306 ms, p99 8.747 ms, max 13.654 ms, 0% over 16.6 ms. 5.022 ms median 5 runs / 1,440 sampled frames 20,000 agents - scheduled shared field p95 12.355 ms, p99 14.408 ms, max 17.925 ms, 0.14% over 16.6 ms. 9.541 ms median 5 runs / 1,440 sampled frames<br>Download benchmark data (JSON)
The result, up front<br>One shared field moved 10,000 agents in Godot at a 5 ms median frame - 0% of frames over the 16.6 ms budget, measured on an eight-year-old desktop. The same build holds those 10,000 at 77 fps in a browser tab, pure GDScript, nothing native in the hot path. If your Godot pathfinding is slow, this is the optimization shape to look for: reduce path queries per frame before blaming the agent count.<br>Godot pathfinding lags with many agents when too many agents ask for a path in the same frame. I measured it. Five hundred agents, each calling AStarGrid2D.get_id_path() every physics frame, produced a median frame of 670 ms - and a worst sampled frame of 5.7 seconds . Swap those 500 per-agent queries for one shared field the whole crowd reads, and the median dropped to 2 ms , with no sampled frame over the 16.6 ms budget. Same agents, same machine, same goal.<br>That is roughly 330x lower median frame time for the scheduled shared-field approach in this measured setup: 670.291 ms down to 2.028 ms.<br>The win was not a faster solver or a clever movement trick. It was changing the shape of the work: instead of 500 agents solving nearly the same problem every frame, the scheduled version builds one piece of shared movement data over time and lets every agent read from it.<br>The 500-agent problem was never too many sprites moving. It was 500 repeated pathfinding queries landing in the same frame.<br>500-agent native benchmark result ScenarioAgentsMedianp95p99MaxOver 16.6 ms Per-agent AStarGrid2D query, every frame500670.291 ms4581.507 ms4870.586 ms5770.735 ms100% One scheduled shared field5002.028 ms6.849 ms8.190 ms9.956 ms0%
Benchmark setup<br>This is a native deterministic benchmark, not a browser timing claim. The browser demo is the visual artifact; the JSON files are the measurement source.<br>DetailValue EngineGodot 4.6.2-stable OS / CPUWindows, AMD Ryzen 5 2600X Grid256x256, 16 px cells Agents500 moving 2D agents Goal scheduleFixed scripted goal moves Frame budget16.6 ms Run typeNative deterministic benchmark, no input Source databenchmark JSON and budget sweep JSON
What counts as an agent here<br>An agent in this benchmark is a moving 2D unit with a position, a per-frame movement step, and a target it needs grid direction toward. Five hundred of them advance every physics frame. They are not sprites being slid along a precomputed track; each one reads the navigation data and moves itself.<br>The detail that makes the fix possible: they are not solving unrelated problems. They are a crowd heading toward the same goal area. When 500 units want to reach the same place, the system should not compute 500 separate answers to nearly the same question.
Why Godot pathfinding lags with many agents<br>Godot is not slow because 500 things exist on screen. The spike shows up when the code asks the pathfinding system to do too much repeated work inside one frame. The naive version is the one almost everyone writes first:<br>It is easy to...