Support Forum

Big 2D Static Map - Performance

Hi there!

I’m having a big map with a Grid Graph 1000 x 1000 nodes, up to 49 AI Seekers (dependant on how many real players are playing). So if only 1 real player plays, he has 49 Enemy Bots in my 2D Game.

I’ve experienced somehow that the System is really slow finding waypoints and all in all works slow, the more enemies are on the field.

What can I do to improve performance? My AI-Enemies don’t need to evade each other, my system is made so that every player can walk through each other. Therefore my map is fully static, there are no collider changes during runtime, so basically the map stays the same from the beginning on. Should I reduce repath-time? Reducing the Node-Amount and making the “tiles” bigger? Will it make the performance better to have 800x800 nodes? My bots don’t really need to go into buildings, they could also just stay outside, doesn’t matter. Which other values I can switch off to increase performance? I reduced the AI to search nodes around the search-point from 100 to 25 → is this better or worse for the performance? I see the performance improving much more, as enemies kill each other and die (it’s a battle royale, so enemies get less by time) because they are simply becoming less AIs to be calculated. Are there any update-rates on the paths I can reduce? Something? I really need just standard calculations, bot simply have to move from a to b, I’m not using anything else from the asset.

As said, the AI doesn’t need to check it’s way once it has found a path, as the colliders and nothing changes. Using more cores in the Grid-Settings decreased the perfomance much more, this didn’t help. I thought of splitting the map into 4 smaller graphs, but I’ve read in the forum that this also affects performance negative.

Please help me, my bots really behave shitty like that…

Maybe you should check the beta like Aron suggests here: Why is it cutting it so close? - #6 by BlueGooGames

Also can’t you maybe disable bots that are far from players or cheat a little, like small or lesser updates that players can’t notice?

Hi

A 1000x1000 grid graph is very big, so pathfinding will not be that fast. You can use a recast graph which is usually better for large graphs, or you can use the “heuristic optimization” options if your map is truly static (see Heuristic Optimization - A* Pathfinding Project). It is controlled using A* Inspector → Settings → Heuristic Optimization.