views:

1066

answers:

9

I've got a game idea that requires some semi-realistic simulation of a fluid flowing around various objects. Think of a pool of mercury on an irregular surface that is being tilted in various directions.

This is for a game, so 100% physical realism is not necessary. What is most important is that the calculations can be done in real time on a device with the horsepower of an iPhone.

I'm thinking that some sort of cellular automaton or particle system is the way to go, but I don't know where to start.

Any suggestions?

+7  A: 

This is not my area of research but I believe this is considered the canonical work:

Fluid Simulation for Computer Graphics

http://www.akpeters.com/product.asp?ProdCode=3260

Also, look at the Berkeley Animation and Modeling Group

http://www.cs.berkeley.edu/b-cam/

I also recommend a tool like Google Scholar or Citeseer and persue the scholarly literature.

BobbyShaftoe
+3  A: 

Ron Fedkiw's work is quite stunning in this area.

One more comment: Fluid simulations is the stuff of numerical parallel programming and supercomputers, or at the very least, high power, multi-core desktops. An iPhone probably will not cut it.

Julien Chastang
There are lots of games with fluid simulation. I don't think making such a game work in an iPhone is particularly far fetched.
Breton
In fact, there are already several iPhone games that have fluid simulations.
Kristopher Johnson
That may be true, but the kind of full 3D high resolution simulations Julien and BobbyShaftoe point to (Ron Fedkiw, James O'Brien, Robert Bridson etc.) are substantially too costly to run on an iPhone at interactive rates. Often minutes or hours per frame on a desktop.
batty
A: 

I wonder if you're thinking of something like Archer Maclean's Mercury or Mercury Meltdown for the PSP.

Craz
+1  A: 

As far as I know in the game De Blob a colored "blob" moves around a white environment, coloring objects it bumps into. This was somehow triggered in my mind when I read your description of what you seem to want to do. (Haven't actually played the game, so I have no idea how well that fit is.)

Having said that, I seem to recall that the fluidity of the blob is mostly artifical in that game: basically being a sphere, some slight size/shape transformations of it, some motion cues and added "fuidy sounds" that give the player the impression that something not quite solid is the main character of the game. No actual physics or simulation type programming was involved.

Sounds like a good fit for a iphone runnable piece of software, that. Would that perhaps be enough for you?

peSHIr
+7  A: 

Lattice-Boltzmann methods are a pretty common way to simulate fluid in a discretised, cellular automaton-like way.

However, for the sake of real time performance on an iPhone, it may be more effective to simulate the fluid as a particle system and then work out a way to render the particles as a volumetric mass. I suspect this is the approach taken by games like Aqua Forest.

MandyK
+1  A: 

Aqua forest that MandyK linked to is built on the OctaveEngine, like OE-CAKE ( http://www.octaveengine.com/en_casual/oecake/ ).

This engine seems to work on at least Mac OS X 10.4, Vista, XP and iPhone.

Stefan
Maybe OctaveEngine is a dead product? Downloads are no longer available at that site, and the Contact page says "Please note that we currently suspend any inquiries about our products."
Kristopher Johnson
I dont kknow why, it seems odd if its dead when its so popular and talked of around the worlds in bloggs and so on..
Stefan
+1  A: 

This might also be of interest (demo video, demo binary, source code).

none
+1  A: 

Probably a particle system is a good place to start. Along these lines you can look into SPH (smoothed particle hydrodynamics) as a somewhat more physical approach to fluid simulation that still relies on particles.

batty
+1  A: 

SPH with particles is probably the fastest to get up and running with a head start on extendability into visco-elastics and other stuff. I'll be publishing a guide on my blog tomorrow that I've been writing for the last few days on this very topic. (http://blog.brandonpelfrey.com)

Brandon Pelfrey