I would like to develop a simulation/video-game of some fish swimming in water. This simulation needs to have real time performance and the fish movement should be as physically accurate as possible. I'd like to have 50~100 fish, each around 10~50cm long and the water they swim in should be a square/round pool with a side/diameter of ~1,000cm (10m).
I'm a assuming that a full scale fluid dynamic simulation would be too heavy for a real-time video game. But I'm willing to give up some features:
- Can settle for a 2D sea seen from above, if 3D is too expensive.
- Don't need to simulate the effects that moving fish have on the water (e.g. don't need to simulate the whirlpools that get created behind a fish moving its fin).
- Could even accept not simulating any motion of the water at all, as a last resort.
- I'm willing to use any language and any library to achieve my goal.
What I really need to simulate though, is the movement of the fish: when it moves a fin, it should move due to the push against the water; a fish aligned with its moment should slow down much less than one diagonal/perpendicular; fish should steer when moving if they're curved; and so on and so forth.
What I tried
I've tried to play around with LiquidFun for a bit, but couldn't manage to get decent results.
- I modeled the fish (main body + rear fin) as several bodies connected via Revolute Joints.
- I placed them within a bunch of particles in a world with no gravity.
- I programmed each joint
i
to rotate bysin(time*A + i*B)*C
, trying different values for the constantsA
,B
andC
.
But nothing worked...
What other ideas I have
If no library can give me the behavior I want with real-time performance, I'm thinking that it should be somewhat simple to approximate the movement of the fish in some hacky way without involving fluid dynamics.
I have no idea how to change a fish velocity/acceleration and angularVelocity/torque based on the position and rotation of a fish (main body, rear fin and side fins) and it's current momentum though.
Question
Are there any physics libraries (or even just examples or some related physical formula definitions; I'd be happy with anything) which could let me simulate a somewhat physically accurate fish moving in a water?