08.02.08
Physics Engines
I’ve been evaluating a couple of physics engines, Box2D and APE. Or rather, looking at their respective Java versions. Just something to play around with. It’s hard to argue with what a good physics simulation can add to a game, see Crayon Physics or any number of games at Fun-Motion for example. I even ran into this unnamed shmup by Ultraken that looks quite interesting.













failrate said,
February 8, 2008 at 8:01 pm
In no particular order:
Ultraken’s shmup certainly does look badass. I can’t quite describe it, but it seems… meaty?
Also, I love his visual profiler. One of the problems with a lot of profiling tools is that it only gives you snapshots, when you really need to look at trends over time to get a real idea of what’s going on.
I’ve test driven both Box2D and APE. Box2D, I tried out early last year, and I liked it a lot. APE, I just tried out a couple months ago, and it’s pretty great, too.
The only issue I had with either one was that they didn’t support triangular bodies, which seems a bit strange to me. It would be nice if they supported convex objects of arbitrary numbers of vertices, but I imagine that by having just circles and rectangles, you can do a number of speed optimizations.
the2bears said,
February 8, 2008 at 9:39 pm
Right, I forgot to mention the visualizer. Very slick, innit?
I know Box2D has better polygon support, but I haven’t looked at it enough yet. Triangle support should be easy to add, simple “point in” calculations are pretty easy. The thing that bothers me a bit about it right now is they’re trying to keep it as analogous to the C++ library as they can. Some things might not make sense that way.
I just need to figure out which library will fit in with my existing stuff with the least amount of work
Bill
failrate said,
February 9, 2008 at 12:54 pm
Yeah, it wasn’t the point in calculation that I have an issue with, it’s resolving out of the triangle in the correct manner. Circles and rectangles are super-easy.
trevor said,
February 9, 2008 at 11:18 pm
I don’t know about the Java version (perhaps it’s based on an old version of the library?) , but I’ve been using Box2D with triangles and arbitrary convex polygons in C++. I’ve even been using Box2D for concave shapes, by adding multiple convex polygon shapes into a single b2Body, in order to make the desired concave shape.
My only complaint about Box2D at this stage is that it’s written from a physics programmer’s point of view, instead of from a game programmer’s point of view; it wants you to specify ‘density’ rather than ‘mass’, for example, which leaves me reverse-engineering its mass-calculating algorithms so that I can figure out the density I need to set so that it gets the mass I want. Annoying, but not annoying enough to induce me to actually modify the library’s source code to make it work the way I’d rather it did.
the2bears said,
February 10, 2008 at 8:17 am
Heh… reminds me of the joke about the physicist, mathematician, and engineer, all sentenced to death by guillotine. Quick version, punch-line, engineer says “There’s the problem!”
Probably needs to be Googled but always funny how different people think in different ways. I’d rather specify mass, too.
Bill
failrate said,
February 10, 2008 at 12:08 pm
Yep: http://ask.slashdot.org/article.pl?sid=05/06/23/1617255
Entar said,
February 10, 2008 at 4:28 pm
I’ve worked with Box2D a bit, and I like what I’ve seen so far. You can do just about anything you want to do. I haven’t worked with APE, so I can’t really speak for that.
cliftut said,
March 17, 2008 at 4:22 pm
Being very nearly a “non-programmer”, I can’t help you with your choice, but I will agree that physics can add a lot to a game when used correctly.
Actually, I have an idea in my head for a 100% physics based game world (2D or 3D), which I plan to start work on once I’ve got some experience under my belt. I have a bit of understanding of the conceptual-line thinking of programming, so I’ve been toying around with ideas in my head to try and make sure the idea is feasible from a CPU-speed standpoint.
Regardless, the first game I make will probably be text-based. Actually, I’ve also toyed around with the idea of a text-based physics game…
the2bears said,
March 17, 2008 at 4:27 pm
“a text-based physics game”
Now that is interesting. I’d love to see this happen. I’ve picked Box2D for Java by the way, just waiting for the latest version before starting something of a project.
Bill