liquidfun-play icon indicating copy to clipboard operation
liquidfun-play copied to clipboard

liquidfun-play

Note: Requires Chrome/Chromium-based browser in development. Firefox and Safari supported after production bundle.

Demo

Demonstrates functionality of box2d-wasm's liquidfun release.

Main aim was to achieve high framerate by:

  • avoiding allocations in main loop
    • no new
    • no []
    • no {}
    • pre-allocate structures
    • fewer allocations = (fewer?) (shorter?) GC pauses
  • minimize JS->wasm calls in favour of accessing Emscripten heap directly
  • physics via WebAssembly in a web worker
  • rendering in WebGL
    • renderer is in same thread as physics… not ideal, but makes the timing easy to reason about, and eliminates need to post world state to another thread.
      • maybe SharedArrayBuffer would be an alternative which cheaply enables another thread to render the world state.

Usage

npm start

Runs the app in the development mode. Open http://localhost:8080 to view it in the browser.

License

This repository is Zlib-licensed (full text in LICENSE.zlib.txt).
Additionally, contributions ported from the liquidfun repository are licensed as described in LICENSE.liquidfun.txt.