DanDanger
|
|
« on: May 16, 2007, 04:49:47 AM » |
|
2D water dynamics.......Water dynamics...in two dimensions........how do you do that then? And any posts to a "pdf" which contains lots of "equations" will be met with a stern looking at! I had the idea of modeling the water dynamics using lots of little particles which keep a certain distance from each other, collide with the world and get pulled down under gravity. For drawing the water I thought I would draw all the particles to the stencil buffer and then use that to draw a nice translucent blue effect. Any thoughts?
|
|
|
Logged
|
|
|
|
PoV
|
|
« Reply #1 on: May 16, 2007, 08:42:48 AM » |
|
Something like this? Though this is purely a mass of circles, it's something I was toying with for the new PuffBOMB. Click to apply an impulse. Very simple implementation, along the lines of what you said. Though, the red circle pushes the blue ones out of the way very easily, and sinks possibly too fast. I did some further tests of an entire landscape built out of tiny particles (to create an ability to distinguish solid and liquid), but it fell apart too easily.
|
|
« Last Edit: May 16, 2007, 08:45:53 AM by PoV »
|
Logged
|
|
|
|
Bezzy
|
|
« Reply #2 on: May 16, 2007, 09:58:24 AM » |
|
Any thoughts?
Yes. WHERE'S MY FUCKING TINFOIL HAT?
|
|
|
Logged
|
|
|
|
PoV
|
|
« Reply #3 on: May 16, 2007, 10:16:26 AM » |
|
|
|
|
Logged
|
|
|
|
DrDerekDoctors
|
|
« Reply #4 on: May 16, 2007, 03:11:33 PM » |
|
There's an ace game on the SAM Coupe (an 8-bit machine which runs at a mere 6Mhz) which did a clever simulation of water (although it was a very "chunky" simulation) which actually simulated pressure so that water would properly even out when there was an object interrupting the surface of a body of water. The system worked, I believe, by simply making the amount of water a cell could contain linked to the amount of cells containing water above it. So a surface cell could contain 10 units, the cell beneath that 20 units, then 30 units, etc. And these values were evened out horizontally and vertically and it made for a very cool effect. The only problem was the way the water was presented in the GUI was very simplistic, and the water would spread VERY fast without appearing to travel through intermediate squares, but never-the-less it was impressive for an old machine and probably worth looking at. http://www.ysrnry.co.uk/articles/samwaterworks.htmhttp://www.worldofsam.org/node/50 (is that not the finest ever cover to a game?)
|
|
|
Logged
|
Me, David Williamson and Mark Foster do an Indie Games podcast. Give it a listen. And then I'll send you an apology. http://pigignorant.com/
|
|
|
Impossible
|
|
« Reply #5 on: May 16, 2007, 07:09:52 PM » |
|
And any posts to a "pdf" which contains lots of "equations" will be met with a stern looking at! What about a "pdf" (why is pdf in quotes? ) with source code? I can link you to the paper implemented by Plasma Pong, Ichor and 2bears's Riders on a Storm. You should take a look at it if you haven't already seen it. It has equations, but they aren't too bad. Game Programming Gems 6 also has a pretty nice article on fluids using a particle system. Its kind of hard to entirely avoid equations when talking about anything physics or graphics related. I know math is hard, but get used to it.
|
|
|
Logged
|
|
|
|
Bezzy
|
|
« Reply #6 on: May 16, 2007, 08:43:31 PM » |
|
I should point out what I discussed with Mr. Two Bears myself when he was making Rider on the Storm: typically Navier Stokes is very immediately chaotic - it doesn't take long for it to become very unpredictable. It looks very very pretty, however, you tend not to be able to exert much predictable control over it.
I haven't used it for that reason (but wouldn't kick it out of bed for special effects which feed off the core gameplay). That said, I've not really played with any Navier Stokes code myself, so it's concievable that there's a sweet spot setting which gives the best control.
We've used a point-cloud based approach with spring physics inbetween each point. This allows me to create artificial but highly parameterized goo, as well as allowing me to create arbitrary (but natural feeling) physics rules.
|
|
|
Logged
|
|
|
|
DanDanger
|
|
« Reply #7 on: May 17, 2007, 02:00:51 AM » |
|
"Plasma Pong, Ichor and 2bears's Riders on a Storm."
Cooo, that sounds interesting, can i have the link to that pdf, I promise I wont stare sternly at you!
Pov: that looks like the kind of thing i was hoping to achieve!
|
|
|
Logged
|
|
|
|
Alex May
...is probably drunk right now.
Level 10
hen hao wan
|
|
« Reply #8 on: May 17, 2007, 03:29:51 AM » |
|
plasma pong is only half the problem - you've got the flow but you need the surface resolution, which is usually done with particles.
Apparently the best and easiest way of doing it in realtime at the moment is called Smoothed Particle Hydrodynamics. I couldn't understand a word of it when I looked it up. Good luck!
|
|
|
Logged
|
|
|
|
DanDanger
|
|
« Reply #9 on: May 17, 2007, 07:15:45 AM » |
|
Mmmmmmmm.... smoooooooth particle hydrodycarrots.
Thanks for that, ill give that a look!
|
|
|
Logged
|
|
|
|
FARTRON
|
|
« Reply #10 on: May 17, 2007, 09:30:57 AM » |
|
Indie Game Jam 0 had a game called Flow that had some good particle liquids. It was 3D, but I think it's applicable as it is sprite based, and you can get the source by CVS.
|
|
|
Logged
|
Everything that was once directly lived has receded into a representation. - debord
|
|
|
the2bears
|
|
« Reply #11 on: May 17, 2007, 08:50:21 PM » |
|
"Plasma Pong, Ichor and 2bears's Riders on a Storm."
Cooo, that sounds interesting, can i have the link to that pdf, I promise I wont stare sternly at you!
Pov: that looks like the kind of thing i was hoping to achieve!
Real-Time Fluid Dynamics for GamesAnd good luck I'm officially retired from trying to affect the fluid with gameplay Bill
|
|
|
Logged
|
|
|
|
Alex May
...is probably drunk right now.
Level 10
hen hao wan
|
|
« Reply #12 on: May 18, 2007, 02:08:56 AM » |
|
I think Loco Roco is a good way to simplify the chaotic nature of fluids down to something controllable and currently-calculable. I think we'll start to see more games that are closer to real fluids soon.
|
|
|
Logged
|
|
|
|
raigan
|
|
« Reply #13 on: May 18, 2007, 09:34:45 AM » |
|
finally a thread i can contribute to! For a simple introduction, I'd recommend reading Game Programming Gems 1, article 2.6: Interactive Water Surfaces by Miguel Gomez; I'll attach a test "1D" implementation we made in flash, you'll need flash to read the source.. capslock to run the sim, z to grab a box w/ mouse, hold space to create waves. The source is quite ugly, and the method in general won't give you splashing/full fluid dynamics. I'd recommend looking into "smoothed particle hydrodynamics" if you want better fluid and are scared of grid-based fluid solvers; there's an article in GPG6 that might be useful, and some source/demo by MrRowl here: http://www.rowlhouse.co.uk/water/ and a video of same (just to motivate you to visit the previous link): raigan p.s - AFAIK LocoRoco uses particle+spring systems
|
|
|
Logged
|
|
|
|
PoV
|
|
« Reply #14 on: May 18, 2007, 12:53:29 PM » |
|
Damn, that's freaky cool Raigan.
|
|
|
Logged
|
|
|
|
Alex May
...is probably drunk right now.
Level 10
hen hao wan
|
|
« Reply #15 on: May 18, 2007, 03:01:11 PM » |
|
Yeah, the Rowl stuff is really nice. Needs work to stop the particles from clinging to the edges, but it really works nicely as a particle-based solution.
With the Loco Roco comment I meant it more as a gameplay-friendly solution to the chaotic nature of fluids rather than the underlying mathematics; I can't remember what algorithm I was told it uses. Something beginning with v, perhaps.
|
|
|
Logged
|
|
|
|
raigan
|
|
« Reply #16 on: May 18, 2007, 06:16:54 PM » |
|
"Verlet" probably? I wish they gave a GDC lecture, I'd love to know how Loco Roco does collision -- it rarely breaks. If you're not actually looking for a typical "fluid solver", then something like what Bezzy mentioned might work better: a bunch of particles with attraction/repulsion forces. I think "Lennard-Jones" is the technical term: http://en.wikipedia.org/wiki/Lennard-Jones_potentialDavid Tonnesen's thesis is worth a look through: http://www.dgp.utoronto.ca/~davet/phd/index.htmlThis paper's old, but quite straightforward, and might be of interest as it deals with approximating sand/mud type surfaces with a simple particle system: http://citeseer.ist.psu.edu/miller89globular.html@PoV: Thanks! It's just straight from the original article, and the buoyancy is a super-hacky test raigan
|
|
|
Logged
|
|
|
|
Alex May
...is probably drunk right now.
Level 10
hen hao wan
|
|
« Reply #17 on: May 19, 2007, 05:32:55 AM » |
|
Yes! Verlet. I think that was it.
|
|
|
Logged
|
|
|
|
Bezzy
|
|
« Reply #18 on: May 19, 2007, 01:49:10 PM » |
|
Doesn't Gish and Loco Rocco use the same approach? Seems like a chain of lines with angular spring forces which try to keep the circle standing up under tension. Not too tough to knock out and tweak, I should think.
|
|
|
Logged
|
|
|
|
DanDanger
|
|
« Reply #19 on: May 21, 2007, 08:34:00 AM » |
|
Ooo wows, that looks fantastic raigan! Thanks for all the responses guys I definately have a lot of good material in this thread to get me going with some 2d water! ^_^ finally a thread i can contribute to! For a simple introduction, I'd recommend reading Game Programming Gems 1, article 2.6: Interactive Water Surfaces by Miguel Gomez; I'll attach a test "1D" implementation we made in flash, you'll need flash to read the source.. capslock to run the sim, z to grab a box w/ mouse, hold space to create waves. The source is quite ugly, and the method in general won't give you splashing/full fluid dynamics. I'd recommend looking into "smoothed particle hydrodynamics" if you want better fluid and are scared of grid-based fluid solvers; there's an article in GPG6 that might be useful, and some source/demo by MrRowl here: http://www.rowlhouse.co.uk/water/ and a video of same (just to motivate you to visit the previous link): raigan p.s - AFAIK LocoRoco uses particle+spring systems
|
|
|
Logged
|
|
|
|
|