June 16, 2008
I've always been fascinated by physics-based gameplay. Even going back to the primeval days of classic arcade gaming, I found vector-based games, with their vastly simplified 2D approximations of physics and motion, more compelling than their raster brethren. I'm thinking of games like Asteroids, Battlezone, and Lunar Lander.
Accurately simulating the physics of the real world has been the domain of supercomputers for decades. The simulation of even "simple" physical phenomena like fire, smoke, and water requires a staggering amount of math. Now that we almost have multicore supercomputers on every desktop, it's only natural that aspect of computing would trickle down to us.
This topic is particularly relevant in light of today's introduction of NVIDIA's newest video card, the GTX 280, which contains a whopping 1.4 billion transistors. That's a lot. For context and scale, here's a shot of the 280 GPU next to a modern Intel dual-core CPU.
I've talked about this before in CPU vs. GPU, but it bears repeating: some of the highest performing hardware in your PC lies on your video card. At least for a certain highly parallelizable set of tasks.
We were able to compress our test video (400 MB) in iPhone format (640*365) at maximum quality in 56.5 seconds on the 260 GTX and 49 seconds on the 280 GTX (15% faster). For comparison purposes, the iTunes H.264 encoder took eight minutes using the CPU (consuming more power overall but significantly less on peaks).
While one of the primary benefits of manycore CPUs is radically faster video encoding, let's put this in context -- compared to the newest, speediest quad core CPU, you can encode video ten times faster using a modern video card GPU. It's my hope that CUDA, Microsoft's Accelerator, and Apple's Grand Central/OpenCL will make this more accessible to a wide range of software developers.
All this physics horsepower, whether it's coming from yet another manycore x86 CPU, or a massively parallel GPU, is there for the taking. There are quite a few physics engines available to programmers:
There are no shortage of physics games and sandboxes to play with this stuff, too. Here are a few of my favorites.
Perhaps the most archetypal physics based game is Chronic Logic's Bridge Construction Set, the original version of which dates way back to 1999. I'm showing a picture of their fancy NVIDIA branded version below, but it's hardly about the graphics. This is pure physics simulation at its most entertaining. Who knew civil engineering could be so much fun? Highly recommended.
Oh, and small hint: after playing this game, you will learn to love the power and beauty of the simple triangle. You'll also marvel at the longer bridges you manage to drive across without plunging into the watery abyss underneath.
I've professed my love for The Incredible Machine and other Rube Goldberg devices before. The physics based game Armadillo Run is a modern iteration of same. Get the armadillo from point A to point B using whatever gizmos and gadgets you find in your sandbox -- rendered in glorious 3D with a full-blown 2D physics engine in the background.
The latest physics based game to generate a lot of buzz is Trials 2: Second Edition. I haven't had a chance to try it yet, but the gameplay movie is extremely impressive. Like Armadillo run, the action is all on a 2D plane, but the physics are impeccable.
I'm sure I've forgotten a few physics based games here; peruse this giant list of physics games to see if your favorite is already included.
See, physics can be fun -- and increasingly complex physics engines are an outstanding way to harness the massive computational horsepower that lies dormant in most modern PCs.
Posted by Jeff Atwood
One physics engine not explicitly mentioned (which deserves its focus) is PhysX, recently acquired by nVidia along with their buyout of AGEIA. nVidia is already working on converting the PhysX codebase to take advantage of CUDA enabled GPUs as a replacment for the dedicated physics hardware put out by AGEIA in the past. The engine is freely available from nVidia as well for PC development, and integrated in game middleware solutions like Unreal Engine so I'm sure we'll be seeing it used more and more in future titles.
Havok was showing a demo of their engine running on GPUs as well at GDC a few years back as well, so it's definitely headed that way.
Yeah, that's definitely a dual-core Penryn, not a quad-core. You can see how the two cores are mirrored opposites of each other, but there are only two of them.
I used to be a bit of a purist - I pointed out all the inaccuracies in Physics engines on shooters, everything. Then you play some Descent, and realise that the brain can't do real Physics very well. It can do Newtonian, human-scale Physics. It can do car-physics. But step outside 'normal', and it's all very subjective.
In the end, the important thing in a game is the gameplay. Despite being a Physicist, I no longer worry, even about films - the truth is rarely as interesting as your imagination. When will we see more abstract gameplay-focused games again, rather than ever more detailed, restricted, realism?
That said, I'm looking forward to seeing some great physics in 'normal' in-game materials - water, smoke, ray-tracing. Maybe even a 'what if the speed of light was 30mph' game or quantum noughts and crosses. Ah well, a Physicist can dream.
I would add a link for Bullet Physics (http://www.bulletphysics.com) as it was the best open source physics SDK I evaluated when I was looking for one. It has a very healthy and active community supporting it.
To Phil H: Check out Stranglehold for an interesting example of a game with an "unreal" physics engine. Everything reacts overly-dramatically - exploding, flipping, wheeling everywhere in the style of a John Woo movie. Very interesting little idea of what you can do with some creative physics.
The important part of a physics engine is how it adds interactivity to a game. Being able to knock something over by shooting it, or hitting it with a car, or whatever, and then being able to use that interaction as a part of gameplay, is a huge advance in terms of interactivity.
Physics != Physical Modeling / interaction.
As far as games go, real physics is sometimes a drag. I want realish physics when driving a rally game, because the point of that game is because I don't have $1mil and don't feel like wrapping myself around a real tree. I really dig the unforgiving Colin McRae series. It's as close as I'm going to get to driving in a rally.
By the same token, I only want GTA to be movie physics. Realistic enough, but I want big explosions and cartwheeling cars. In real life cars just tend to go crunch and stop. In movies they flip and twirl and explode into a million pieces.
I just hope that widespread use of GPU's encourages laptop hardware manufacturers to put real GPU's in, instead of using the Intel's main memory sharing rubbish chips that can't compute their way out of a wet paper bag.
Boom Blox for the Wii, simple by very fun...
widespread use of GPU's encourages laptop hardware manufacturers to put real GPU's in
Indeed, the prevalence of laptops is a real problem for GPU horsepower and thus the GPU offload techniques. Laptops operate under *severe* battery power constraints; even the laptops with "powerful" graphics such as the 8600M in the Mac Pro are quite underpowered. Consider:
3DMark2006 for 8600M, approximately 3500
3DMark2006 for 9600GT, approximately 11000
The 9600GT is a garden variety midrange desktop video card; it goes for around $120-$140 online. And it's THREE TIMES FASTER than the best video available in an Apple laptop.
There was a fun Amiga game which simulated playing pool in a zero-G cube with holes at the corners and a beefed-up amount of air friction to slow down the balls in a short amount of time. You could rotate the cube to look at it from any angle and position the cue stick to hit the cue from any direction. It was fun just watching the balls bounce around and hit each other in 3-d.
Nice post, I've played that bridge building game a long time ago just like the original trials online version, both are so much fun and challenging too. If you have some spare time they're definitely worth your time ;).
Flight simulators are physics simulators too.
Thought it was all scripted in the Half-Life 2: Episode two there is a scene where a bridge would fall apart after you cross it in a car. It was one of the most impressive physics I had ever seen. The scene however was made using physics engine in a super computer and then scripted so my humble GeForce 6600GT + Athlon 64 3200+ single-core could run it. Now if you want a really good pure physics oriented game all you need is Portal (also from Valve). Portal was so good that I played it 3 times in a row from beginning to end.
The comparison between video encoders there is flawed. You're using two completely different encoders, there is no way of knowing how much work they perform relative to one another.
Comparing them with a test list this is about as "apples and oranges" as you get.
Went to WWDC last week, learned about Grand Central Dispatch and OpenCL - OpenCL is the technology that exploits the parallelism of the GPU. GCD is the new task scheduler.
No discussion of physics games is complete without a mention of Sodaplay.
This thing ate several years of my spare time. You can create wireframe structures of springs (lines) and masses (dots), and then make some or all of the springs into muscles (which change shape in a sine-wave pattern).
With these simple steps, you can create amazingly complicated and lifelike models. Then you can save them into an online account and view/edit them whenever you want. (The old version of Constructor let you save them as .xml files on your hard drive, too.)
There are also a few companion applications, such as a "racer" which lets you pit two or more models against one another in a test of speed, and a "newtoon" program that allows you to make your own simple games using the technology.
The new constructor (and companion apps) require Java Webstart. The old constructor requires only Java because it's embedded in a web page.
Sodaplay's main page: http://sodaplay.com/
Direct link to the constructor: http://sodaplay.com/creators/soda/items/constructor
The old Constructor (some people find this easier to use): http://archive.sodaplay.com/constructor/beta/applet.htm
There are also official forums at http://sodaplay.dailyforum.net in case any of you get addicted. Here you can find help on building models, or simply challenge the others to race you.
P.S. May I commend whoever posted a link to Magic Pen. That's seriously addicting.
I'd just like to put in a word for the source engine used in the Half Life 2 series (and other Valve games). It had some of the best physics I'd ever seen. Especially considering my dinky 1.6 GHz processor and ATI X300 graphics card.
Size isn't everything. The GTX 280 (1.4 billion transistors) is built on a 65nm architecture. The Penryn on 45nm. So, that picture doesn't really say much. This blurb from AnandTech is more enlightening:
"Intel's Montecito processor (their dual core Itanium 2) weighs in at over 1.7 billion transistors, but the vast majority of this is L3 cache (over 1.5 billion transistors for 24MB of on die memory). In contrast, the vast majority of the transistors on NVIDIA's GT200 chip are used for compute power."
I think that the picture is a little misleading. The Penryn is fabbed on a much smaller process.
I've never done anything of the level of these simulations, but I've spent some time programming physics for a simple XNA game I've been working on.
Why just play with physics engines when you can write your own... assuming you don't fear math too much.
whoops, beaten to the punch
Isn't that a dual core chip in your comparison?
I played the demo of Trials 2, and it wasn't very much fun. It just felt too constrained. For more fun, try Elastomania. http://www.elastomania.com/
Someone *seriously* needs to dust off that series, or at least just remake C2 for current-gen computers. Some of the most wonderful physics-engine-based moments emerged from that game!
Yet another physics game that I enjoy is free also.
It's called "Phun": http://phun.cs.umu.se/wiki
It is 2d only and only few primitives but it seems to be quite actively developed.
Thanks for the Fun-Motion link! Always great to hear that other people enjoy physics games as much as I do.
A few of the games mentioned in the comments don't have Fun-Motion reviews yet (been a bit busy with Jetpack Brontosaurus). But the review faucet should be turning back on soon...
I want to point out the Video Encoding comparison is quite inaccurate. First they never stated which encoder they use, second x264 is much faster then the results shown, not to mention the quality difference between different settings or encoders.
The true difference will be shown once the x264 CUDA version is out. Although it is still many months away.
I have no doubt GPU are extremely powerful, and doing encoding on GPU means you could finally record you TV shows while still do something useful with your computer without the lag from intensive CPU usage.
"Why just play with physics engines when you can write your own... assuming you don't fear math too much."
I don't know if you've ever touched a physics engine, but they all require the same level of math as writing your own would. Besides that, writing extensive physics engines such as Havok will also require you to do SIMD optimizations manually.
"I just hope that widespread use of GPU's encourages laptop hardware manufacturers to put real GPU's in, instead of using the Intel's main memory sharing rubbish chips that can't compute their way out of a wet paper bag."
There is hardly a problem with sharing memory; the real problem with the Intel chips is OpenGl support - or lack thereof.
It's impressive to see the performance of these GPU units but it does make me wonder a little about Intels strategy in this area.
Their idea is to create a 10+ core chip (http://arstechnica.com/articles/paedia/hardware/clearing-up-the-confusion-over-intels-larrabee.ars), each core being a "simple" x86 (along the lines of but not actually an Atom). Maybe I'm missing some of their magic but I don't see how even a 32-core chip could keep up with the current NVidia much less what will be out in a year.
Is writing code for a GPU really so hard that Intel will have an advantage here?
Don't leave out "Porrasturvat" and it's successor "Somethingelsesturvat" ... in english they're called "Stair Dismount" and "Truck Dismount". The goal of the game is to hurt the little crash test dummy as much as possible, either by pushing him downstairs or by accelerating his truck against a concrete wall. The dummy's body parts that are in severe pain will flash red for a brief moment. Other than that it's pretty non-violent and a lot of fun! :)
Get it here:
I would like to be able to utilize the GPU for processing power in addition to the CPU for parallel processing tasks in C#. I hear about it being used for physics or complex math(folding) all the time, but does anyone know where I can find some information about how to offload some of my processing threads to the GPU from a multi-core CPU in a multithreaded application?
Some FPS games, such as half life 2, have amazing physics these days. They make use of the HAVOC physics engine.
@Naren more info here on the H.264 GPU encode assist:
A firm called Elemental is preparing several video encoding products that use GPU acceleration, including a plug-in for Adobe Premiere and a stand-alone transcoder called BadaBoom. The compny showed a demonstration of a very, very quick video transcode and claimed BadaBoom could convert an MPEG2 file to H.264 at a rate faster than real-time playback—a huge improvement over CPU-based encoding. The final product isn't due until August, but Nvidia provided us with an early version of BadaBoom as we were in the late stages of putting together this review. We haven't yet had time to play with it, but we're hoping to conduct a reasonably good apples-to-apples comparison between video encoding on a multi-core CPU and a GPU, if we can work out the exact quality settings used by BadaBoom. Obviously, H.264 video encoding at the speeds Elemental claims could have tremendous mass-market appeal.
Crayon Physics for the win...
Refer to the OpenGL specs for how to do get the GPU to do some shader programming. www.opengl.org or something... I usually just google the function name cos I happen to know them already. You can find them in the spec tho...
I find its always best to work from the "manufacturer"'s spec than from tutorials or guides.
atm you have to do some lovely tricks, like putting your data in to textures or coordinates (colors, normals, texcoords etc..) so that you can get it in there. Also there are various precision issues to be mindful of...
its all great fun. :)
"Red Faction: Guerrilla" (XBOX360/PS3, early 2009) is doing some very interesting things with Havok.
There is a nice flash demo of Boom Blox, so
you do not need a Wii do experience the basic idea behind it.
(-google and search "boom blox flash")
Greatest physics-puzzle-game I played lately.
One more vote for Elastomania (or Action Supercross, to go further back in history).
The first few levels are standard physics-based gaming, but very quickly it turns into a demonstration of how to abuse the edge cases of your physics engine to best effect..
It's really amazing that the sorts of things the first supercomputers were doing could now be done on the little Java engines on our cell phones.
Who said physics wasn't fun?
How did you encode video on your GPU? Can that easily be accomplished? I encode H.264 all the time, and I would love to speed the process up, even slightly.
It never really hit me how much simulated physics can enhance game play in video games until I played half-life 2. There's nothing as satisfying as launching a sharpened gear at an approaching zombie foe.
very cool links, the water/fire simulation really blew me away!
Check out: Mirror's Edge a href="http://www.youtube.com/watch?v=Yg7-DDnRpXk"http://www.youtube.com/watch?v=Yg7-DDnRpXk/a
Computer games physics has in my opinion had way to little focus. But a cool water simulation does not make your world come alive, if only the water looks real and the rest is dead. That was what amazed me so much about World of Warcraft, how the world felt alive. The landscape was unique, the big cities where crowded, every armour/weapon changed your character. It might not look photorealistic, but it to me somehow visualised that the world is not perfect. There is no such thing (yet?) as cloning in real life; even twins are not equal, no matter how similar they look. So yes simulating the laws of physics is cool, but what about the "forces of nature?".
Anyway, where is all the god-simulators, I miss Populus, Powermongers, etc..
I also highly recommend Portal. It is one of the best games I have played in my life. However, the underlying physics engine (Havok) does not really shine in that game, since it is more about tossing around boxes and portal-jumps abusing static gravity, heh.
As a nice and fun sandbox I recommend Garry's Mod, an addition to Half Life 2 (you need to buy both the game and Garry's Mod, but prices are reasonable), which enables you to use a couple of sandbox areas as well as the maps of all games running on that engine that you have installed. It also supports 'Multiplayer', i.e. multiple people operating in the same sandbox over network (however, for best performance you should do it within a LAN).
I'm waiting for an article how to create video games!
About physics and games try Toribash: http://www.toribash.com/
It's not the game in traditional meaning, but it is great to play with human body. You can do there amazing things, but in the same time You realize, how difficult it is to do some things with Your body.
Damn, It is easier to do the back flip in real life than in this simulation!!
thank you, thank you, thank you for showing me the light on a new bridge building game! i played the one back in 1999 and absolutely loved it. i had no idea it was updated with 3d graphics! must. buy. now.
I picked up Trials 2 on Steam for 10 dollars yesterday, and I have probably gotten that much value out of it already. I love the minimal four arrow controls, and the graphics take advantage of modern GPU's, too.
First time i see this physics based games,expeted as a normal procedure when developing this scientific models.590kl(hfg.568),building bridges is a kind of imagination.Gxl is a prove about this panel codes, well doesnt get well with hpo562.
Since I have read this I have learned that I suck at bridge building and I have wasted hours of my life with Trials 2. Trails 2 works quite well with Xbox 360 controller. It looks great and who would have thought that a motorcycle game would keep saying "Fatality".
I love this stuff. Thanks.
iTunes' encoder isn't properly threaded, so I don't see how that makes for a good comparison. Handbrake on the other hand will use at least four cores, and on a Q6600 overclocked to 3 GHz it's averaging about 90 fps transcoding the Transformers DVD to H.264 at 640x(whatever). Adjusting to expected results at normal clock speed gives ~72 fps.
The Q6600 is going for about half what the 260 GTX cards are expected to come out for and the Penryns should do H.264 quite a bit faster when the encoders add proper support for the new instructions. This isn't to say I don't want my GPU getting involved, but I think the true difference in performance per $ isn't as much as claimed.
I think GPUs are the wrong way to go. Don't get me wrong, there's nothing wrong with the GPUs themselves, the problem is that they are chips of their own. I think there should be one chip in a system performing all the calculations the programmer wants and the other chips should either be passive or statically programmed and do whatever their job is.
That said, I have no problem to move the GPU into the CPU. Just like there are SSE units on modern CPUs with several times the performance, you could also add GPU-like FPU units (and just like on a GPU you could add 128 and more of these) to the CPU. Whether these units sit in an own chip or are part of the CPU, where's the difference? Okay, it could be an issue with power (the power consumption of the CPU will drastically increase) and cooling - but these are two other problems we need to solve someday anyway. Maybe computers operating with light instead of electric current will solve the whole power/cooling problem in the future.
Oh my god...
What was that..???
My new on steam feed included Crazy Machines 2 (from Steam) -- I've gotta have it... and thought you might be interested
hi all my name is sapna.Plz give me web of very horror game.
I love the funmotion blog! check mine out :)
Not sure if you'll ever read this comment, but you should try World of Goo. Its independently developed and packed with physics-based puzzle goodness.
Thirding Boom Blox. Not only is it an amazing game, but the interface using the wiimote is just as good. I'd say it's the first game to truly take advantage of the wiimote's capabilities.
My favorite Physics-based series before I quit gaming was Papyrus's NASCAR. I owned almost every version until NASCAR 4, where they finally (and quite successfully) rendered the physics required to make the stock cars fly through the air realistically (unlike previous versions where the cars are stuck on the road). The physics engine was quite impressive, but sadly I have lost track of my copy.