box2d.ts VS box2d-wasm

Compare box2d.ts vs box2d-wasm and see what are their differences.

box2d.ts

Full blown Box2D Ecosystem for the web, written in TypeScript (by Birch-san)

box2d-wasm

Box2D physics engine compiled to WebAssembly. Supports TypeScript and ES modules. (by Birch-san)
Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
box2d.ts box2d-wasm
1 7
1 243
- -
0.0 0.0
almost 3 years ago almost 2 years ago
TypeScript
- -
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

box2d.ts

Posts with mentions or reviews of box2d.ts. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-07-29.
  • Show HN: WASM and WebGL Fluid Simulation
    11 projects | news.ycombinator.com | 29 Jul 2021
    yes, I compiled with -msimd128 to enable LLVM's auto-vectorization. I distribute both SIMD and non-SIMD, and the entrypoint picks whichever distribution your browser supports. for box2d-wasm, SIMD acceleration resulted in a 0.6–0.9% performance boost [0] when simulating a pyramid of boxes.

    liquidfun-wasm is a fork with additional algorithms for performantly simulating particles. I have not yet built a benchmark to measure the particle code, but do intend to. I am optimistic that liquidfun's particle code could auto-vectorize better than the general Box2D code.

    the Google engineers considered how to take advantage of SIMD, to the extent that they even ship a NEON SIMD algorithm[1]. I don't believe my compiler config will use that NEON algorithm (and will instead fallback to the general algorithm [2]). that's probably not a missed opportunity; many NEON features are not supported[3]. but since the engineers were thinking about SIMD, hopefully the non-NEON algorithm will try to make good use of the CPU and memory layout too, and auto-vectorize well.

    [0] https://github.com/Birch-san/box2d.ts/pull/1

    [1] https://github.com/google/liquidfun/blob/master/liquidfun/Bo...

    [2] https://github.com/google/liquidfun/blob/master/liquidfun/Bo...

    [3] https://emscripten.org/docs/porting/simd.html#compiling-simd...

box2d-wasm

Posts with mentions or reviews of box2d-wasm. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-09-21.
  • Article reply “Godot is not the new Unity” from Juan Linietsky (BDFL of Godot)
    2 projects | news.ycombinator.com | 21 Sep 2023
    https://github.com/Birch-san/box2d-wasm.) Godot uses box2d, too, so that would be convenient, if I switch to godot, but only if it is worth the performance improvement, which it currently does not seem to be. Maybe next year.
  • WebGPU – All of the cores, none of the canvas
    7 projects | news.ycombinator.com | 16 Jul 2023
    Following the article, you build a simple 2D physic simulation (only for balls). Did by chance anyone expand on that to include boxes, or know of a different approach to build a physic engine in WebGPU?

    I experiemented a bit with it and imolemented raycasting, but it is really not trivial getting the data in and out. (Limiting it to boxes and circles would satisfy my use case and seems doable, but getting polygons would be very hard, as then you have a dynamic size of their edges to account for and that gives me headache)

    3D physic engine on the GPU would be the obvious dream goal to get maximum performance, but that is really not an easy thing to do.

    Right now I am using a Box2D for wasm and it has good performance, but it could be better.

    https://github.com/Birch-san/box2d-wasm

    The main problem with all this is the overhead of getting data into the gpu and back. Once it is on the gpu it is amazingly fast. But the back and forth can really make your framerates drop - so to make it worth it, most of the simulation data has to remain on the gpu and you only put small chanks of data that have changed in and out. And ideally render it all on the gpu in the next step.

    (The performance bottleneck of this simulation is exactly that, it gets simulated on the gpu, then retrieved and drawn with the normal canvasAPI which is slow)

  • Running JS physics in a webworker - part 1 - proof of concept
    6 projects | dev.to | 30 Oct 2021
    box2dwasm - an old, still maintained C++ library compiled to WASM. The documentation is lacking and developer experience seems poor.
  • Show HN: WASM and WebGL Fluid Simulation
    11 projects | news.ycombinator.com | 29 Jul 2021
    network inspector says 2.1MB. but that's dominated by a 1.3MB image.

    the main assets of the library are:

    - Box2D.simd.js (422kB)

    - Box2D.simd.wasm (266 kB)

    a minimal demo that uses the library can be created in just a few kB:

    https://github.com/Birch-san/box2d-wasm/tree/master/demo/mod...

  • [AskJS] How could I implement realistic fluids simulations (SPH?) in my video game?
    3 projects | /r/javascript | 9 Mar 2021
    A couple weeks ago I ported liquidfun to TypeScript + WebAssembly: https://github.com/Birch-san/box2d-wasm/releases/tag/v4.0.0-liquidfun.0

What are some alternatives?

When comparing box2d.ts and box2d-wasm you can also consider the following projects:

Box2D - Box2D is a 2D physics engine for games

rapier - 2D and 3D physics engines focused on performance.

LiquidFun - 2D physics engine for games

PixiJS - The HTML5 Creation Engine: Create beautiful digital content with the fastest, most flexible 2D WebGL renderer.

liquidfun-play-2

VoltAir

comlink - Comlink makes WebWorkers enjoyable.

vite - Next generation frontend tooling. It's fast!

wasup - A zero-dependency, isomorphic library for emitting WebAssembly

SPHjs - A 2D fluid simulation of water physics in pure Javascript.