Live data from Hacker News

Matter.js – A 2D rigid body physics engine for the web

brm.io

61–64 of 64 posts

Re: Matter.js – A 2D rigid body physics engine for the web

#61
post #40

Why all those "physics engines" are so jittery? Are there no ways to solve such a system with perceptually exact accurancy in realtime? Those kinds of approximations are the source of some of the most hilarious bugs in games over last deacade or so. Please don't read this as a critique of this particular project which is pretty good at what it's trying to do. I just wonder why AAA games use pretty much the same math?…

Animation is an illusion of motion caused by a sequence of still images. The way a physics engine works is by computing those still images -- the frames -- for each iteration in a mathematical model (the physics you want.) If you want 60 frames per second for a smooth animation, you have to compute the whole frame less than 1/60th of a second. The more complicated your physics model is, the harder it is to do this. >…

The math is not just standard physics. That undermines the essences of the difficulties of doing physical simulations. Many of the design choices have to do with numerics, discretization of time, collision detection, etc.

Physics doesn't concern itself, for example, with how to represent polyhedral shapes, or how to compute their intersections. In the world of computer simulation, there are surely more algorithmic developments to be made. Even if the physics hasn't changed (much) for the last 300 years, there are new ways to precondition systems, and solve them, and so on. I think that's what is meant by "better math".

I think you make a good point about the trade-off difference between CAD and games. In addition to requiring that games be simulated in real-time, you also want the simulation to be causal. In a CAD tool, you can take advantage of being able to do "multiple passes" through time to refine your simulation. In a game, once you've computed the quantities pertinent to a frame, you don't get to go back and recompute those quantities and present them.

Re: Matter.js – A 2D rigid body physics engine for the web

#63
post #59

Earlier quoted context omitted.

The question then becomes how slow is copying to/from the GPU versus doing the computation on the CPU when it comes to 100s/1000s of active bodies. I agree that normally (small examples) it wouldn't be worth it, but for any large simulations, and say, video games of the future, I have yet to see someone attempt to do this. Perhaps it truly isn't beneficial enough... but who knows.

You don't have to wait for video games for the future, GPU physics is commonplace in games. See eg https://en.wikipedia.org/wiki/List_of_games_with_hardware-ac... though that list hasn't been kept up to date.

Anything that uses NVidia Physx will have GPU physics in some sense, but very few (if any) of those actually use GPU acceleration for their rigid body simulations
Post reply on HN