RVO Controller issues with beta version 3.8.4

Hello,

In my project, I upgraded to 3.8.4 but then RVO controller stopped working (actually, the NPC just stays in the air forever).
So, I went back to 3.8.2 and it works (the NPC just go to the ground at the instantiate instant). Is there anything in special I should be doing? I noticed that the RVO Controller “collider” changed in 3.8.4

Also, sometimes the game gives me an error about “not enough memory”, more in my Macbook than in my PC (this is happening in any version).

Thank you.

Hi

In the latest version the RVO system was refactored quite a lot to remove several bad design decisions that confused users a lot (this is mentioned in the changelog upgrade notes: http://arongranberg.com/astar/docs_rvo_fix/changelog.php).
If you use the included movement scripts (AIPath or RichAI) you should not have to do anything, but if you use a custom movement script you now need to explicitly get the movement delta from the controller and use that to move the character (this was done because the RVOController does not know how you want to move your character, if you want to use a CharacterController, a transform, a rigidbody or something else).

I plan to include some more backwards compatibility workarounds for when it is officially released.

I am not sure why you would run out of memory. Are you sure it is tied to the pathfinding code?

Oh, got it. Its a shame, everything was working smoothly with RVO =)
I don’t want to use CharacterController, somehow it gets too heavy in my game.
I will try to use AIPath or RichAI. Does it works for full movement, or it is just a way to know the path? I’ve already read now all your documentation and everything is working good, but I want to update to 3.8.4 since it has a lot of updates… but I will have to change my movement logic.

Also, does RichAI or AIPath works good with 50 units (consider I have good code for my other logic actions)? I am only using grid, in a 400x400 terrain and I make the scan again once (my nature elements of the terrain is created in real time) and then I update only some positions when part of the nature is destroyed. Is this the best setup I could make? If you have any tips on this, I will appreciate.

Thanks in advance again.

Hi

Really the only thing you need to add to get RVO to work sort of the same as previously are these lines.

In your Update method or wherever you do movement:

var deltaPosition = rvoController.CalculateMovementDelta(transform.position, Time.deltaTime);
// You may also want to add some raycasting here to make sure the character stays on the ground
transform.position = transform.position + deltaPosition;

This will work for the most part. There are some cases near the end of the path where if you use a low simulation fps, the character might start to oscillate around that point. The RichAI script has some code to prevent that (the AIPath script does not yet have it, but I will add it). Essentially the change is to use rvoController.SetTarget instead of rvoController.Move so that it knows where it is moving instead of just in what direction it should move.

RichAI is only used for navmesh based graphs, not for grid graphs.
AIPath should work for 50 units. I did not quite follow the second part of the question, could you elaborate on that?

Hi Aron, thanks for your reply.

I will try to work on this, but I need to focus in other core parts of the game now (is it too critical to update to 3.8.4 compared to the version I am using?).
The second part is about the best setup for my current design.
I can say to you that yesterday I finished many core parts of the game using pathfinding (and thus your solution). It is all working. By the way, that problem with memory I said before was a Unity bug. I will try to explain the game, but cant add too much because of a NDA lol.

  • My game has a terrain (player chooses among many terrains) and the nature part (objects with my custom script and logic) are created real time (procedural generated).
  • There are animals with pathfinding, but simple logic, it is not heavy.
  • Players will control NPCs (like some sort of strategy game), the max number is 50 units at the same time, doing different stuff, like a small village.
  • I am using your solution for the pathfinding. I configured a Grid path for the terrain and I Scan it twice: once in editor, so it can keep track of the fixed obstacles; and one more time after the nature creation (it could be between 800 and 3.5k objects in game). You can consider that I know how to do programming and this works good (performance + quality).
  • I don’t plan to use the dynamic obstacles nor anything like this.
  • My NPCs has RVO Controller, a capsule collider, Seeker script. I did the character logic with custom updates in game which will tell them what to do. All is working good. The game already has save and load system.
  • So, I want to know if this is the best setup I can make with your Pathfinding or should I do different things? I mean, different Grids, different way of using the RVO (or AIPath or whatever)… what do you recommend to me to keep the game running smoothly in performance and, if possible, what type of movement programming you can advice to me?

One last thing: I cannot make my characters go to the last waypoint (considering the graph of the path, in green, of the Seeker). They always stop at before the last waypoint. Even changing the waypoint distance to check (if I use small number, like 1, they just keep standing still, rotating like they are lost).

Thank you again and sorry for the long text XD

Hi

If the performance is acceptable I would say that seems like a good solution.
You should be using a single grid, not multiple grids.

Regarding the last thing. Did you write your own movement script or did you use one of the included ones?

Hello Aron,

Yes, performance looks good in my stress test.
I think I am using a single grid (the first grid option).

I wrote my own, but it is totally based on your example which has the waypoint change option.

Hi

Well, It’d hard to know what is wrong in a script I haven’t even seen. I would suspect that your check for when it has reached the next waypoint is too conservative and will think it has reached the end of the path much sooner than when it should think that.

No worries Aron, thanks.
I already doing different checks according to my game logic. Cheers.

Hi Aron,

This month I’ve tried to test this new RVO controller, no success.
I cannot make my character move again with the example you did above. So, I went back to 3.8.2 again.
Please, can you give me a full example (simple script) for how can I make it to move with the new RVO?
I really don’t know what I need to do with the new RVO from 3.8.5

Currently, I am using RVO controller with the Seeker.
I call a path with seeker.StartPath and then I use the rvoController.Move with the default example of the 3.8.2 version.
I want to update now because my character sometimes is getting stuck in the same position ( there are no errors on graph, anything) and then, to unstuck, I need to manually move the character to another close position (like changing the transform.position directly). Did you ever see this problem in any case? Is it a bug fro 3.8.2 version?
According to my debug, its like the character is reaching the destination before it really reaches it.

This is the code I am using to check if reached destination:
Also:
Path _unitPath;
Seeker _unitNavmesh;
RVOController _controller;

  if (_unitPath == null)
  {
  	_controller.Move(-Vector3.up * Time.deltaTime);
  	return;
  }
  if (_pathWaypoint >= _unitPath.vectorPath.Count)
  {
  	_controller.Move(-Vector3.up * Time.deltaTime);
  	return;
  }
  //MOVE
  Vector3 dir = (_unitPath.vectorPath[_pathWaypoint] - _transform.position).normalized; //Direction to the next waypoint
  _controller.Move(dir * _currentSpeed * Time.deltaTime);
  //WP CHECK
  if (Vector3.Distance (_transform.position, _unitPath.vectorPath[_pathWaypoint]) < 1.0f)
  {
  	_pathWaypoint++;
  	//Debug: reached end?
  	if (_pathWaypoint >= _unitPath.vectorPath.Count)
  	{
  		_Debug_SaveMsg("REACHED DESTINATION");
  	}
  	return;
  }

I use the seeker.StartPath for finding new paths (going to my destination).

EDIT: I just discovered that this is much more often when I use the

var guo = new GraphUpdateObject(GetComponent().bounds);
guo.updatePhysics = true;
AstarPath.active.UpdateGraphs(guo);

And then looks like, even cleaning the area (taking out the blocked nodes), my NPC got stuck inside and cannot move anymore (its like consider it reached destination). Is there any better way to do this?

I tried this:

var guo = new GraphUpdateObject(GetComponent().bounds);
guo.updatePhysics = false;
guo.modifyWalkability = true;
guo.setWalkability = true;
AstarPath.active.UpdateGraphs(guo);

But it is not cleaning all the area I want (somehow, it misses a few nodes around).

Thanks in advance.

Hi

If it is really getting stuck, that might be a bug. Though since the 3.8.2 version is very different RVO in from 3.8.5 it might not be relevant anymore.

In the 3.8.5 version you can check out the scripts AIPath or RichAI, they have code for how to move the agent. Note that any physics (like making sure the character stands on the ground) will have to be done by the movement script.

Hi Aron

For the example, I really wanted something very simple, just to get the basics… go point A to B and that’s it.
Thanks, I will take a look again…
EDIT: I could make it work with AIPath, will test the performance and add the height logic. If I find any problem, I let you know, thanks.

Hi Aron
I implemented the new version and I am now using AIPath (together with my game logic) and it looks like its working really good (looks more heavy than before, but it is much more smooth and the NPCs is not getting stuck anymore). Thanks for the help.