A* Pathfinding Project

RTS game pathfinding


The burst mode doesn’t support obstacles?


I was using Funnel Modifier component and it had a strange effect of making the pathfinding ridiculously expensive.


Is it the funnel modifier you are profiling in that screenshot?
Note that the RichAI component doesn’t need the funnel modifier and will not use the result of it. It already has its own internal funnel modifier which is more optimized for that use case.


Yeah. I figured as much.
But how about the obstacles? Are they not supported?


No, they are not supported yet. It’s a bit tricky to implement them with burst, so I pushed out the RVO burst update before they were completed.


You plan to implement them however?
How long do you think it will take you to implement them?



I do plan to implement it, however I will not have time in the near future. I’ll be away for a little more than a month from Friday.


Having the AI selected in playmode throws NotImplementedException.


also how to avoid this


Hey, currently there is no formation system in the RTS demo.
You can either use RVO to have the agents avoid one another.

Or write some custom code for all the agents to find their own destination,
linking a response from Aron here from a similar question:



Sorry for the late answer. I am currently traveling and I lost my laptop on a flight, so I haven’t been able to work for a while.

Oops. Indeed it does. You can safely ignore it though. I think the inspector should still be usable and the exception should not cause any problems other than being annoying.

Do you have the “Automatically Stop When Destination is Crowded” option enabled on the AIPath script?

Something else that is very helpful is to pick individual destinations for every agent. You can do this with: https://arongranberg.com/astar/documentation/dev_4_3_5_58efaa48/pathutilities.html#GetPointsAroundPointWorld (I really should add an example for it though).

Considering to buy, but have few questions!

Strangest thing is that I had this working a whole lot better when I was using RTS beta version 4.2.8.
I did not write any code for this kind behaviour and was just following your examples.
This is a clip of when I was still using the 4.2.8, and you can see its working a lot better

My only real issue with the 4.2.8 were some performance issues (which do seem fixed now). To be honest, I really didn’t expect the upgrade to 4.3.4 to be so drastic. Like with deleted components and all.

I tried tinkering with the RVO to see if it has any effect, but I think it just made it more crazier.

Looking at your RTS example closer, I think you’re doing your self a bit of a disfavor by using circles, because you cannot see their rotations very well. After adding some models details to the RTSUnit prefab, I think it’s pretty clear that their rotations are pretty frantic, even in the example.

Here’s the configuration I’m using


Strange thing occurs when you hotreload scripts in playmode. The pathfinding starts to be super expensive. This is particularly annoying because our game supports hotreloading.
This bug appeared after upgrading to the 4.3.4, which uses burst. Maybe you’re now somehow storing data staticly, which doesn’t get cleared up on OnDisable.
I find this to be bit troubling, because it might also happening when reloading scenes?