Search This Blog

Thursday, December 03, 2009

PT Boats Knights of the Sea developers diary - water physics

PT Boats Knights of the Sea boat at seaBoth water and air in this game are represented as two viscous media separated by the surface of water. The surface of water corresponds to a conditional plane with two animated altitude maps laid upon its geometrical grid. One of these maps is used to represent the waves, and the other one is used to model the ripple on the surface of water. It activates when the camera approaches the water surface closely.

The ships and PT boats are propelled by the propulsive force of the screw propellers immersed into water. The spot where the propulsive force is applied is the locator, to which the screw propeller is attached on the model of the vessel; the force is directed along the axis of rotation of the propeller shaft. The magnitude of the propulsive force is calculated based on the surface of the propeller's blades, the propeller's pitch and its rotary speed. These parameters are set during the setup of the ships and PT boats separately for each screw propeller.

The control of the ship's movement is performed likewise. The ship turns because of the forces applied to the rudders. The direction of this turning force is determined by the angle between the rudder blade and the fore-and-aft axis of the vessel, and the magnitude of the turning force is calculated based on the surface of the rudder blade.
The waterflow around the hulls of ships and PT boats is calculated based on the hull's shape. A simplified geometric model is used for these calculations, and also particular coefficients defining the ship's momentum and the location of the center of gravity are taken into account.

The game is constantly tracing the vessel's coordinates on the horizontal plane and on the vertical axis. When the rudders and screw propellers lose contact with water (which can happen to light boats when they jump over the waves or when the angle of heel is too high), the vessel would lose speed, and its response to rudders will become poor. In order to fully regain control over the vessel one would have to reduce thrust. This system allows the player to feel what's called "sea keeping capabilities" - this concept is not easily formalized, and therefore land experts often miss it completely, trying to evaluate the ships and boats just by their parameters listed in reference guides.