Box2D VS LiquidFun

Compare Box2D vs LiquidFun and see what are their differences.

Box2D

Box2D is a 2D physics engine for games (by erincatto)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
Box2D LiquidFun
35 12
7,280 4,648
- 0.6%
0.0 0.0
about 1 month ago almost 1 year ago
C++ C++
MIT License -
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

Posts with mentions or reviews of Box2D. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-04-17.
  • Blaze: A High Performance C++ Math library
    7 projects | news.ycombinator.com | 17 Apr 2024
    For typical game physics engines... not that much. Math libraries like Eigen or Blaze use lots of template metaprogramming techniques under the hood that can help when you're doing large batched matrix multiplications (since it can remove temporary allocations at compile-time and can also fuse operations efficiently, as well as applying various SIMD optimizations), but it doesn't really help when you need lots of small operations (with mat3 / mat4 / vec3 / quat / etc.). Typical game physics engines tend to use iterative algorithms for their solvers (Gauss-Seidel, PBD, etc...) instead of batched "matrix"-oriented ones, so you'll get less benefits out of Eigen / Blaze compared to what you typically see in deep learning / scientific computing workloads.

    The codebases I've seen in many game physics engines seem to all roll their own math libraries for these stuff, or even just use SIMD (SSE / AVX) intrinsics directly. Examples: PhysX (https://github.com/NVIDIA-Omniverse/PhysX), Box2D (https://github.com/erincatto/box2d), Bullet (https://github.com/bulletphysics/bullet3)...

  • Jolt Physics raylib: trying 3D C++ Game Physics Engine
    1 project | dev.to | 10 Apr 2024
    Box2D: 2D engine used in Unity and also earlier versions of Godot. Open source.
  • Rust Game Physics Engines: PhysX, Rapier, XPBD & Others
    10 projects | dev.to | 3 Apr 2024
    Box2D GitHub repo: erincatto/box2d
  • Nebula is an open-source and free-to-use modern C++ game engine
    6 projects | news.ycombinator.com | 9 Jan 2024
  • Linear code is more readable
    3 projects | news.ycombinator.com | 14 Sep 2023
    Why is 600 lines too long? How are you able to make that judgment call without first knowing what the algorithm is even doing? People setting arbitrary limits like this is what leads to convoluted spaghetti, instead of just taking things on a case by case basis. Here’s a function from the Box2D code running a particularly complex algorithm for solving contact velocities https://github.com/erincatto/box2d/blob/411acc32eb6d4f2e96fc... .

    It’s 310 lines long. It reads very well, and it looks very maintainable. It has very clear comments explaining the reasoning behind the harder parts of the code. Would you reject this code because it’s pretty long? I wouldn’t.

    There is no such thing as too long or too short. There’s overengineered and there’s underengineered and there’s a sweet spot in the middle that has the perfect amount of engineering with the least amount of complexity (preferably no additional complexity than the original problem warranted). Sometimes, the problem at hand is inherently a large algorithm and requires many lines of code. Don’t split it up! It just makes it harder for future maintainers who now have to figure out if the additional functions are actually being used elsewhere or if they’re just there to make the code “pretty”.

  • How would you implement a simple collision system?
    1 project | /r/cpp_questions | 17 Jul 2023
    There is always the approach of looking at how an existing engine is implemented, such as box2d: https://github.com/erincatto/box2d
  • C++23: The Next C++ Standard
    8 projects | news.ycombinator.com | 11 Jul 2023
    TIL Box2D must not be serious code because it doesn't use copious amounts of explicit temporaries[0].

    And just for the record, I'm very glad Erin Catto decided to use operator overloading in his code. It made it much easier for me to read and understand what the code was doing as opposed to it being overly verbose and noisy.

    [0]: https://github.com/erincatto/box2d/blob/main/src/collision/b...

  • Make a game engine in C++
    4 projects | /r/learnprogramming | 10 Jul 2023
    For Physics Box2d can be used as a simple starting point.
  • Does anyone know any good open source project to optimize?
    8 projects | /r/cpp | 7 Jun 2023
    I suspect most C++ physics libraries like Box2D (https://github.com/erincatto/box2d) or Bullet3 (https://github.com/bulletphysics/bullet3) could really benefit a lot from SIMD.
  • what to start learning
    5 projects | /r/GraphicsProgramming | 28 Apr 2023
    for 2D physics have a look at Box2D it's amazing https://box2d.org/

LiquidFun

Posts with mentions or reviews of LiquidFun. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-11-14.
  • My open-source Algodoo remake is releasing in alpha at the end of the month!
    1 project | /r/Algodoo | 10 Jun 2023
    You can make thicker liquids like honey, and change their colors. You can mix liquids together as well. I'm using Google's LiquidFun to achieve this.
  • How would I go about making a platform that wraps from one side of the screen to the other
    1 project | /r/gamedev | 27 Dec 2022
    Sadly the marketing department failed utterly, somehow thinking they could sell CFD to... the same kind of kids that spend 200 bucks on loot boxes. I think the absolutely batshit insane potential for dynamic 2D gameplay was barely scratched before they sold the code to Google (creating the LiquidFun project) and went their separate ways. These days the engine has branched into a lot of things, notably a 3D industrial version called ParticleWorks which is a CAD plugin for bringing SPH to mechanical engineering.
  • Could I build an effect like this in threejs? If not could you point me in the right direction?
    1 project | /r/threejs | 10 Dec 2022
  • Bachelor's Project - Need to make a VR game in ~400 hours total. Is my idea feasible?
    1 project | /r/gamedev | 1 Oct 2022
    This might help: https://google.github.io/liquidfun/
  • Pixar's notes on Rigid Body Simulation (2001) [pdf]
    1 project | news.ycombinator.com | 29 May 2022
    Some years ago I did a project with LiquidFun; https://google.github.io/liquidfun/

    It was an interactive art thing for kids; had a TV with a maze of transparent PVC pipes mounted on the front with valves (rotary encoders inside). The kids would open and close the valves, and watch the flow of water be redirected on the TV behind.

  • Most Popular C[++] Open-Source Physics Engines
    9 projects | /r/gamedev | 14 Nov 2021
  • Show HN: WASM and WebGL Fluid Simulation
    11 projects | news.ycombinator.com | 29 Jul 2021
    yeah, I've played around with a few approaches for running the timestep and for some reason I don't feel like I get the same results as liquidfun.js.

    their loop [0] is pretty simple; it's scheduled by `requestAnimationFrame`, advances time by 1/60th of a second, and runs their default of 3 particle iterations. it completes the physics simulation within 3.9–5.5ms, which is easily in time for the 16ms deadline. the rendering is WebGL, which I assume fits easily into that 16ms budget too.

    my loop [1] is more complicated; I don't hardcode the timestep to 1/60 seconds, because requestAnimationFrame may be scheduled less frequently than that. so instead I advance time by the time elasped since I was last scheduled. hm, I think there's a mistake there — `lastMs = nowMs` is probably on the wrong side of the physics calculation.

    there's an additional technique I use: I put a `Math.min()` over the simulation interval, so that I don't attempt to simulate more than 20ms (this can happen if you get scheduled infrequently due to hot CPU or backgrounding the app) — simulating too much time will make us fail our frame deadline anyway.

    furthermore, if we are calculating more than 1/60th of a second, I employ more particle iterations (i.e. 3 particle iterations for every 1/60th of a second that passes). this gave me good results, but turns out it is based on incorrect assumptions (iterations are unrelated to timestep)[3]. moreover, I may be making mistakes in my decision of whether to round this fraction up/down.

    if too few particle iterations for a timestep: the particles will bounce. if too many: the particles will look too incompressible[4]. I think that's the "solid-like" structure you're describing.

    the main reason I complicated this is because the last one I did[5] made me feel motion-sick. I think if "every 1/60th, or 1/30th, or 1/20th of a second: you simulate a 1/60th of a second of time": the result (if you're not scheduled consistently) is that the world speed keeps changing. I think liquidfun.js's approach should be vulnerable to this, but for some reason it looks fine to me. maybe they get scheduled more consistently than me (even though by my measurements, my physics runs slightly faster, so should be able to achieve similar results).

    I think I need to remind myself of what happens if I program the timestep in the simple way that liquidfun.js did. will try that out at some point.

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

    [1] https://github.com/Birch-san/liquidfun-play-2/blob/master/sr...

    [2] https://github.com/Birch-san/liquidfun-play-2/blob/master/sr...

    [3] http://google.github.io/liquidfun/Programmers-Guide/html/md_...

    [4] http://google.github.io/liquidfun/Programmers-Guide/html/md_...

    [5] https://birchlabs.co.uk/box2d-wasm-liquidfun/

  • [AskJS] How could I implement realistic fluids simulations (SPH?) in my video game?
    3 projects | /r/javascript | 9 Mar 2021
    It should be possible to produce simulations like the ones they produced in JS: http://google.github.io/liquidfun/
  • Hello!
    2 projects | /r/oeCake | 19 Jan 2021
    He was involved in an open-source project titled LiquidFun, which was released late in 2013 and unfortunately only went through 3 versions, ending developmentin mid 2014. https://github.com/google/liquidfun/releases

What are some alternatives?

When comparing Box2D and LiquidFun you can also consider the following projects:

Bullet - Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

libGDX - Desktop/Android/HTML5/iOS Java game development framework

Chipmunk - A fast and lightweight 2D game physics library.

raylib - A simple and easy-to-use library to enjoy videogames programming

Cocos2d - Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.

PhysX - NVIDIA PhysX SDK

AndEngine - Free Android 2D OpenGL Game Engine

box2d-lite - A small 2D physics engine

ODE

jbox2d - a 2d Java physics engine, native java port of the C++ physics engines Box2D and LiquidFun