Navigation engine
[OpenGL home]

Summary

Introduction

  This page shows my first steps in navigation engine and 3D-programming.

3D-Primitives


   The first step was to draw a few geometric primitives that could be used to build a ship: the hull (half-ellipsoid), the masts (cylinder), the sails (squares or triangles). I made pyramids and cones along the way.

  Each object taken individually is an easy job. That's when you need to put them together in a same picture that visibility testing introduces complications.

  I also made some investigations in skeletal animation:

Navigation engine


  I wanted my navigation engine as versatile as possible, to allow me model any kind of ship-of-the-sail. This led me to learn Object-Oriented Programming (OOP), which was definitely the way to go. I found this way of programming so appealing that I've always programmed OOP since then and have converted several of my previous work.

  This resulted in the Arsenal program, which allows to build a ship by defining all its relevant parameters:

  • Hull dimensions and shape
  • Mass distribution inside the hull (ballast, cargo, etc.)
  • Rudder position and dimension
  • Masts: number, position, height, diameter
  • Sails: number, parent mast, shape, size
  With these components organised in a OOP hierarchy, adding the physics was much easier. I "almost" just had to write code for one sail and then everything was summed up to make the ship move.

  Actually, the following factors were taken into account:

  • Buyoancy (depending on hull shape, component masses, etc.)
  • Gravity centre, buyoancy centre, velic centre (centre of the combined effect of wind on the sails)
  • Effect of wind on sails
  • Water resistance to drift and to advance
  • Rudder efficiency
  • Roll torque caused by the wind
  • Sail taking the wind from the others

  Once built, the ship could be manoeuvered in a very sketchy way. Mainly done for testing and debuggins. Nothing much exciting there:

   And finally, I was trying to give a 3D view of th ship. This is were I got stuck into Z-Buffer problems and I stopped the developpment.

  At some time I joined the "Beat To Quarter" team devoted to exactly this kind of simulations. They lacked a navigation engine though and I provided them with mine. However, I had to learn C++ to convert it in this language. This is at this step I added roll and wind cover to the model. For the first time I had the occasion to really see my ship moving on the seas and to see the model was quite realistic. This was a great moment to see that. Here is a snapshot of this demo.

  However, I had no control on the 3D part, and most of the project, therefore progress was slow and depended a lot on others' work. Moreover, C++ has definitely does not convey the same programming ease as Delphi. Even the OOP was lacking a few Delphi features and there was no speed increase (as I was hoping to find) to balance these inconveniencies.

  I came to a stall.

  Then I discovered OpenGL and GLScene, which made me feel I could manage most of the 3D-programming myself. And this is where I am currently. The latest version of the engine is in C++ and I shall have to port it back to Delphi but I feel confident now that I shall be able to put everything together in the near future and finally see my ship sailing on the oceans.
 

Naval Architect

  I have now ported back the engine to Delphi 6 and linked it to GLScene. The result is called "NavalArchitect" as the goal is for now to test the navigation model with ship increasingly complex. This program allows exactly that: build ships and test how they react. So far I've tested it only with a simple Viking ship, the one discovered in Gokstad. Only one square sail, but I'm going to add more and more sails.

  A dream is coming true! Tonight I saw for the first time something I was envisionning since several years: a three-masted frigate sailing across my computer screen! The sails are shadowing the wind from each other, something I had only "seen" and debugged while this frigate was just columns of numbers. In the picture below, the shades of green indicate how much wind they are receiving, which depends on their orientation in the wind and their position among the other sails. When a sail is taken aback, it takes an awkward red colour. In the end, these colours will be replaced by shape (billowing, flat, aback,...) and movements (shivering,...) in the sails.

  You can download this executable below. In the same zip file are three ship definition files: the Gokstad Viking boat, a fantasy two-masted Viking boat, and the frigate (dimensions inspired from the Blanford).

Download


Arsenal: Executable
NavalArchitect: Executable

References

Bibliography

  • Jean Boudriot: Le vaisseau de 74 canons, tomes I, II, III, IV. Ed. Ancre.
  • Richard Henry Dana: The Seaman's manual.
  • Richard Henry Dana: Two years before the mast (Deux années sur le gaillard d'avant).
  • John Harland: Seamanship in the age of sail.
  • Brian Lavery: The line of battle. The sailing warships, 1650 to 1840.

Links


Contact the webmaster  
Updated 2.1.2004