Using pathfinding outside of Unity

I have read into pathfinding over the last couple of months as it has been a high priority for what I move to working on next. I have currently been building out a game development architecture framework for a platform I am working on as well as an MMO framework for seamless worlds, which works with any socket engine, for my company’s game projects.

I have pathfinding marked down on my work schedule for next week but after coming across this while researching I decided to post a thread before I got stuck in so that I had answers waiting for me; that is how I came across your thread.

The initial plan was to build out my own multi-threaded A* pathfinding solution in C++ to work alongside my MMO framework (and with the seamless world zoning module I have built) for lightweight, fast pathfinding for servers to make use of.
After coming across Aron’s project, it has had years of work put into it and he provides source code access; so, my mindset is that it would save me more time to re-write his work rather than doing everything from scratch myself and re-inventing the wheel.
I intend to make a decoupled, modular pathfinding solution so that it can be used in anything with no extra work (singleplayer or online games, with any engine - Unity, Unreal Engine 4, independent servers, etc).

I will likely be looking into using Recast for the C++ port of the project, so maybe I can help with looking into why you are having trouble getting it to read your verts/indices/layers to get a good path.

In terms of the tag issues for your water, I am not sure how much interest I have in that for what I intend the pathfinding to be used for but I don’t see why I wouldn’t want to be able to define separate navigation paths for different types of objects/characters; therefore, it would likely be something I would build into my adaptation, it is more of how much of a priority it will be marked at rather than whether or not I would implement a working solution for this.

In terms of directly using Unity’s navmesh data - I will have to take a good look at what he currently does and see if I can decouple it so that it is modular for coupling with any navmesh data (with an interface or wrapper to achieve this). If it would result in being too much time wasted, I will likely stick to just using Recast instead.

As I have implied from the above, so far I haven’t gotten started on implementation yet but plan to very soon, and I know how I want to go about it. Once I dive into the source code, I can plan from there what my roadmap will look like.

Hi

Tim, if you are going to read through the sources you might want me to send you the bleeding edge stuff. In my dev version I have taken some measures to improve readability such as enforcing a common code style throughout the project (using uncrustify) and split some very large files into smaller files.

Hey Tim!

That sounds great! You seem to be as ambitious as I am about getting a pathfinding solution to work. I just wanted to clarify that it wasn’t necessarily that I was having trouble feeding my data into Recast. I filled out the struct’s as needed and the problem was that it would fail in a few different ways, depending on what I did:

  1. give me a straight path to the destination as though there were no obstructions,
  2. segmentation fault during pathfinding (I found out that it was decoding PolyRefs without verifying them first, for speed purposes.)
  3. take me to somewhere on the other side of the map; totally crazy result

A* Pathfinding will not fail like this. I get no irrational results. If the scan speed turns out to be really good then my only issue will be with borders along different TAG IDs. I do not want to make water impassable. If you make it impassable or don’t even have water, then you’re all set. :smile:

Aron, if you’re reading this, I have a question about how navmesh tiles work again, if you don’t mind :smile: I think I figured out how to detect tile “grid lines” from raw vertex data from Unity. I can see, for example, that one of my maps has lots of vertices every 102.40003 units (so 204.80006, etc). This makes sense because I counted around 97 tiles across for this 10000x10000 map. So, do navmesh algorithms like yours and Recast expect, in this case, vertex information fed into a file to be in the range of 0 - 102.4? So, if I grabbed tile (x=7, y=4), I would clamp the vertices to the beginning of the tile and start at 0 again and go up to 102.4? And (x-8, y=4) would share the same RIGHT vertices from 7,4 but 8,4 would start with 0 again. I’m still considering generating navmeshes with Unity but then using your engine to pathfind.

Hi

Mine at least is still using world space. There are however some assumptions that the system makes about the nodes inside the tiles. For one, that all the nodes are actually inside the tile bounds and not spread out all over the map (if that doesn’t hold, it may not be able to determine the closest node to a given point accurately).

So I just stumbled across this thread while looking for a way to add path finding into a MMO that I am working on and was interested in the result’s you had.

How much coding experience do you think I need to understand enough about this to do what you have done and re code enough of it to work with unity?

I have been scouring the internet looking for any kind of guide to setting up even a basic AI path finding for my game.

I have some experience working in Java J2EE but that was only for basic GUI, communication between clients and server as well as basic database connection so nothing as complicated as behavior trees and AI but that’s what this project is for.

Hey Paul. Congratulations on getting it to work. Is there any chance we could get in touch? :slight_smile: