Hi Aron,
I’ve just bought the pro version and am excited.
I have two questions:
-
Can I prevent fighting and pressing into obstacles when the AI arrives the target?
-
RVO doesn’t support rotation to be turned off?
-
How to stop and pause movement / pathfinding?
Thanks
weyoun
1&2. This looks awesome: Which options of the asset are best for RTS (like Starcraft II)
But is the IAstarAI.cs a part of the beta? Cause it is not in my current version.
3: I would like the units to stop at the next grid node right.
4: I saw that before. But that’s too much for a beginner. Thought there would be an easy way
(edit: editor made 1 and 2 out of 3 and 4 :-/)
1&2. Yes IAstarAI is part of the beta.
-
Ok. So there is no built in way to do this with the current AI scripts as this is a pretty unusual requirement.
One simple way is to do this:
ai.destination = (Vector3)AstarPath.active.GetNearest(ai.steeringTarget).node.position;
ai.SearchPath();
This will make the AI stop at the node that is closest to the point it is currently moving towards.
- The DynamicGridObstacle is very easy to use. You can pretty much just attach it to any object with a collider that moves and it will work out of the box. You can take a look at the example scene called “Example2”.
There are so many ways one can update a graph, it’s hard to describe it in a concise way in the documentation
I tried the beta and it’s nice to see that RVO is now more smooth and the AI does not get stuck in the obstacles anymore. Is it possible that the agents do not kick the others around? I want to use it for vehicles and it does not look so nice, if the get pushed away
Hi
Unfortunately due is due to how the RVO algorithm works. It assumes that for every potential collision, the 2 agents involved will take equal responsibility for it.
What you might be able to do is to increase the priority of the agents when they are standing still or moving slower. This might get you a similar effect.
Is RTS movement really such an unusual requirement? I mean there is enough sourcecode how it’s done, but I’m not deep in the topic of pathfinding. That’s why I paid $100 for it
OpenRA: www.openra.net
OpenDUNE: https://github.com/OpenDUNE/OpenDUNE
DuneLegacy: http://dunelegacy.sourceforge.net/website/development/sourcecode.html
Thanks
weyoun_9th
RTS movement isn’t really a well defined thing. SC2 does it very differently from SC1 which does it very differently from DUNE which does it very differently from Supreme Commander, etc. RVO comes from academia, but it has been used in many games. The RVO algorithm is however specifically for disc-like agents in continous space (i.e, not grid based) that can change their velocities instantaneously, it is not that well suited for vehicles.
Vehicles is a lot more tricky. I looked at the red alert games, and they seem to do some kind of grid based pathfinding around existing vehicles. Red alert 3 might have done some form of cooperative pathfinding, but I am not sure.
I have been experimenting with cooperative pathfinding (see https://arongranberg.com/2015/06/cooperative-pathfinding-experiments/) however it’s nothing I have included in the package so far.
1 - I’ve tested DynamicGridObstacle but it doesnt seem to work with 2D?
2 - Any news about IAstarAI? When do you think will it be in the stable version?
3 - Any idea to have multiple targets with spawning units? (I am testing multiple targets. Everything works fine unless I make the target a child of an unit. Having problems if I move a Target1 and Target2 isnt moved AILerp moves the unit which is connected to Target2 anyway…)
4 - I would love to create waypoints which are moved one after another. How would you realize that?
- The “Target” is the child of spawning units, else I dont know how to assign every new unit it’s own Target GameObject?
1,2,4 Thanks. I was waiting for the released version… but if the beta is so good I will use that now.
An example mix of 2D and RVO 2D would be cool. units waiting gridbased for eachother and stop at nearest like in good old 2D (rts) games.
I am trying to implement ai.destination but [HelpURL(“http://arongranberg.com/astar/docs/class_pathfinding_1_1_a_i_destination_setter.php”)]
isnt working anymore.
Sorry about that link. It doesn’t work because that class only exists in the beta. You can find the beta docs here: https://www.arongranberg.com/astar/documentation/dev_4_1_8_94c97625/
Note that you don’t need an AIDestinationSetter to set ai.destination. The AIDestinationSetter is just a script that sets ai.destination to the position of a GameObject every frame.
See https://www.arongranberg.com/astar/documentation/dev_4_1_8_94c97625/iastarai.html#destination
Ok, thanks for that. I have changed AIDestinationSetter to
void Update () {
if (target != null && ai != null)
{
ai.destination = (Vector3)AstarPath.active.GetNearest(target.position);
}
but they are still fighting for the target. Anything wrong?
They are still trying to get to the same position, aren’t they?
yes, what am I doing wrong?