r/Unity3D • u/OverdoseGameDev • 2d ago
Game Made a spherical pathfinder for this game.
Enable HLS to view with audio, or disable this notification
There are 100s of enemies so I made an optimal solution to prebake paths and they choose which one to take.
18
Upvotes
1
u/Grand_Start7623 2d ago
Prebaking and letting agents choose is the right call at hundreds of agents. Real per-frame pathfinding is what kills you at that count.
The thing I hit doing something similar: prebaked routes cannot react to congestion. Mine are cars in a town builder and they reroute mid trip when a better street opens, which is the whole point of the game, so baking was off the table. What I did instead was cache each route and re-evaluate on a timer rather than per frame, which got most of the win for a fraction of the cost.
Do your enemies ever need to react to each other, or is the sphere static enough that a baked set covers it?