Questions about Examples and Project in general

I have some issues with the examples.

First the examples say to use “using %Pathfinding;” but that throws and error and doesn’t work. Using “using Pathfinding;” solves the problem and I suspect it is a typo, but it is listed in all the examples I can see.

Second, I added the Capsule and copy/pasted your script for step two where it follows the path. I have a seeker script on it and character controller, and it draws the correct path, but it just falls straight down -y forever rather than travelling the path. It is on 0y and target is on 0y.

I deleted the capsule and tried it again, following it step by step and it does the same thing.

That’s what I ran into so far doing the example.

I also have some questions in general.

How fast is this project compared to writing my own A* algorithm and eventually tweaking it. I see your code is up to 20,000 lines or so, but it has been optimized for a long time now.

Finally, I am looking at making a tower defense similar to Kingdom Rush style, top down 2D where you have a sprite as your ground" and there are roads that mobs will travel (with AI to walk around other mobs), in some rare cases new roads may show up in the middle of the map opening up a new path for spawns.

Hello?

Hi

Sorry I took so long to answer, I had written an answer, but apparently I had failed to press the “Post Comment” button, so it was only stored as a draft, I discovered it a few days later.

Which examples show that?
I use %Pathfinding to tell my documentation generator to not add a link to the Pathfinding namespace (otherwise it does so automatically), but it shouldn’t show up in the result.

Are you sure you have ground below the collider?
If you have, make sure that it is place above the ground at start and that the layers can collider (see Project Settings -> Physics ).

This project is relatively fast. If you would write it yourself and you have very good knowledge of pathfinding, you will probably be able to get it to run faster since you can optimize for special cases in a way that I cannot (for example I need to support grid, point and navmesh graphs instead of just a single graph type). Multithreading however is hard to get right, and I think I have a quite good solution in this project.
Almost all of the code is for generating graphs, updating graphs, movement code, etc. very little (comparatively) is the actual pathfinding logic.

Note that in general, pathfinding works best on static maps or maps which change relatively slowly, or in far apart discrete steps. When you want to avoid other moving agents (mobs), then local avoidance is more appropriate.
That’s not to say that the system doesn’t support moving obstacles though, it does. Check the demo scenes. It is just that it isn’t the best solution when dealing with a large number of other agents which are also pathfinding.

I ended up figuring out the first two issues. I removed the % and it worked. The examples in the Getting Started and everywhere else I looked had the %Pathfinding. It didn’t make sense and but it was in all the examples so I left it that way for a bit. I ultimately just removed it and it fixed it.

As for the ground issue, I had to make the y of the capsule be 1.0 or higher, it would then climb to 1.08 and move along (which I believe is because of the skin thickness) but at 0 and anything below 1.0 would cause it to just fall down y and go no where else. I double checked the tutorial and everything said y should be 0, took me a bit to figure this out as it was confusing.

I did end up getting it working, but being new to Unity it was really confusing. Once I got over these two hurdles, it was really easy going through the demo.

What would you suggest for doing something similar to Kingdom Rush, where there is a known path with set obstacles (side of road) but agents coming down (5-100ish at a time) coming down the path but need to be aware of each other.

I only played with the grid example, was thinking navmesh one would be more suitable for the main road path finding, but haven’t gotten far enough to figure out how to change a selected path if someone walks in the way.

I am using 2D, with a sprite as the bottom plane (and what would be the full map; 1 screen full). Would I use emptygame objects with polygon colliders to mark off the unpassable areas? Then remove the colliders that represent the paths that may open up mid game (this is a rare scenario, but does happen once and a while).