vincent / recast.js

A wrapper for the RecastDetour navigation library for node and the browser
http://vincent.github.io/recast.js/tests/test.webgl.html
107 stars 21 forks source link

[video] pathing issues - taking dead-end routes #24

Open jdestefx opened 6 years ago

jdestefx commented 6 years ago

Having problems getting agents to arrive properly when taking longer routes. Please see the youtube video.

Any advice would be appreciated.

https://www.youtube.com/watch?v=gI_jTiXM5K8

vincent commented 6 years ago

Hi,

The problem appears when the agent takes a shortcut over the bridge ? It could be a configuration mismatch between cellHeight / agentHeight / agentMaxClimb / agentMaxSlope

You could try to run your level in RecastDetour This way you'll find if it's a mesh/leveldesign issue or a recastjs issue.

jdestefx commented 6 years ago

Trying to follow the instructions to build the tool under windows 7 64bit but I apparently don't have some "premake" utility.

image

image

vincent commented 6 years ago

Sorry I haven't much experience about compiling on Windows, but it seems you nee to install Premake https://premake.github.io and Visual Studio https://visualstudio.microsoft.com/fr/vs/express/

jdestefx commented 6 years ago

Vincent, I posted another video update -- please take a look and let me know if any new ideas come to mind. It seems the more frequently I call crowdRequestMoveTarget, the worse the behavior gets. I can say with a good amount of certainty, that my mesh is just fine (I illustrate path sampling in the video).

https://youtu.be/gSDxceKKYVs

vincent commented 6 years ago

One thing you could try is to change the size of the function buffer here https://github.com/vincent/recast.js/blob/master/src/pre.module.js

Change the 10 (which should be a constant obviously ...) to something much higher like 100 or 1000. This will bump the ram usage btw.

Honestly 10 seems ridiculously low anyway :shrug:

If this does not help, maybe check your crowdUpdate calls frequency ?

jdestefx commented 6 years ago

I assume you're talking about line 618. Do I need to do anything to recompile after making the edit? If so, what is that process?

vincent commented 6 years ago

No need to compile if you modify the lib directly, otherwise yeah there is compile script in the package.json

jdestefx commented 6 years ago

I edited line 618 to 100, then 500 - it made no change in behavior.

Because I can arbitrarily request a path from on top of the bridge into the water and get a perfect path every time, I'm starting to believe the problem arises when there are multiple entities taking the same route. I've messed with various agent parameters that would affect stacking, like agent radius and I've also tried a range of "agentSeparationWeight", but still no luck on getting entities to take the most appropriate and direct route.

I'm wondering if there is a way to disable "awareness" of neighboring entities so they won't try to avoid each other on their routes.

vincent commented 6 years ago

Hum, about your last point, I think it is controlled by the separationWeight parameter.