Hi everyone,
I just recompiled an old project: a WASM port of the RVO2 library (GitHub - snape/RVO2: Optimal Reciprocal Collision Avoidance (C++)).
demo : https://www.visualiser.fr/horde/
The performance is much better now! In this demo, 3200 agents are trying to reach their opposite positions simultaneously. It’s quite mesmerizing to watch! (keep in mind this is a 2D simulation).
Next, I’ll be working on re-integrating features I had previously implemented (obstacles,waypoints,agent hierarchy, agent selection).
11 Likes
Very satisfying to watch!
1 Like
Are you planning on hosting the wasm build somewhere ?
@sebavan, I finally had to do it… The first time I compiled RVO must have been using Adobe’s Alchemy (kind of an Emscripten ancestor). The problem is that whenever I feel like continuing the project, I spend more time playing with it than actually working on it…
Speaking of which, here is a new version using thin instances. I also restored the left-click selection to assign new goals to the selected agents.
Finally, the URL has changed; you can now manually set the number of agents:
https://www.visualiser.fr/horde-thin/?n=3200 (max n is 50,000 if you want to break your PC…).
Regarding the WASM build, I’m using the “old school” method: I manually expose the necessary methods instead of using Emscripten’s embind.
For the thin instances, the thinInstanceBuffer is directly built on the RVO side, which takes the load off Babylon.js. I’m basically mapping the array directly from the WASM heap:
this.agentsPosRot = new Float32Array(dataHeap.buffer, dataHeap.byteOffset, dataLength);
this.father.thinInstanceSetBuffer(“matrix”, this.agentsPosRot, 16);
Have a good play !
6 Likes
A quick update on my project: I have moved the WASM simulation into a dedicated Web Worker. This means the simulation and Babylon.js now run independently.
Also, the Worker itself is multi-threaded (using pthreads) to calculate agent positions. I haven’t done benchmarks yet, but the global feeling is much faster.
One big problem I found: if the computer or browser (Windows, Mac, or Chrome) is in Power Saving Mode, the performance is very bad because the CPU is heavily throttled. It’s a real dead-end for high-performance simulations.
Has anyone else faced this issue with power saving mode / low power mode?
anyway we have obstacle now (100), and assign new goal selection is still on.
Server change I have to deal with header policy to get sharearray and worker work.
Sim stay a 0 ms, for a bug issue 
Testing with a heavy shadowGenerator at 8192 for stress test.
Iteration +/- is off as the sim run as fast as possible - timestep is still on.
demo : https://trk-360.com/horde/dist/index.html?n=3200
Finally, all of this is possible thanks to the work of https://www.jamiesnape.io/ (RVO author)
5 Likes
Don’t tempt me! I could easily turn this into a crazy Black Friday simulation. I already have the store assets from a previous VR project!
4 Likes
Hi,
Quick update. It’s just a video for now as the code is still a bit of a mess. Features: selection, obstacles, roadmap, and agent priority (the selected blue agents have priority here).
3360 agents.
7 Likes
This is so amazingly cool 