I’m starting to develop a type of strategy game in which I will rely a lot on non-humanoid npcs. I plan on having around a thousand of them running around a big scenario. Sometimes they will chase other npcs or players and also run away from enemies. The scenario will not have many details; it will be made of parts, and I will not add too many obstacles. But I plan on adding some regions where the walk speed is reduced (forests) or increased (roads), and it would be interesting for the algorithm to take these regions in consideration.
So, the issue I’m concerned with is performance. Would it be more optimal to use the built-in pathfinding service or to create my own pathfinding that precisely meets my needs for this game?
If you’re doing a tile-based game then making your own would probably be better, because you can work under the assumption the game is on a grid and remove unnecessary parts of the pathfinding
its not tile-based, i was thinking about using the visiblity graph method, also some elements of the scenario will be dynamic, so maybe its better to just use pathfinding service, but anyways, i will try to make my own algorithm then i will compare the performance of both
The hard part about pathfinding is getting the data for it. Other than the pain that can be, a custom pathfinding implementation can give you a lot more control and plenty of room for game specific optimizations. In terms of raw performance, the default one will almost certainly outperform yours in an equal fight. The reason you would make a custom pathfinding implementation boils down to either you can really optimize parts of the problem away if you want speed. Or if you want to be able to do stuff with the map that’s more complicated than shortest path from A to B. If you simply need enemies to follow players then roblox pathfinding will probably work well for you.