AstarPath.Scan over multiple frames

Hi

I actually have async scanning working in my internal dev version (pathfinding is still paused when the graph is being scanned however). Graph updates on a recast graph are already async, so you can cheat a bit by first scanning the graph and making sure it detects no ground or obstacles (so it will be completely empty) and then request a graph update of the whole graph.

Nice thread! Didn’t seen it before. I discussed basically the same problem here http://forum.arongranberg.com/t/procedural-graph-mover-for-recastgraph just in “different words”. I was also getting ~20s scanning times for my 2000x2000 voxels size RecastGraph’s

I suspect that to achieve more smooth, or as I calling progressive graph building it may need to make BuildTileMesh(vox, x, z) method itself as a separate coroutine with “yield return null” statement, which might be casted not on every single iteration, but lets say every 10th of 100th iterations.

Nice! I’ll give that a go :slight_smile: Thanks for the help, looking forward to seeing async in officially!

Hi,

I just wanted to say thanks for the pastebin it was super helpful and I was able to make my recast graph update async which really helps for building procedural levels. Now the scan can be done in the background which really improves loading between levels.

Thanks!

also gonzorob if Aron’s update solution didn’t work for you I’d be happy to post up what changes I added (although I am a bit behind 3.7.x not 3.8.2) Not sure if they will necessarily be what you’re looking for but it helped my project :slight_smile:

That’d be incredibly helpful! I’ve just got around to trying Aron’s update solution with no success. If you could post your changes that’d be awesome :slight_smile:

Aron: which version are you planning on putting this into?

Many thanks

Robin

Hi Robin,

So here is my ScanInternal for RecastGenerator.cs http://pastebin.com/8UaNKz9Y

I pretty much just followed everything else in Aron’s update solution. But for clarity, in the AstarPath.cs here is my ScanLoop() http://pastebin.com/sZNhFqGh

finally in my application code I have something like this

… where i used to have AstarPath.active.Scan ();
now i have
StartCoroutine(Scan());


bool finishedScan = false;
IEnumerator Scan()
{
finishedScan = false;
foreach (var p in m_gameController.AStarScript.ScanLoop())
{
Debug.Log§;
yield return null;
}
finishedScan = true;
}

and I can easily check finishedScan to know the state of the scan :slight_smile:
Hopefully that helps, even if it is from 3.7.x and not 3.8.2.

Let me know how it goes,
Erin

Awesome! Thank you! Will plug that in later :slight_smile:

I am also looking for the same solution for 3.8.2

Anyone has modified script that I can use?

I have tried the code above, but it doesn’t seem to compile…

Any idea Aron? Did anything improve in this matter?

Hi

I have this implemented in my dev version. I could send you a preview version if you want.

Yeap ofcourse! It will really help! you can send it to [email removed] if you want.

nice… NICE! … AWESOME!

Thanks! It does what I need to do perfectly!

Awesome!
I’m glad it works well!

Btw, if you like the package, a rating and/or a review on the Unity Asset Store is a great way to support it :slight_smile:

Is there any possibility I could also get the preview version aswell?

Async graph updates are almost mandatory at this point :slight_smile:

Hi

This exists in the latest beta version (3.8.3). You can download it from http://arongranberg.com/astar/download
It is a pro only feature however.

Hi!

Could someone link me to the documentation about Async scan on the latest builds? I can’t find it so far. Is it included in the Astar.path component?

Hi

Async scanning is included in the latest beta version. Here are the docs: http://arongranberg.com/astar/docs_rvo_fix/class_astar_path.php#a41c928232446156b4b13e097c18918d2

1 Like

Thank you for the response, I look it up!

EDIT : It seems that the ScanAsync is present in the version 3.8.5, but I am currently using the 3.8.8.1 (pro). And I can’t find it either in the script, nor in the 3.8.8.1 doc. Has it been deprecated? Do I need to downgrade to 3.8.5 in my project?

Hi

The version numbers are really confusing right now. Sorry about that.
3.8.5 was a beta, but several features in it were not ready for official release, but some others were, so the beta branch and the release branch diverged a bit. 3.8.8.1 contains some things from the beta, but not all. ScanAsync is one of those things.

You can take a look at the changelogs here
beta: http://arongranberg.com/astar/docs_rvo_fix/changelog.php
latest: http://arongranberg.com/astar/docs/changelog.php

1 Like

Oh ok, yes it was a bit confusing XD, but don’t worry, I’ll download the 3.8.5 right away and test it out!

Thanks!