A* Pathfinding Project

Pathfinding Flow


#1

Hi!

I was wondering if there was a way to private PM you video of my issue. I have an issue where I Instantiate a lot of enemies and they are not following the player in a smooth manner. I have to build the project to my iPad to test because my computer is older and cannot handle that many enemies on screen. I would try changing values but changing and building everything takes forever. I just wanted to see if you could quickly recognize the issue.

I would just be randomly guessing at this point as I have already tried changing some values.

Thanks!

EDIT: I feel like it has to do with the RVO and that is just intended behavior, but I am not sure.


#2

Hi

You can upload a video on some site (e.g. youtube) and post the link here.


#3

True. I was thinking of something else as an issue. Nvm sorry.

https://www.icloud.com/iclouddrive/0lnFiZyDZ85ga31wzNWYQGoRg#RPReplay_Final1555528763

https://www.icloud.com/iclouddrive/020oNVLCkBbwmNYlb5R6e13pg#RPReplay_Final1555528545

Here are the videos on iCloud.

What settings would you like me to SS?

Thanks!


#4

Hi

So with ‘not following in a smooth manner’ I assume you refer to the fact that they sometimes seem to ignore the player entirely and just continue trying to move to a point where the player was before?

Also. If the videos show sort of the behavior your are looking for in your game, you may want to check out boids. They are a more lightweight alternative (compared to rvo) which is often used for simulating flocks of birds or groups of fish.


#5

Yes, the video where the enemies are in the room and they all go to the corner and seem to stick there until I move to a specific location for them to start chasing me again.

I guess my next question is then, can your asset provide the necessary functionally I am looking for? If not, do you sell an asset that does or do you have a recommendation?

My goal for the enemies is to smoothly follow the player, avoiding obstacles and themselves all while the player is able to dodge them. Also have the ability to go through small spaces such as when they filter into the room.

Thanks!


#6

Hi

So there are a few different cases that could be the issue.

  1. The repath rate on your agent is set too high. Try lowering it so that they recalculate the path more often. For this case you can probably use 0.5 to 1 second.
  2. The pathfinding system is overloaded due to too many path requests. Try to increase the number of pathfinding threads (enable multithreading and set it to AutomaticHighLoad). Alternatively you could use a custom movement script together with the FloodPath path type, https://arongranberg.com/astar/docs/floodpath.html, however this requires a bit more code from your side, however that would be very fast (essentially only one path request for all your agents instead of one per agent). You might also want to reduce the resolution of your graph. If it is too high then path requests will be slower than necessary.
  3. Something else in your movement code that is causing some strange issues, hard to say for me.

Note that for the smoothest movement one will likely have to add some control theory to the mix.

If I would write the code for this, I would start with a completely new script and use the FloodPath to calculate the paths from every tile to the player, then I would make each agent move along it’s locally best path (found using the FloodPathTracer class) towards the player using some force based approach. I also think boids might work better than RVO in this case, but that depends on the behavior that you want. Boids is not as good at preventing collisions between the agents, but it does usually give you smoother movement.


#7

Thanks for the information! I gave your asset 5 star in the store.

(I have my repeat rate at 0.2 so that wasn’t the issue :frowning:)
(Also I had all the multithreading settings on max)
(I am using AIPath, I don’t have any custom movement code)


#8

It’s strange because sometimes the paths seem to be calculated very quickly, and sometimes it just stops. It would be helpful if you could run the game in the Unity editor so you could see how often the paths are updated.

Also. Make sure that you are using a recent version (4.2.4+) as there have been some performance issues with RVO and IL2CPP and some recent Unity versions.


#9

Here is a good video of the issue.

https://www.icloud.com/iclouddrive/0xuqc1DzB4MWVyuPY8PaQanDA#Screen_Recording_2019-04-17_at_4.00.00_PM

I can see where the pathfinding stops.

Also another issue I have is enemies going through walls. You can see near the end of the video an enemy goes through the wall. I probably can use my current setup for enemies if the pathfinding doesn’t stop.

What kind of information would you need to debug these issues? I can SS any settings you need.

I am also upgraded to the latest version.

Thanks!

EDIT: I did some more testing and it seems like if I go into any corner with even 60 enemies they will stop pathfinding for a bit.


#10

Hi

This is very strange. Would it be possible for you to share your scene with me so I could test it and debug it?


#11

I sent you the file via pm! (after it finishes uploading)


#12

Hi

It seems like this is a bug with jump point search. When debugging i found that sometimes it would fail to find the target and would instead have to search every single node it could reach. Those path requests, while rare, took about 200 ms each (more than 100x slower than normal path requests) which caused all other path requests to be delayed. After I turned off jump point search I could no longer replicate the issue.


#13

Thanks for looking! I will turn it off until its fixed!