In Time



The progress so far

With the exterior views completed, including weather, I was left with one important task: a visual representation of time. Despite the iconic ASDIC pings and silent runnings made popular by films, submarine warfare was before all a visual affair; a deadly cat and mouse game in which seeing mattered as much as hiding. Take this sentence from the Kriegsmarine U-boat Commander’s Handbook: “He who sees first has won.”

From day...

Consequently it’s easy to measure the impact of the time during encounters, for it could favor any side. Another significant remark from the handbook: “The surface torpedo attack by the submarine can only be carried out at night.” This suggests that even the low profile of a conning tower is visible against a bright sky. It makes time an essential feature of the game.

...to dusk

Early on I had planned the exterior views with the idea of representing day time, night time, and twilight. They’re the three main distinctive lighting scenarios often referred to by U-boat tacticians (with night further divided into a handful of moon phases). However we know by now that things rarely turn out how I envision them, so I was nervous to test the system in game.

...to night


The Sun Also Rises 

Building twilight first made sense, since it inherited its characteristics in large part from daytime. To my knowledge there’s no practical difference between dusk and dawn. From a physical standpoint they work the same, and since I have no colors in the game, I will treat them as identical; for the purpose of the game, it’s when the sun is low above the horizon, as opposed to daytime, when it’s at the zenith.

The U-boat Commander's Handbook stresses the importance of the right moment

To achieve the look, the first thing was to darken the sky and the ocean, and then invert the lighting on the clouds, the sunlight hitting them from below. To my relief the result was decent; not great but far better than many of my usual first attempts. I was missing the waning sunlight above the horizon. A short gradient fixed this.

First step to twilight

However reality is more complex. At sunset (or sunrise), the sky is uneven. It’s brighter and warmer toward the sun, as the last (or first) rays of light peek above the horizon. The opposite side takes on the dark blue of early night (or morning). Both halves merge through a soft gradient. My twilight sky is 360 degrees even. My concern wasn’t visual accuracy, which always takes an understandable hit in 1-bit form. What’s more relevant: the changing backdrop creates tactical positioning opportunities, which is too important to be left out of the game.

Step 2: the horizon gradient

When facing the sun, any surface vessel in the field of view draws a dark, visible silhouette against the bright sky. But as the sun comes around, dark painted ships tend to blend into the night sky. And like experienced hunters never approach their prey from under the wind, astute commanders don’t let the sun betray their presence.  

The sky is much darker on the opposite side of the sun

There’s even more reasons why the sun’s azimuth plays an important part in submarine tactics. This paragraph reminds U-boat commanders of a few: “Against the sun: the estimation of speed, position and distance (range) is considerably more difficult; besides which, if the attack is carried out against the sun, there is the danger of attracting attention by the flashes of light proceeding from the objective (lens system of the periscope).”

From Kplt Heinrich Bleichrodt's U48 war diary: "We haul ahead, ensuring that we remain on the side where the moon won't give us away."



From Cape Farewell To Cape Verde

Conveying this idea requires showing the sun, at the bare minimum. No need to be fancy here; a simple sprite did the job. I gave it an animated reflection and suggested its glow with the same concentric circles technique that I used for the periscope overlay. However I made two concessions to reality. The first one is minor; the sun is larger than it should be. Any smaller was difficult to spot as it merged into the gradient above the horizon. 

The sun completes the picture

The second inaccuracy is a lot more significant, but not yet set in stone. At the moment, the sunrise and sunset azimuths and times are arbitrary and constant: 90 degrees (absolute east) at sunrise, fixed at 6:00, and 270 degrees (absolute west) at sundown, fixed at 18:00 (6 pm). In real life, Throughout the year and across the span of the North Atlantic, these vary considerably. For example, the sun barely ever dips below the horizon during the eternal summer days of the arctic circle. This goes for Iceland too, which was not an uncommon patrol destination. As for azimuths, they swing all over the compass across the vast distances involved. I haven’t decided to either stick to reality, or opt for a fixed 12 hours daylight cycle, with the sun always rising and setting in the same direction, regardless of seasonal and latitude changes. Maybe a hybrid system comprised of a handful of zones and seasons?

The midnight sun, north of the Arctic circle

The realistic model has for it to be accurate and challenging, since it evolves, and requires adaptation. But does anyone want perpetual night for an entire 2 months patrol in the northernmost regions? Or lose almost every favorable nighttime opportunity for surface attack in summer? And is the benefit of realism worth doing the research about sun orbital cycles? In truth, I must admit that I have no idea how to even calculate this, let alone code it. On the other hand the fixed model is predictable, balanced, and trivial to implement, but lacks the accuracy and challenge that simulation fans may expect and enjoy. This is a big decision to make, with far reaching consequences. It’s too early to make the call at this point. For now let’s close the chapter and focus on the look.


Gradient: Impossible 

Back to the visuals, I could do with the sun as sole indication of light direction, but I was hoping for more. If I’m honest, this was one of these moments when making a 1-bit game didn’t seem such a good idea. The sky needs a large, soft gradient, which is the prime enemy in 1-bit. First, there’s the question of colors, or at least greyscale values, which constitute the gradient. The more you have, the better, and for anything in between you resort to dithering. Which brings the second issue: flickering.


The sky covers the red section of the gradient

I have two colors, which at best I can turn into 16 with dithering. But that would be the whole gamut, from black to white, which is not the case here. So I know that from horizon to horizon, I may have a handful of values to work with, all of them dithering patterns. That’s an ugly gradient, if you can call it that. Very short gradients are fine, like the ones above the horizon, but anything wider becomes problematic. And even if I could make it look decent, I would have to translate it as the camera moves, which could trigger a bunch of other issues, like flickering.

Had I benefited from the luxury of two bits, that’s four pure colors, I may have considered it. But not in 1-bit. My options have narrowed fast. To work around the gradient, only one idea came to mind. To avoid flickering, the sky and ocean are fixed in place. Only the clouds and waves move, but it’s enough to trick the eye because the dithering is so fine. However I can draw the sky each frame regardless, which means that I can change it any time I want.

That got me thinking; If the clouds and waves create enough distraction that you don’t notice the fixed backdrop, then what happens if I change the sky on the fly? What if the difference is subtle enough, and the switch always happens as the camera moves? And if it goes unnoticed then can I keep flipping the sky, darker and darker, as the camera pans away from the sun? Worth a try, particularly since I already have the necessary building blocks.

The sky is broken down into four brightness values

Unfortunately changing the sky didn't pan out as expected. There was just not enough dithering patterns to generate the subtle changes in brightness. I didn't feel like giving up on the idea altogether, and instead applied the same concept to the horizon gradient. Toning it down as the camera pans away from the sun turned out surprisingly effective, giving the impression that the sky was effectively darkening. I broke down the sky into four sections: a light side around the sun, a dark side 180 degrees away from the sun, and two transitional values. Whenever the camera enters a zone, I trigger the change.

At this point I realized that I could change anything on screen based on the bearing, so why not the clouds? It made sense to turn down the intensity of the light hitting their underside as well. All these changes are minimal in themselves, but their combination gave a decent sense of a dark side and a bright side of the sky, which was the original goal. 

Final twilight lighting

I’ll put this to rest for a while, and eventually revisit it in the future with a more detached perspective. But for now I can call the twilight lighting done.


Land Ho!

Now before moving on to nighttime, there was one more small thing I was keeping in the back of my mind: land. A coastline makes a nice point of interest, but as usual it’s not the visual but the gameplay aspect that I’m the most excited about.

Why would land be of consequence in a U-boat simulation? To answer this I must give a quick overview on U-boat navigation. It’s all a bit technical and boring (and I’m no expert), but I’ll try to explain why I think it matters, as painlessly as I can. 

First, we’re talking about a time when gps and satellites weren’t even an idea. Navigators relied on many of the same techniques used by sailors of old; celestial and terrestrial navigation, and dead reckoning. 1943 saw the introduction of the first attempts in radio navigation, the Elektra-Sonnen, with little success until late in the war.

Before that, navigation relied on three methods, depending if the U-boat was surfaced or not. The first was astronomical navigation, which required the use of a sextant to record the position of fixed celestial bodies, stars at night, or the sun in daylight. This was not without shortcomings, and even dangers. It took an experienced navigator, who could take accurate measurements and then translate them into complex calculations on the charts; far from a trivial job, and mistakes could result in a faulty position by hundreds of nautical miles. Moreover, the boat had to be surfaced, where it’s the most vulnerable. Astronomical fixes couldn’t be done in cloudy weather either, since you needed clear sight of the stars, or the sun.


A navigator takes an astronomical fix

Then there was the terrestrial navigation. The idea is similar: triangulate your location by drawing lines, from your position, toward two fixed points. In this case, the reference points are not in the sky, but landmarks: church bell towers, mountains, lighthouses… water depth could also be measured and serve as a curve of position. This was even more dangerous, as not only the boat had to surface, but it had to approach coastal waters, the most perilous of all. It was technically possible to take fixes from periscope depth, but with much greater difficulty, and increased chances or error. Furthermore, enemy coastal waters were in range of aircrafts, u-boats mortal enemy, which could spot them even at periscope depth in calm sea. And even friendly shorelines weren’t safe, as shallow waters could strand, or even sink a submarine. 

Triangulation based on terrestrial fixes

The third and safest, if not the most reliable method, was called dead reckoning. The concept is to constantly measure the U-boat’s heading and distance travelled, from its original port. It’s a referential system, where every new position is calculated relative to the precedent recorded location. This was done with the help of gyro compasses and clocks (magnetic compasses were useless to U-boats, because the pressure hull would create magnetic interference). The difficulty was that the navigator had to constantly track speed, travelling time, and every course change with absolute precision, taking into account currents and winds that could deviate the submarine. Any mistake would be carried over to the next leg, resulting in progressively worse estimates, with sometimes disastrous results. However dead reckoning was the only method of navigation available under periscope depth, at least until radio navigation much later in the war.


The navigation table, inside the control room


Life or Death Decisions

Learning about navigation convinced me of the need for coastlines in the game; landmarks are vital to terrestrial navigation, and can provide a starting point to dead reckoning. In short, a direct line of sight to fixed points on land was sometimes the only way for submariners to know their position with absolute certainty. 

I would love for the navigation to factor in the game as much as it did aboard real U-boats. Depending on the experience of the navigator, and the opportunity to surface for taking a celestial or terrestrial fix, the boat’s estimated location could be wrong, with consequences ranging from fuel waste, to missed convoys, late rendez-vous, morale decrease… Like real captains, the player will have to balance the importance of accurate navigation against the danger of sailing coastal waters, with greater probability of aerial attack, and diminished capacity for escape, where shallow waters prevent deep diving. 

The B-24 Liberator was a terrifying sight for U-boat crew on watch

Every time you’ll surface at proximity of land, you’ll get the opportunity to make a terrestrial fix, with the benefit of knowing your exact position on the chart. But coastal waters will also come with the dangers cited above: more aircrafts, and shallower waters, which make diving more hazardous, demanding more expertise from the crew, and producing more stress on the boat. This becomes even more interesting when combined with bad weather, which could prevent celestial navigation and force you to head for the shore, if you can find it. I think it’s a lot of  fun gameplay coming at low cost. 

The Kriegsmarine grid system

For simplicity sake, the boat won’t be allowed to get close to land. The coastline will always be represented as generic, low, distant landscape; think of it as a visual convention to signal the player of the potential presence of shallow waters, more aircrafts, and the opportunity for terrestrial navigation. Besides the known coasts, indicated on charts, I’m thinking of hiding a few uncharted islands, with fun bonuses, like for instance restocking in fresh produce and water, or a few hours of shore leave to boost morale. I won’t spoil everything here but I also plan special missions involving secret islands.


Polygons to The Rescue

Now for the visual aspect, I stuck to my old proven and favorite polygon system, which I put together for the clouds. I love polygons on the Playdate for several reasons: they’re simple to program, they have fixed patterns, which guarantee flicker free motion, and they don’t seem to tax the processor excessively. Plus they’re light in memory and easy to modify in the fly, without storing animation frames or pattern variants.

All the land polygons

At its core a shoreline is nothing more than a string of polygons, stitched together to form a unique landscape. I drew nineteen different polygons in Photoshop in various sizes and shapes. That should make for enough combinations to make everything, from small islands, to medium and long stretches of land. A land mass is a simple table storing all the polygon shapes and their coordinates.

This land mass covers almost 180 degrees

Later on I hope to implement the system of sectors used by the Kriegsmarine for their operational charts. Each sector was identified by a combination of letters and numbers. I want to keep the real sectors, covering the entire North Atlantic, but with obviously less precision and at a reduced scale. Still, all coastal sectors will have proper land masses on the horizon, logically positioned on the compass. So for instance every sector along the Atlantic coast of France will have distant land covering the eastern half of the compass. But I’ll come back to the map and sectors in the future.


The coastline is a sign of potential danger

This is a good time to wrap this log. The next and final step to complete exterior views will be nighttime. It may prove difficult to capture the beauty and mystery of night, but it has to be well represented in the game, since it was the preferred hunting time of U-boat captains. So as usual, more soon.


Uncharted island

Comments

Log in with itch.io to leave a comment.

Looks amazing, can’t wait to see it in action on my playdate 

Thank you! I hope the game will live up to your expectations :)

(1 edit) (+1)

When developing Gravity Express, I kept a more brief and more technically oriented devlog (altough with more frequent updates). I already noticed then that it took a lot of time to write articles and the accompanying graphs / screenshots. So I can only imagine what time goes into research for your game. But it’s worth it! This is a captivating read, and realising that this much care is put into development makes it my most anticipated game and an instant buy when it releases. Keep going!

(1 edit)

Thank you! This means a lot coming from you. Gravity Express looks great! I think it’s one of the Playdate games that feels the most fully realized. 
The devlog takes some effort, one may argue too much, since I have so much to do still for the game. But it’s a passion project and I enjoy sharing everything about it. Documenting the process helps me to structure my own thoughts and be more focused and organized. 
And it makes me face my own shortcomings. When I’m tempted to compromise, I vowed to admit it openly and it pushes me to work harder at finding solutions than I may have otherwise  given up on :)

But the greatest reward is knowing that some people realize and appreciate my dedication to the game. Nothing beats that. 

Love how this is coming together!

Thank you :) very glad that you like what you see!

This is looking fantastic! Any plans on making a Windows version?

Does your game use the crank handle on the Playdate for anything? That might be a cool way to raise/lower the periscope. 

Keep up the good work!

(+2)

Thank you for your kind support as always!
The crank yes for sure. I’d like to let the player choose their preferred control, contextually. So for instance on the hydrophone, the left and right pad rotate the needle, but pull out the crank and it’s activated. Fold it back and the game reverts to the pad.

But the game will be entirely playable without the crank too, so that players who don’t like it aren’t forced to use it. And you won’t be stuck if for some reason the crank broke.

I’ve given some thought to a Windows version. In fact, I already started experimenting with Game Maker, which works well.
For now I must focus on finishing the game for the Playdate, and then depending on the interest, I could submit it for wishlist on Steam. I’d like the port to feel like an upgrade from the Playdate, with its own character, while remaining faithful to the gameplay and the artistic DNA of the original. It would still feel like a retro game, something you can play on any computer, even a low spec laptop, but hopefully it would sound and look much better than the Playdate version.