At this point the platform and programming language don't matter I would just like to know if something out there exists for this. Any help is appreciated.
|
|
Look into what Q-Games used for Pixeljunk Shooter. It is a 2d game with pretty involved fluid physics. I'm not sure if they used a homegrown or middleware physics engine, but the information is probably out there somewhere. |
|||||
|
|
Well i havn't looked into this, but i know for a fact that almost any physics engine can emulate the idea. Box2D, etc. Basically have particles bouncing around, off surfaces and eachother (faster for gasses) but also give them a constant gravity like effect (liquids would all have the same, but some gases you might want to rise slowly). If you link up the outer particles you will get a polygonal shape representing the mass OR if you simply draw a pixel or particle graphic over each particle, you can achieve a cloud effect for the mass instead. |
|||||||||||||||
|
|
The only library I could come up with that specifically deals with fluids is Fluidic. It is pretty alpha and only has one release, though. The physics library Bullet supports 'smoothed-particle hydrodynamics', a technique used to model fluids. Although the library is geared towards 3D, you could apply constraints to one axis to make it work in 2D. My recommendation would be, as I already mentioned in some comments on other answers, to use a standard physics engine like Box2D or Chipmunk and use a number of circles to model the water (with gravity) or gas (without gravity) and combine these together into one water or gas body. You can apply some constraints on the individual bodies to make them 'clump' together so you can simulate viscosity. Have a look at this video to see how the individual bodies (modelled as squares in the video) work together. Note, however, the technique used in this video is not the same as mentioned in this paragraph. You can use the video to get a feel of how the circles interact with each other and try to mimic this with the constraints present in the physics library used. The interesting part comes when you want combine multiple circles into body of water. The most straightforward solution I can come up with is drawing each circle as a metaball so they appear as part of a larger body. You can find the math and some example code behind these bodies here. |
|||||
|