How ttktjmt/muwanx works
Project type and purpose
• Muwanx is a client-only, full-stack-in-the-browser application: a static Vue.js SPA that runs MuJoCo physics simulations and ONNX policy inference entirely in the browser.
File structure
• Top-level:
• public/ – static assets (config.json, scene XMLs, ONNX checkpoints, meshes) served over HTTP
• src/ – application source
– App.vue + main.js – Vue.js entrypoint registering plugins (router, Vuetify)
– plugins/ – Vue router & UI framework setup
– views/demo/ – component tree for the interactive demo
– composables/ – custom Vue Composition API hooks for config, runtime, scene/policy management
– mujoco_wasm/ – embedded MuJoCo WebAssembly module, JS bindings, managers (actions, commands, environment, observations), utils (Debug, onnxHelper, mujocoScene)
• docs/ – documentation for extending/custom content
• tests/ – simple asset-collector and YAML mapping tests
• CI (deploy.yml) – GitHub Actions for building & deploying to GitHub Pages
README for additional insights
• Confirms tech stack: Vue 3 SPA, MuJoCo WASM (DeepMind’s wasm port), ONNX Runtime in-browser
• Highlights features: real-time simulation, interactive controls, policy loading, no server dependency
• Use cases: embed demos, rapid RL prototyping, shareable static site
Main components and their interactions
a. Frontend UI Layer
• Vue.js SPA (App.vue, router, Vuetify)
• Demo view & subcomponents for scene/policy selection, control panels, force/trajectory editors
• Composables orchestrating state: useConfig, useRuntime, useScenePolicy, etc.
b. Asset & Configuration Layer
• HTTP static server (serving public/)
• Config JSONs (public/config_*.json) and scene XMLs + meshes + ONNX checkpoints
c. Simulation Engine Layer
• MuJoCo WASM binary + JS binding (src/mujoco_wasm/dist/*.wasm + MujocoRuntime.js)
• Managers: command, action, environment, observation
• mujocoScene utility to translate simulation state to WebGL scene graph
d. Inference Layer
• ONNX Runtime Web (via onnxHelper.js) loaded at runtime, consuming ONNX policy files to output action vectors
e. Rendering Layer
• Three.js (implicitly via mujocoScene utils) for drawing meshes and joints, updated each simulation frame
f. Interaction Layer
• DragStateManager, Debug, Reflector utilities for user input & debugging overlays
g. Routing & Plugin Layer
• Vue Router for URL-based scene selection (e.g., #/myosuite)
• Vuetify plugin for UI styling
Architectural patterns & design principles
• Component-based UI (Vue single-file components, composables)
• Layered separation: UI ↔ Simulation Engine ↔ Physics WASM ↔ Inference Engine ↔ Assets
• Plugin/module pattern for extending new scenes or policies (docs/ADDING_CUSTOM_CONTENT.md)
• Composition API hooks encapsulate side effects (loading, physics loop, URL sync)