Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

for a first iteration of my sim, I need a very basic physics model for ship/submarine movement. I'd guess it might be a good approach to use vectors here (ship heading but also considering sea states etc.). Basic acceleration and that stuff should be taken into account

I do not need any 3D stuff...the 'client' for that 'ship movement' physics is only the 2D rendering of a navigation map.

I've found some papers on the net but they are far too complex for my needs.

Anybody does know some 'simplified' vector algorithms etc. for that?

Thanks a lot.

EDIT: To be clear: I do not want to simulate ship movement/ocean physics in detail, because this is not the focus of my (naval) simulation. It 'just' must be somewhat believable in that sense that if you have different sea states(wind/waves/currents) that the vessel is somewhat believable influenced (on the navigation map) by those forces.

The main issue for me is how I model/calculate those forces (wind etc.) by simple vectors and (eg. for a given wind velocity like 50kn) in an easy way withouth studying physics ;).

share|improve this question

4 Answers 4

up vote 1 down vote accepted

Simple Euler Integration will fit your needs, see my answer here

Edit: However, for the feature list that you appear to have (which is not that simple btw) the easiest solution is using Box2D

share|improve this answer
1  
But that deals only with acceleration/movement in general, doesn't it? I need also a simple model of the physics concerning ship movement itself –  Hawk66 Jun 13 '11 at 12:49
    
What do you mean "concerning ship movement" its just a rigid body like any body. Can you be a bit more precise? –  Maik Semder Jun 13 '11 at 12:59
    
Ok, I mean for example how to model ship movement in different sea states (higher sea states abstract the height of waves, wind etc.) I also have to consider how a ship moves if it makes 0 knots, thus it is moved by the sea/wind itself. The question is mainly do I just use simple vectors (eg a vector for the wind movement/speed) or is that too simplified, even for non-3D? –  Hawk66 Jun 13 '11 at 13:04
1  
3D or not doesn't matter here, the formulas are the same, just 1 dimension less. The sea movement and the wind are vectors yes, Force vectors, just plug them in the formula like done with the acceleration in the other question and there you go.there you go. –  Maik Semder Jun 13 '11 at 13:14
    
Ok thx, the common vector/acceleration stuff I think I have understood. –  Hawk66 Jun 13 '11 at 15:17

You should consider friction specially in submarines, this ships can travel both under and on whater surface so the speed they can reach may vary according - this to account basic fluid dynamics.

The whole dynamics should be that the ship has an orientation and a propulsion force (both positive or negative), this means an acceleration toward the ship direction. Another acceleration is due the friction, it should be propotional to the speed and backward oriented. The propotional factor may depend upon the ship's shape (repeat it 10 time as fast as you can) and if is in submarine or normal mode.

Then you need to integrate the acceleration to the speed and the speed to the position. Euler integration is not THE integration (what about runge-kutta?) anyway you have to integrate and have to choose between speed (of integration calculus) and accuracy (your ship should not explode or travel backward faster than light).

Summarizing, a ship can be represented by:

  • friction states
  • max propultion acceleration
  • the friction status
  • current position
  • velocity vector
  • current acceleration factor
  • heading

The first two depends upon each ship type, the others defines the complete status of each ship in the game and the last two of this are the ones you can directly control (you should consider the rudder so the heading become an indirect parameter controlled by the rudder position, the choose is yours)

EDIT:

The friction model for wind is the same:

The wind hits the ship in a direction, the shape (CX) for that direction is connected to the (air)friction experienced by the ship: the acceleration is propotional to that friction and has the same direction of the wind (as if the ships goes where the wind comes at the wind speed and the air is still). Assuming that your ship is simmetric over the heading axe, you can compute the angle of wind incidence throught the scalar product of the normalized heading and wind vectors, then use a function that compute the friction ( max friction for 90° degrading to min friction when going to 0° or 180°).

If you are lazy you can consider the ship spherical (I whould like to see one in my life) and completely ignore the wind angle measurement simply applying the constant friction multiplier to your wind vector.

The same for the currents of course.

Obviously the final acceleration you have to integrate is the vectorial sum of all the trust and friction based accelerations you compute.

share|improve this answer

It's not couched in terms of vector math, but you might find this answer from a previous question about ocean simulation and physics useful. Make sure you understand what it is you're simulating before you get into how you simulate it.

share|improve this answer
    
Have already read it. I've updated my question to be more precise. –  Hawk66 Jun 13 '11 at 15:14

The only thing different about a ship as compared to a standard rigid body is that it has a keel that moderates forces coming from tide and current; a ship making 0 knots simply has its propulsion force 0 in the equation, it's not a special state you have to go into.

And the only thing different about a simulation environment for a ship versus a rigid body is that surface friction is basically nonexistent. Go down to the harbor and find a huge 40 foot yacht that weights tons, push a finger against it and slowly just that little force will accelerate it until the guy lines stop it.

Unfortunately what you are trying to do is exactly studying physics, no way around that. The good news is that all you really need to know is some basic vector math and integration to get the numbers back out.

I'd suggest looking at something like Box2D (http://www.box2d.org/) as a physics harness, you won't need most of the features.

share|improve this answer
    
I wouldn't say there's no friction in the water. It just decreases quickly with the speed (can be simulated with something like F = k * V^3.) –  alxx Jun 17 '11 at 10:21
    
Where V³ comes from? I knew that F = k·V² for high speed/large objects if not simply F = k · V. Adding another order it seems guessing to me. –  FxIII Jun 20 '11 at 15:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.