• Advertisement

Archived

This topic is now archived and is closed to further replies.

Fluid physics library?

This topic is 5065 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, Im planning a game that takes place 95% on sea. So I would like to know if there is any free or open library that handles fluid dynamics for the sea, controlling position of masses (ie, if a boat is floating, sinking, or its just a submarine), handling waves based on weather conditions (storm, windy, "stopped", etc.). Is there such thing? Would it be hard to start one from scratch and is there other people interested in such library? Id prefer to find a finished one and adapt to my needs, but if I need to reinvent the wheel I will =) Thank you, JVFF

Share this post


Link to post
Share on other sites
Advertisement
The kind of engine you''re talking about sounds quite specialized. It''s naturally harder to find specialized engines as people tend to code engines to be "general" (general fluid simulators lead to freaking slow solvers, that''s why fluid solvers have to be specialized for specific needs.)

- Mikko

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You could do a relativelly simplified model of the sea; generally once you''re out in deep water (from an engineering perspective at least) the waves are very nearly sine waves. Generally you will get several different waves with different wave-lengths, speeds, directions and amplitudes. In terms of boats I''d have thought that you could solve it by choosing a number of sample points along the boat & solving it for the buoyancy at the points and orientating the boat so that it is consistant with the fact that its a rigid structure.

In terms of wave equations search for the stokes equations (not navier-stokes!! they''d work but they are far harder to solve!) - for realism the second order waves would probably look fine.

Share this post


Link to post
Share on other sites
In case you wish to code it yourself, here are a couple of tips...

Simulate the water as a height-field. True 3d simulation simply isn''t possible even at slightly interactive rates. You can render the water using normal height-field rendering or bump mapping. Look literature for Fresnel approximations, it gives a very nice look when rendering sea.

The simulation can be done eg. using frequency analysis (leading to the "FFT-water" algorithm) or finite-differencing. The "good" thing with finite-differencing is that you should be able to hack in interactions between water and ships (I''m not saying it''s going to be easy, but as many things in coding, it will probably to a simple algorithm.)

Note that interaction with water and ships (and other things in the water) doesn''t have to be modelled exactly using a simulation. For example, fish (or other oxygene-leaking devices underwater) can simply send airbubbles upwards as sprites. The Tony Hawk skating games used sprites for simulating "circular waves" at the surface of water as the player hit them (in your actual game the waves can be more elliptic than circular because of the fact that your ships are moving forwards.)

- Mikko

Share this post


Link to post
Share on other sites

  • Advertisement