Row, Row, Row Your Cube!



When it comes to game development, the precursor of a sailboat is a sailcube!

For buoyancy, I place a series of ‘test buoys’ around an object.  Each frame the object checks if those points are above or below water.  If significantly above, it applies gravity, and if significantly below, it applies upwards buoyancy.  If somewhat above or somewhat below, it applies a smaller force.  The result is an object that bobs and tilts with the water.

Simple buoyancy

When I implement the full ships, I will need to optimize each for the right balance of weight and ‘floatiness’.  This ultimately depends on the shape, mass, test buoy positions, and dampening.  I currently have an issue where the buoys do not account for horizontal displacement of the waves when determining if they are above or below water on steep waves, resulting in a momentarily floating ship or a ship that takes a little too long to rise with a wave.  I will test how significant this issue is on the full-size Viking ships, and resolve it if necessary.

I developed the control scheme generalized to broader sailing controls, and will tighten them to match the constraints of the Viking ships.  The player can currently order an imaginary crew to row forwards and backwards at variable speeds.  They can raise, lower, and angle the sail.

The sails do not exactly follow a physical model for sailing, but they take relative wind into account.  Relative wind is a vector determined by subtracting the boat velocity from the true wind velocity.  It means that a boat sailing with the wind can only go as fast as the wind, but that a boat sailing perpendicularly to the wind can pick up quite a bit of speed, depending on how tightly the sail is angled.  The forward velocity provided by the sail considers the angle between the relative wind and the sail as well as the wind’s strength.

I am constantly reminded that
this is an interdisciplinary project.
For steering, I considered two methods of control.  The first was an overly-complicated model where the player directly affected the rudder, and the boat would turn until the rudder was centered again.  The second model I decided on simplifies the control.  The player simply holds down controls to turn left or right, and the rudder automatically centers when the player releases the controls.  The simplifies the system for players while animations can give the appearance of accuracy.

The camera is currently designed to allow the player to look around at their surroundings without affecting the course of the boat.  When the character and ship models are ready, the player will be able to switch from a first or third person camera to the current, wider, ‘overview’ camera.

And now, tales of wild bugs.  In the early buoyancy system, an object that hit the water at the wrong angle would spin at six million rotations per second.  Although I believe I corrected the issue, a fear lurks in the back of mind of a Viking ship violently spiraling into the distance.

Comments

Popular posts from this blog

Topology - A Continuous Learning Experience

Screenshot Friday! March 2nd

Ocean Simulation- or, Thank Goodness I Took Computer Graphics