The Enemy (Part 1)
Before getting into the enemy’s AI, I have a late addition to the game’s visuals.
In the deck gun sequence, and until recently the torpedo attack, the feedback for sinking a target was merely given through dialogue. I had initially envisioned Atlantic ‘41 with limited graphics, but it evolved into something more visual. In the current state of the game, a simple line “Target is sinking” feels unfinished.
The problem is that in naval battles, everything takes forever. Ships went under in anywhere from 5 minutes to several hours. Time acceleration won’t work, because fast motion tends to make things look smaller, less impressive. In film, they used a technique called overcranking (a term coined when cameras were operated with a manual crank, like a Playdate). The idea was to shoot miniature ships in a tank at a higher frame rate, and play back the film at normal speed. The animation would appear slower, giving the illusion of ocean waves. The trick was common in Hollywood from the 50’s through the 70’s.
“Earthquake” (1973). Over-cranking the destruction of miniature buildings
Besides that timing aspect, a convincing sinking sees the ship listing or breaking up, which requires the animation drawn for all possible angles the ship can be seen from. For every ship in the game. Without real time 3D, that’s a monumental, unrealistic task. Now war footage often shows fire breaking onboard, sometimes engulfing the whole ship. That seemed like a much easier and versatile route, simply consisting of a large plume of billowing smoke attached to the ship where the coup de grâce hit.
No sense of urgency aboard the sinking Austrian Battleship SMS Szent István 1918
I went through my usual process of finding video reference. But there’s the problem I touched on above: large smoke moves and morphs slowly. Fast animation would look like a campfire smoke. Quick tests showed that a convincing effect would need many frames: 100 frames, multiplied by three, for each sprite corresponding to a specific distance to camera. 300 frames is a massive undertaking even for a skilled animator, which I’m not.
Ships on fire during the battle of the Atlantic
Coincidentally, around that time, a friend of mine knowing about the project and my interest for 1-bit, sent me the link to a Photoshop plug-in that proved helpful in dealing with the large number of frames I needed to convert. It’s possible to pick the dithering algorithm, adjust parameters, and get the preview in real time without leaving Photoshop. And it features dithering algorithms I’ve never seen anywhere else, which fit well with the patterns I created for hand painting.
Numbers show the steps: 1: RGB sprite / 2: 1-bit sprite / 3: 1-bit mask / 4: 1-bit composite
Another great feature allows you to dither separately the shadows, midtones and highlights. Just by changing a few parameters, I was able to get the image and the dithered mask from the same source, which would have demanded a lot more fidgeting with the limited native conversion tools in Photoshop. I won’t go as far as saying that outputting the 300 frames was easy or quick, but it was at least doable, which is more than I could have hoped without the plug-in.
Smoke effect
The smoke itself worked well, but I couldn’t turn it on instantly, which caused an awkward pause before getting confirmation of the sinking. So I figured to emphasize the impact with a succession of large explosions across the ship, suggesting a destructive chain reaction. The plug-in proved tremendously useful again.
With a short screen flash and light camera shake on each explosion, the final effect seems impactful enough, and I hope that it will give the player a good sense of accomplishment. Sound will be essential, and I’m already experimenting various ideas. I used to play quite a bit of Splatoon 2, and to this day I can recognize the sound effects when hitting and eliminating an enemy in Salmon Run. I’m thinking of adding a higher pitched sound to the fatal torpedo impact; something to make it instantly identifiable from non lethal hits, and trigger that dopamine release in the player’s brain.
Final sinking sequence with flash, camera shake, explosions, and smoke
With this the torpedo sequence is 90% complete, except for the mechanics of crew cohesion and officer perks. It’s too early for those, because they depend on other components of the game. Too meta, as they say.
Poor Man’s AI
I would lie if I said I wasn’t anxious at the idea of programming enemy’s AI. First, it will have tremendous impact on gameplay, and the enjoyment of the player. A mechanical and predictable behavior can be exploited. What would be the fun in playing Poker against someone if you could read their mind? On the other end, erratic and random actions pull the player out of the fantasy, when they don’t get the sense of a believable opponent, governed by rational and tactical thinking. It prevents forming a strategy, since you can’t anticipate on the opponent’s moves.
“AlphaGo” - A beautiful documentary about AI, games, and humans
In addition to that, the AI compounds two challenges: enemy’s plans must be based on believable WW2 naval battle tactics, which I had little knowledge of. And NPC AI, if you can all it that, rests on algorithms I have zero experience with.
For a time, I read papers on basic video game AI, which should be more than enough for my simple case. One of the most common approaches revolves around needs and actions. A NPC must fulfill basic needs, like staying alive, finding the enemy, protecting their ally. And they have available actions, like look around, heal, fire at enemy etc...every action raises, and sometimes lowers certain needs, which are prioritized, so that the NPC always takes the action that helps their more immediate need. If that need is met to an acceptable level, an action helping a less important need is undertaken.
One of my heroes, Demis Hassabis, started with simple neural networks in Black and White, then moved on to help create AlphaGo, the first program to beat the world champion at Go. His ultimate achievement so far is AlphaFold, a system predicting the 3D structure of proteins from their amino acid sequences, for which Hassabis won the Nobel Prize in Chemistry in 2024.
It’s simple enough to code an effective system for simple use cases. I started to write a crude algorithm for unarmed merchant ships and escorts, using that method. But as I was reading about the battle of the Atlantic, how ships tried to evade U-boats, and how escorts protected merchant ships, it became clear that treating them as autonomous entities ignored a defining aspect of U-boat warfare: the convoy system.
John Carmack’s programming breakthroughs made Doom one of the most influential video-games ever. Now Carmack also moved on to AI. His new company Keen Technologies has developed a robot that can learn to beat any Atari 2600 game by looking at it through a camera, and physically interacting with the joystick.
Even though ship captains were entitled to make any tactical decisions, in practice they followed orders from the convoy Commodore, in the convoy’s leading ship. Escort ships had a similar structure, with a commander organizing defensive efforts.
In other words, ships were in constant communication and functioned as a herd, leveraging their number and cohesion. The system I had began to implement wasn’t wrong in itself, but I had to adapt it to concept of the convoy. And that went both for merchant ships and warships.

But in order to do that, I first needed to implement the game’s convoy system; how the convoy is structured, how ships inside the convoy are rolled, in a way consistent with historical WW2 convoys. And that in turn meant that I had to research which types of ships constituted a typical convoy, and their procedures in various situations.
This nested dolls effect often changes the order in which I can tackle things, but I have to deal with each situation as it comes. So AI coding goes on the back burner, and onto building a convoy system.
The Herd Mentality
The use of convoys goes back centuries, and revolves around the idea that there’s safety in numbers. As far back as the 16th Century, the Spanish set up convoys to protect from Privateers their ships returning from the New World. The Royal Navy fought the Napoleonic Wars in convoys, but abandoned them in the early months of World War I. They were concerned of offering a target rich environment to newly built massive battleships, instead of scattering these targets across vast distances.
Data shows that the number of ships sunk doesn’t increase with the size of the convoy
The reasoning was flawed in two ways. First, the Germans didn’t want to risk leaving their ports undefended and waste their powerful surface raiders on long, unfruitful searches for convoys. The task was left to U-boats, which couldn’t harass multiple ships at the same time over long periods of time, until they came up with wolfpacks. In addition to that, the British failed to measure the immensity of the Atlantic Ocean. Even dozens of U-boats left massive gaps through which large convoys could slip through. From several miles away, 30 smokestacks was marginally easier to spot than a single one. Scattering ships across the Atlantic increased the odds of at least a few getting intercepted.
Convoy of Canadian merchantmen
The mistake was corrected, and the use of convoys became the norm, and even more so during the Battle of the Atlantic. As the Allies grew more confident in the convoy system, they perfected it, taking lessons from each encounter with the new U-boat threats. It appeared that convoys offered even more advantages than the ones mentioned.
More ships meant more watch crews, and better chances of spotting a periscope. If a U-boat was unlikely to get detected by a single merchant ship, it was not as easy to go unnoticed under the constant surveillance of a full convoy. Not just that, but with convoy escort warships equipped with ASDIC and hydrophones, even the deep didn’t guarantee them invisibility.
Sloop HMS Kite, October 1943
Furthermore, escort ships limited the U-boat attack window. After the first torpedo salvo was detected (or hit something), defenders swarmed the area, forcing the enemy to dive. The escort was not so interested in sinking the threat (even though it was always welcome), as it was to keep it underwater for hours, where the abysmal seven knots of its electric motors gave ample time to the convoy to escape.
Finally, convoys gave the reassurance to merchantmen that even in the eventuality of their ship being sunk, plenty of boats in the vicinity would be able to quickly pick up the survivors.
Sailors rescued after their ship was sunk
In conclusion, there wasn’t much downside to the use of convoys, without which the allies couldn’t have had so many safe crossings, in particular from 1942 and beyond. As a U-boat commander, the player will have their best days early in the war, when the Royal Navy had not yet taken the full measure of the threat, and still allowed many ships to cross unescorted.
About WW2 Convoys
With a better understanding of the philosophy of the convoy, I gathered more details about their size, structure, and tactics. Here’s a quick breakdown of what I learned.
Any two ships sailing together with one escort vessel is technically a convoy. In practice, WW2 allies convoys ranged from a few ships, up to more than 100. The largest convoy was comprised of 166 ships. Unarmed freighters constituted the main bulk of the convoy, and the number of escort warships varied from a handful to more than 20. Convoys did not always remain constant throughout the crossing. Two convoys could merge for a portion of the journey and then sail toward separate destinations. Escort ships sometimes got reinforcements, or a subset of them would leave the convoy, called for help elsewhere.
Typical convoy structure
Since convoys were limited by the speed of the slowest ship, the allies tried to organize them with similar vessels. Troop transports crossed “fast”, with speeds up to 13 knots, while cargo crawled at no more than 4 knots. However, large convoys, protected by numerous, strong defenders, mixed several kinds of ships.
Each ship was assigned a fixed relative position in the convoy, called a station. The convoy was divided into columns, 1 km apart from one another. Inside each column, stations were separated by 500 meters. Escorts ships screened the ocean three to four miles around the convoy perimeter, their visual and sonar ranges overlapping. The idea was to detect U-boats before they got within torpedo range of the freighters, and either sink them or drive them away or deep, where they are harmless.

US Navy destroyer escort drops depth charges
Warships also positioned themselves ahead of the other ships, where slow U-boats waited to slip inside the convoy, rather than risk the wake of their periscope to be seen. Once among the preys, U-boats would fire a salvo at multiple targets and dive immediately, with the hope of re engaging later.
PQ-17 Arctic convoy, June-July 1942
Behind the screen of warships, the most sensitive targets (troop transports) occupied the safest stations, in the center of the convoy. Tankers sailed around them, themselves encircled by cargo freighters, slightly more expandable. The ships in the outermost columns were the most vulnerable, as the first available targets for U-boats which had slipped through the cracks. And in these columns, the last row in the back was the worst, nicknamed the coffin corner.
Collect Them All
I would like Atlantic ‘41 to feel like an authentic simulation in terms of convoy scale and structure. But to maintain gameplay at a reasonable pace (better suited to a portable console), I for now limit the largest convoy to 21 ships, including 5 escorts. I’ll have to find the sweet spot that should prevent endless battles, but still ensure that they’re long enough to alternate between phases of slow, tense, tactical planning, and bouts of intense action.
Typical large convoy escort
In the game, isolated unescorted ships are considered one ship convoys; this allows me to use the same logic code, but I’ll come back to this. Early in the war, you’ll be able to find ships sailing alone or in groups of two or three, without escort. As the conflict progresses, they’ll be less frequent, until only escorted convoys remain.
When spawning a convoy, the game populates the stations with the required ship types. I had to do more research there, given the enormous variety of ships that crossed during the Battle of the Atlantic. Six categories cover the essential of what constituted a typical convoy, with several classes per category. Since I can’t have them all, I narrowed them down to the most frequent or iconic. Ships from various neutral or allied nations crossed together. Once all the ships have been rolled, the algorithm assigns to each one a nation, based on their historical relevance and role.
Norwegian merchantmen had a crucial part in the battle of the Atlantic, and paid a heavy price
The eight most important navies of the Battle of the Atlantic are present in the game.
Great Britain
United States
Norway
Netherlands
Canada
Greece
France
Denmark
Within each category, I plan to have a few classes, so that the player gets the opportunity to discover new ships as they progress further into the campaign. I don’t have the final list of ships yet, but here are the six categories, themselves comprising a few classes:
The Liberty ship was the most iconic freighter of the conflict
Freighters: typical cargo ships, varying greatly in tonnage, anywhere from less than 1,000 tons to 10,000 and more. The Liberty class was by far the most popular. The U.S built them faster than the Germans could sink them, three every day at peak production. As the war progressed, the Allies started to arm freighters with up to four deck guns.
T2 tanker Hat Creek, August 1943
Tankers: often heavier than the freighters, they transported the fuel that powered the vehicles of the European theater.
Armed merchant cruiser HMS Alaunia
Troops and passengers transports / hospital ships / merchant cruisers: the most precious non warships for the Allies. Many transported a mix of troops, prisoners, and civilians, making them ambiguous targets. Standing orders forbade U-boats to sink civilian and neutral transports, but U-boat commanders sometimes attacked regardless, because of identification mistakes or excessive zeal. Passenger ships were sometimes converted into armed merchant cruisers, further muddying the rules. Hospital ships, like combat medics and ambulances, benefited from a protected status. But it didn’t stop anyone from targeting them, as the crew of the USS Comfort could attest, when they were attacked by a Japanese suicide aircraft. It crashed through three decks and exploded in surgery, filled with medical personnel and patients, killing 28, including six nurses.
Army Nurse First Lieutenant Mary Jensen surveys the damage
Note that regarding target discrimination, like anything else in the game, I won’t force any morality on the player. There’s no indication that the majority of U-boat commanders committed war crimes, but some did. And I think that the game shouldn’t sweeten historical reality. The player is free to be the commander they want. The reality is that even if violating the rules puts them at risk of disciplinary action by the high command, it’s far from guaranteed, especially in the later stages of the conflict. As war went on, the pool of able U-boat commanders kept shrinking, and Germany was losing U-boats at an alarming rate. In this situation, it was tempting to put tonnage sunk above every other consideration.
Flower class corvette HMCS Snowberry
Light warships: they comprise corvettes and sloops. Don’t get fooled by their small size, because they are formidable threats.
Fletcher class destroyer USS Fletcher
Heavy warships: fleet destroyers and destroyer escorts / frigates. They’re the ultimate U-boat killers, equipped with the best detection systems and armament. Destroyer escorts, optimized for anti submarine warfare, with a tighter turn radius, and more specialized armament, were reserved for convoy escorts. This freed the more powerful, general use fleet destroyers for bigger tasks.
Aircraft carrier HMS Ark Royal launching Swordfish aircraft
Unique ships: aircraft carriers, escort carriers, battleships, battlecruisers, and large ocean liners. They often traveled as part of task forces, under heavy protection. Unlike regular ships in the game, they’re drawn from a pool of unique, historical vessels, which spawn under specific conditions. They’re the most valuable and the most difficult targets to take down.
The Road Ahead
Given how much more there is, I’ll have to split this AI topic into at least three parts. Next time, which will come faster than usual because a good portion is already written, I’ll go over the enemy’s logic, and how this integrates with the convoy system.
Next time, I’ll explain the structure of Atlantic ’41 convoys
Following this will be the visual representation of depth charges attacks. All that work combined should complete the enemy’s movement and attack part of the turn, at which point I will have a playable engagement loop in basic form. Finally.
With the game able to spawn a convoy, the AI functional, sailing, diving, deck gun and torpedo attacks all working, I’ll be able to at last play test a full engagement. The game will still miss less important mechanics like various diving incidents, or men getting thrown overboard in storms. All that will come much later. After that, there’s the medium to long term plan:
Depending how combat plays, I’ll work at a combination of two things: fine tune/fix what’s there, and implement additional features necessary to get the combat to 90%. This includes the hydrophone, which gives the ability to spy on enemy’s activity. Without it, impossible to tell if it’s safe to surface and re engage.
New ship in Atlantic ’41: T2 tanker
Then I will need to integrate all the damage systems. At the moment, only torpedo tubes and deck gun have functional damage. But all other systems are crucial to a true combat gameplay, since they force the player to adapt their tactics. For instance, damaged dive planes prevent from diving. Damaged rudders limit the U-boat turn radius. Damaged electric motors limit submerged mobility. Damaged fuel bunkers leak and give the U-boat away. In addition to that, I’ll need the flooding and leaks system, since they can lead to the boat sinking, or unable to surface for extended periods of time.
New ship in Atlantic ’41: armed merchant cruiser
All these systems are already designed on paper, and most of them won’t be too difficult to build. However, I need a visual representation of all the U-boat’s systems and of the crew condition. That’s where the U-boat schematics view comes into play. And that will be the last big component for total combat readiness. Then, I plan to include all the sounds needed for that part of the game.
It would be premature to write about what happens beyond this point, but a good portion is on paper, or in my head. I’ll be honest: I’m shocked at how slow I’ve been to get to this point. Part of it comes down to the amount of work I put into the game. It’s not that I slack, but I don’t work as much as I should. I code or draw or write for the game every day, but with my other job, never more than two or three hours. I push six or seven hours on week end days, but that’s not enough. Devlogs take a decent amount of time, but I consider them part of the development, and I don’t want to cut the only link I have with future players.
Sinking a tanker at night
When I see full games made in less than three years, I wonder where my time goes. However, surprisingly, this doesn’t affect my enthusiasm. It’s always a joy to work on Atlantic ‘41, and I’m mostly happy with how it turned out so far. So I’ll keep grinding, and I hope you guys will stay along for the ride.
So, you know it, more soon.
Atlantic '41
A WW2 U-boat Simulation for the Playdate
Status | In development |
Author | StephanRewind |
Genre | Simulation |
Tags | 1-bit, Pixel Art, Playdate, Turn-based Strategy, World War II |
More posts
- Los!47 days ago
- Preparing the Future99 days ago
- Project ResetApr 01, 2025
- Small BeginningsFeb 24, 2025
- Death by a Thousand ShellsDec 17, 2024
- Next devlog a bit delayedOct 13, 2024
- First BloodAug 28, 2024
- Peril or SalvationJul 12, 2024
- An Important MilestoneMay 23, 2024
Comments
Log in with itch.io to leave a comment.
It is always a pleasure to read through your devlog posts and see just how much research and attention to detail is going into this game!