Dev log · · v0.42.1

Day and night on the water

The new sea is in the main game, with spray, a bow wave and surf on the shore. Nights have a real moon, stars and nav lights that light the boat and draw glittering paths on the water. Versions 0.39.0 to 0.42.1.

  • water
  • lighting
  • night
  • release notes
Night off Tadoussac: the moon's path on the water, stars, and the nav lights reflected under the boat

Yesterday’s post, A sea that moves, was about a test branch. That sea is now in the main game, with more on top: spray, a hull that pushes the water, surf on the shore, and a night you can actually sail in.

The new sea is in

Version 0.39.0 brings the simulated ocean into the main game, along with the work done on it since:

  • Spray. When the bow slams or punches through a wave, it throws bursts of droplets and mist. Spray comes off the bow and the windward side and blows aft with the apparent wind, and from about 25 knots spume blows off the crests. It scales with the impact, the speed, the wind and the sea.
  • The hull pushes the water. A bow wave rises off the stem, the water hollows amidships and a quarter wave rises behind the transom. It follows the boat’s heel, pitch and heave.
  • Foam that touches the hull. The foam used to stop at a fixed outline around the boat, which left a dark gap when she heeled. Now the boat sends its real waterline every frame, at 22 points along the hull, and the foam starts right there.
  • No more lag. The foam and the bow wave used to trail about a metre behind the boat at speed. They now stay with the hull.
  • A storm from a distance shows broad rolling swells with dark troughs instead of busy chop. That was the main thing left to do in yesterday’s post.
Spray bursting off the bow as the boat slams into a wave in 30 knots
Spray off the bow as she slams into a wave in 30 knots.

Surf on the shore

Until version 0.42.0, the sea met the land in a thin lapping line, whatever the weather. Now waves break on the shore.

  • The surf follows the depth. Waves run in at the speed shallow water allows and break once the water is less than about one and a half times their height. They leave streaks of foam and wash up the beach in a thin sheet.
  • On rock, the wash sits against the shore and a line of foam reflects back out.
  • The wind decides where. A lee shore gets surf; a weather shore gets almost none. Land upwind shelters the water, and headlands shadow the swell.
  • Nothing in it repeats, so a long beach does not look tiled.

The surf is for the eye only for now: a boat in the surf zone does not feel the breakers.

Surf breaking on the beach at Tadoussac in a storm, the boat in front of it
Surf on the beach at Tadoussac in a storm.

We also made the sea cheaper to draw. The biggest layer of waves is now updated every other frame, and the physics follows it exactly, so the boat still feels the waves you see. On our test machine the wave computation went from about 0.25 to about 0.1 milliseconds per frame.

The night

We tried a stronger, warmer colour grade for the day this week. It made the fjord look too sunny and the forest look tropical, not like Quebec’s spruce and fir, so the day keeps its natural look. The night work stays, and it is a big change: before, you could barely see anything after sunset.

  • The moon is where it really is, in the right phase, worked out from the game’s clock and your position. It lays a glittering path on the water and lights the clouds.
  • Stars and the Milky Way turn with the sky through the night, and the clouds hide them.
  • Night exposure goes much lower, with a slightly blue night grade, so a moonlit night reads as night but you can still see the boat, the sails and the shore.
  • The nav lights light things. The red and green sidelights cast their colour on the bow and the water, and the stern light lights the wake.
  • Dusk gets its own haze, sun colour and exposure as the sun goes down.
  • The forest is a dark boreal green: spruce and fir, not a tropical green.
The boat at night under a full moon, its sails and deck lit by the moon and the nav lights
Under a full moon: the moon lights the sails and the deck, and the nav lights glow at the bow and stern.

Lights on the water

The water now reflects the lights near you as long, glittering paths, as on a real harbour at night: the boat’s own sidelights and stern light, plus the 16 strongest lights near the camera, from buoys to the marina. Before, a buoy light only lit the water within 30 m of itself, and the boat’s lights did not reflect at all.

The stern light drawing a glittering path on the dark water
The stern light's path on the water on a dark night.

All of the night work costs about a third of a millisecond per frame.