I’m developing an online game with an authoritative server. Unity/C# is used for the client, while the server is pure C#.
At the moment I’m using Unity’s navmesh and exporting it to a file that is then transformed to the topology (multipolygon + connectivity graph between reflex vertices) I’m using on the server, using my own A* implementation.
The actual A* is optimal and very fast, but unfortunately the topology doesn’t offer much support in terms of actually connecting start and endpoints to the graph, making this step more costly than the pathfinding…
This is why I’m considering moving to a navmesh based solution, even though navmeshes to the best of my knowledge don’t provide for an optimal solution because path lengths aren’t comparable until string pulling has been performed. (You can of course perform string pulling each time you expand to a node but that would be way too expensive I believe?)
Anyway - I see that source code is included here - and I wonder if it would be feasible to try and make A* Pathfinding Project work without Unity? How deeply ingrained into the codebase are Unity objects? Is there a core of non-unity functionality I could use?
I could of course just download the free version and check for myself but if someone has experience with something similar I would love to hear about it.
This is not something that is supported out of the box.
The navmesh and pathfinding is not that tied to Unity functionality, but large parts of the codebase use Unity classes such as Vector3 and Mathf so while it is not hard to write replacement classes for those, it will take some time. You can search this forum, there are a few other users that have had the same goal. Potentially one can try to use the unity dlls which can be found in the Unity data files. That should probably work as long as one only uses standalone math related classes such as Vector3, Rect and Mathf that are implemented purely in C#.
There is an algorithm called Any Angle A* (or Theta* I believe) which is a bit faster and calculates optimal paths even on navmesh graphs. I have not implemented it in this package however as it would require quite extensive changes.
Thanks for info and for the tips - I’ll have to try it out. Even if it’s less feasible to try to separate it than rolling my own perhaps it will still make sense to build the navmesh using your package and then export it if it offers substantial advantages over Unity’s Navmesh bake. (Access to all parts of the navmesh structure and navmesh as gameobject already seem to be nice enough to warrant it - source code access opens up other possibilities).