A* Pathfinding Project

RTS game pathfinding


In your example scene you have pretty heavy acceleration on the units. I don’t thiink I’ve ever seen in a RTS or MOBA game that actually does it.
And that’s why I suppose there is the configurable Acceleration in the RichAI.
However, increasing the acceleration to 999 actually causes pretty erratic behavior

I’d recommend you to test it with instant acceleration more.


Whats the happy path way to make characters stop when destination is crowded?
Here I’ve drawn characterController.aIBase.rvoDensityBehavior.lastJobDensityResult on screen (“is crowded”) and it seems to like I could tell the characters to just to stop on based on that.
I suppose I could just disable the RVO controller but if another character wanted to walk through that character in any time future, it wouldn’t be able to avoid it.
RichAI seems to have some settings for this but I couldn’t figure out if they have any effect. This is my setup.



Are you using any custom movement code for your units?
The RichAI script should start slowing down approximately 0.1 seconds after lastJobDensityResult becomes true (delay is to filter out noise) and it does not seem to get much closer to the target (you can check this value under “RichAI -> Debug Info -> Progress Average”).

Also. You may want to set individual target points for the agents to make it look better (it should look better than what you are showing in the video though… I’m not sure why they are not stopping).
Take a look at RTSUnitManager.MoveGroupTo.
The logic for that function is as follows:
If the target is far away from the group then give every unit an individual target point which keeps its relative position in the group. If the target is very close to the group or even inside it then make every unit try to move to the target.
This matches the behavior in games like SC2.


Hi Aron!
I have seen RTS demo https://www.youtube.com/watch?v=wBUdMXeeej0&feature=youtu.be

Looks cool! Where can i buy it or is it A*pro?
If pro version where i can find documentation for rts movement?


Speaking of this video, I don’t seem to find all this functionality in the included demo scene… for example the waves don’t seem to happen. Am I missing something? or maybe its by design or can we expect all that to be included at some point?



Hmm. I think I might have turned off the wave script by mistake in the latest beta. You can turn it on again on the Canvas object.

It is included in the latest beta of the pro version available here: https://www.arongranberg.com/astar/download
There is not much documentation yet, it is a beta after all.


This is the version that requires burst and job system?


Yes. That is correct @Charley


Hi Aron,

Same problem for me, I resume it in one gif.

Recast graph (or grid graph)
RVO controller
RVO controller locked on others

The problem is the same with the last RTS beta. I also try with grid.

  • Never find the shortest way
  • Never able to dodge unit and wall


Here I wrote the progress average as well on the screen. It seems it never goes below ~1



There are some other strange things there. Why is the speed and velocity always zero, yet the agents are moving? (the progress averge is set to 1 if the agent’s desired speed is zero, which is why I’m asking).


tested new density and stop when crowded . so beutiful unit reactions. ty for this

try to switch on funnel simlification as i see it is off on gif


I used this function and it seems it sometimes gives positions that are way off navmesh.
I tried to demonstrate it in this video.

Oh those where based on rigidbody velocity, which probably should stay zero.


Heres the same kind of video, but where
speed = richAI.velocity.magnitude
velocity = richAI.velocity
is crowded = aIBase.rvoDensityBehavior.lastJobDensityResult
progress average = aIBase.rvoDensityBehavior.progressAverage


@sepnax That is very odd…
Would it be possible for you to share your project with me so I could take a look? You seem to be the one most heavily using the RTS beta stuff and I’d love to figure out how to make it work properly in an actual game (example scenes do have a tendency to not hit all the edge cases).


Yeah. Do you want to discuss further details of it in email or something?


Sure. I have sent a PM with my email to you.


Your terrain looks amazing. How did you make this? Is this using unity’s default terrain shader?


In both Unity 2019.3.0b7 and 2019.3.0f3, Example18_RTS in the current beta project (dev_4_3_11_59993326) isn’t working - the units just float up without stopping.

There are errors every frame for each crystal:

UnassignedReferenceException: The variable offsetRoot of RTSResourceDeterioration has not been assigned.
You probably need to assign the offsetRoot variable of the RTSResourceDeterioration script in the inspector.
UnityEngine.Transform.get_localPosition () (at <5e35e4589c1948aa8af5b8e64eea8798>:0)
Pathfinding.Examples.RTS.RTSResourceDeterioration.Update () (at Assets/AstarPathfindingProject/ExampleScenes/Example18_RTS/RTSResourceDeterioration.cs:26)

And in 2019.3.0f3, Burst compilation fails:

Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Entities\Types\TypeManager.cs(431,13): error: Cannot find the field `TypeInfos` required for supporting TypeManager intrinsics in burst

I would be happy to provide whatever support or information I can - or maybe this example just isn’t ready for support in this version of A*?



Have you tried this in an empty project? If they just float up it sounds like that could be caused by a non-default physics configuration.