Comments (12)
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.
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.
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.
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/
- draw on the map
- hit "d" to play (and generate navmesh) (open console first to see timers)
from recast-navigation-js.
I can def. simplify this majorly logically, so I will do some sweeping changes before testing more
from recast-navigation-js.
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)
from recast-navigation-js.
That's an awesome improvement! And no worries at all @GGAlanSmithee, happy to help 😄
from recast-navigation-js.
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.
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.
@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.
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.
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)
- Lower maximum memory usage in generateTiledNavMesh and generateTileCache HOT 2
- Support separate wasm file as well as inlined wasm file HOT 3
- Improve three debug helpers HOT 7
- how can I export or import data in Uint8Array format when using wasm version? HOT 1
- Investigate splitting recast and detour functionality into seperate packages
- Add docs and example demonstrating how to generate a NavMesh in a worker HOT 1
- Create examples that don't use react
- What would cause the path to be empty? HOT 5
- Cannot read properties of undefined (reading 'RecastBuildContextImpl') HOT 4
- Add options to high level generators for excluding areas from the navmesh
- Investigate performance opportunities for copying data into Array wrappers HOT 2
- Obstacle queue not processing batches of updates HOT 11
- Fix generateTileCache / threeToTileCache typescript types to omit unsupported RecastConfig options HOT 3
- Expose decodePolyId and encodePolyId HOT 3
- Release 1.0.0
- Exporting with tileCache seems to be working but causes an error when importing HOT 3
- Allow setting the maxStraightPathPolys parameter in computePath HOT 2
- Expose NavMeshQuery `findPolysAroundShape`
- Expose NavMeshQuery `findPath` and `findStraightPath` HOT 1
- Expose NavMeshQuery `findRandomPoint` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from recast-navigation-js.