Blind Salvo, a tactical roguelike built on Battleship
Blind Salvo is a tactical roguelike built on Battleship. You command a salvage fleet across a branching campaign, spend Energy each turn on scans, missiles and warp jumps, and hunt enemy fleets you can't see. I built it alone in Godot 4 and GDScript, about 21,000 lines, for desktop, Android and iOS, with online PvP and in-app purchases.
This post is about the engineering decisions that made a one-person project of that size manageable: keeping the rules separate from everything else, an AI that can't cheat, saves that survive quitting in the middle of a turn, deterministic online play, and tests that play the game for me.
The rules engine
Everything that decides an outcome lives in one class, Battle, which has no dependency on the
UI. The player, the AI and an online opponent all act on it through the same two calls,
use_weapon() and end_turn(), so there is exactly one implementation of the rules,
and the AI can never take an action the player couldn't.
Scroll sideways to see the whole diagram.
Battle, so they follow exactly the same rules.Content is added through small, uniform extension points rather than special cases. A weapon is a subclass that implements three methods: its targeting pattern, which targets are valid, and what happens when it fires. The HUD builds its buttons and hotkeys from the loadout list, so a new weapon needs no UI code. Upgrades, items, hull passives, status effects, hazards, events and boss traits work the same way: add an entry to a library, and the shop, the AI and the save system pick it up. A hull is any set of connected tiles, and rotation and rendering are handled for every shape.
An AI that doesn't cheat
The easiest way to make a Battleship AI good is to let it peek. Blind Salvo's AI never sees ship
positions. It reads the board only through AIIntel, a set of read-only helpers that expose
what an attacker could legitimately know: its own shots, sunk ships and sensor readings. On top of that,
it plays a classic hunt-and-target strategy extended to every ability:
- While there are unfinished hits, it fires along the line of hits, or at their neighbours.
- Otherwise it hunts with salvos, barrages and sensor pulses, follows up positive readings, and skips tiles a scan has already proved empty.
- It uses the same consumable items as the player, and sometimes warps a damaged ship away from a spot you've found.
Because the AI and the player share the rules engine, AI-versus-AI battles run headless as a test. A separate balance report fires every attack at thousands of randomly generated fleets and prints tiles covered and expected hits per Energy, so a new weapon's cost can be set from numbers rather than feel.
Saving in the middle of a turn
Mobile players quit whenever their phone tells them to, so the game saves after every map stop, purchase
and battle result, and checkpoints a battle after every action and at the start of every turn.
BattleSnapshot serializes both boards, every ship, all shots, hazards and intel, Energy,
statuses, items and whose turn it is. Derived values like combat stats aren't stored; they're rebuilt from
the run and the encounter exactly as when the battle started, which keeps saves small and stops them
drifting from the code. Quitting during the enemy's turn replays that turn from its start, so a player
can't use a relaunch to dodge a bad outcome.
Deterministic online play
Online PvP uses lockstep rather than a server simulation. A 283-line Python relay pairs players, by random
matchmaking or a friend code, and forwards messages; it never runs game logic. The host rolls a setup (a
seed, a hazard and who moves first), and both clients build the same match and run the same
Battle from that seed. They exchange only their own fleets and their actions.
Scroll sideways to see the whole diagram.
Lockstep only works if every source of randomness that affects gameplay is seeded and consumed in the same order on both machines. Gameplay draws from a battle RNG derived from the match seed, while cosmetic effects like combat particles use their own RNG, so a particle burst can never shift a gameplay roll. Every action carries a checksum of the battle state, and a mismatch is detected and reported instead of two players silently seeing different games.
The trade-off is that each client has to be trusted. Each one holds both fleets, so a modified client could read the opponent's layout from memory. That's acceptable for friendly matches; ranked play would need an authoritative server that holds the fleets and resolves shots.
One store layer for three platforms
Cosmetic fleet skins are sold through each platform's own store. SkinStore picks one backend
at startup behind a single interface: Steam DLC through GodotSteam, Google Play Billing on Android, and
StoreKit 2 on iOS, with Restore Purchases where Apple requires it. A plain desktop build has no store and
simply hides the buttons. A MockStore backend fakes purchases, failures and cancellations, so
the whole purchase flow is tested without a real store. Shipping on iOS meant building the StoreKit 2
plugin from source against the exact Godot version.
Tests that play the game
A roguelike has too many paths to check by hand, so most of the testing is scripts that drive the real game:
- Headless simulations run AI battles, save and load round trips, passives, unlocks, map generation and events.
- UI scripts walk full flows, at phone and desktop sizes: the tutorial from start to finish, quitting mid-battle and resuming on the same turn, the drydock, the store against the mock backend, and the story beats.
- For PvP, a local relay and two headless clients play the same room, and their final RESULT lines must match: an end-to-end determinism test.
- A gallery script screenshots every screen at phone and desktop sizes for visual review.
Every test runs against separate test data, so it can never touch a real save or profile.

