Giter Club home page Giter Club logo

Comments (12)

GGAlanSmithee avatar GGAlanSmithee commented on May 21, 2024 2

Many thanks! I will try to get it working with the instructions in that issue, and report back if I get it working.

from recast-navigation-js.

GGAlanSmithee avatar GGAlanSmithee commented on May 21, 2024 2

hey @isaac-mason just to let you know, the outline described in #225 works fine! However, in my case, the overhead of passing the data back and forth to the worker (using three.js meshes) makes it a bad drop-in replacement. With that said, I could probably refactor my code to build the scene within the worker. I will try that next.

from recast-navigation-js.

GGAlanSmithee avatar GGAlanSmithee commented on May 21, 2024 2

If not, that could potentially be the source of your overhead.

Yeah, I was just naively sending the meshes as is, which I knew would result in this overhead, but just wanted to see if it worked at all (which it did).

I did not know about transferables, thanks a lot for the links, I will read up on it.

from recast-navigation-js.

GGAlanSmithee avatar GGAlanSmithee commented on May 21, 2024 1

I've done some testing and using the method you describe (getting points and indexes, sending them to a worker as buffers, constructing the navmesh, exporting it, sending it back, and re-constructing it) and it is still taking quite some time.

The map I am using is sectioned into discrete chunks, so I could easily split it up, build the navmeshes in parallell and stitch it together.

if you want to check it out, a deb build is available here: https://playground.edenever.online/

  1. draw on the map
  2. hit "d" to play (and generate navmesh) (open console first to see timers)

image

from recast-navigation-js.

GGAlanSmithee avatar GGAlanSmithee commented on May 21, 2024 1

I can def. simplify this majorly logically, so I will do some sweeping changes before testing more

from recast-navigation-js.

GGAlanSmithee avatar GGAlanSmithee commented on May 21, 2024 1

simplified meshes used for navmesh and tweaked ch+cs. it's constantly under 1 sec now, which is more than acceptable, and if needed i know where I can tweak more. Thanks!

(sorry for hijacking your thread)

image

from recast-navigation-js.

isaac-mason avatar isaac-mason commented on May 21, 2024 1

That's an awesome improvement! And no worries at all @GGAlanSmithee, happy to help 😄

from recast-navigation-js.

GGAlanSmithee avatar GGAlanSmithee commented on May 21, 2024

Hey! Since this issue is more specifically about using workers on the site, does that imply that the package is usable from a web worker, or is this issue about adding support for that?

from recast-navigation-js.

isaac-mason avatar isaac-mason commented on May 21, 2024

Hey @GGAlanSmithee! That's right - this library already provides primitives to help you do nav mesh generation in a web worker.

I've created a separate issue to track adding docs and an example for this: #225

I've also put a high-level description of what you'd need to do on that issue.

from recast-navigation-js.

isaac-mason avatar isaac-mason commented on May 21, 2024

@GGAlanSmithee good to hear you've got something working at least!

Out of curiosity, how are you sending meshes to the worker for nav mesh generation? Are you using transferables? For example, using getPositionsAndIndcies from recast-navigation/three (or something like it) and specifying the buffers of the positions and indices typed arrays as transferables?

If not, that could potentially be the source of your overhead.

Just in case you're not familiar with transferables: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects#transferring_objects_between_threads

from recast-navigation-js.

isaac-mason avatar isaac-mason commented on May 21, 2024

Interesting, thanks for sharing the link @GGAlanSmithee 🙂

If you haven't already, you can try tweaking cs (cell size) and ch (cell height) if you don't need as much precision to try to speed up nav mesh generation as well.

from recast-navigation-js.

GGAlanSmithee avatar GGAlanSmithee commented on May 21, 2024

If you haven't already, you can try tweaking cs (cell size) and ch (cell height) if you don't need as much precision to try to speed up nav mesh generation as well.

Yes, I am currently doing this (with great results so far) as well as simplifying / excluding meshes, I am getting reasonable times now, since this will be done ahead of time outside of the design tool.

Thanks for your continued help!

from recast-navigation-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.