Fog Tank devlog ·

Fog of war in an action game: how Fog Tank's line of sight works

Fog of war belongs to strategy games: real-time strategy, wargames, board games with hidden units. Fog Tank puts it into a fast 80s-style tank arcade game instead, where you have a fraction of a second to react to whatever comes out of the dark. This post explains exactly what you can see, what you remember, and why it changes how the game plays.

A tank lit inside its field of vision, with explored walls dimly remembered and unexplored map in black
Lit ground is what your tank sees right now. Dim ground is memory. Black has never been seen.

What your tank can see

Your tank sees about 6.5 tiles in every direction, but only along clear lines of sight. Brick, steel and trees all block your view, so a single wall throws a shadow across everything behind it. The field of view is recalculated every frame as you drive, which means turning a corner opens up a corridor all at once, just as it would in real life.

Anything outside that field is hidden, and that includes enemy tanks and their bullets. You find out where an enemy is when it drives into your view, not before.

What you remember

Ground you have already seen does not go black again. It stays on the map, drawn dimly, exactly as it looked the last time you saw it. That is enough to navigate by: you know where the walls and the river were.

But memory goes stale. If an enemy shoots through a brick wall while you are looking elsewhere, your map still shows the wall standing until you look at it again. The safe route you remember may already have a hole in it.

Trees: cover you can shoot through

Trees block sight but not bullets. A treeline is the most dangerous terrain on the map: an enemy tank inside it is invisible until it steps out, yet you can fire straight through it if you guess where the enemy is.

Driving into trees yourself changes what you see. From inside a thicket you see the rest of that connected bush, up to 2 tiles around you, but not the open ground beyond it. You only see out of a bush from its edge. Hiding in the trees is a trade: nothing out there can see you, and you cannot see it either.

A fogged stage: the player's tank on open ground beside a treeline near its base, an enemy tank visible further off, and unexplored areas in black
A treeline beside the base. Whatever is inside it stays hidden until it moves out.

Your base keeps watch

The eagle you are defending sits behind its own brick fort, so a normal line of sight from it would see nothing past the bricks. Instead it reveals a fixed ring of ground 3 tiles out in every direction, walls or no walls. You can always see who is at the gate.

You can also hear it. When bricks break near the base, the game plays a two-note alarm, so you know the fort is under fire even from the far side of the map, and you have to decide whether to turn back.

What the enemy knows

The fog is your problem, not a stealth system. Enemy tanks do not hunt you; they push toward your base and fire on a rhythm of their own, the way the tanks in the 1985 original did. What changes is that you no longer get to watch them coming. Scouting, guessing and remembering replace reading the whole screen at a glance.

Power-ups glow through the fog

There is one deliberate exception to the fog: power-ups. When a flashing enemy is destroyed it drops a bonus, and that bonus is always visible wherever it lands. You can see the prize from anywhere. You cannot see what is waiting next to it.

Two players, two fields of view

In two-player co-op both tanks light up the fog, and the map shows everything either of you can see. Splitting up shows you twice as much of the battlefield; staying together means one of you can cover the treeline while the other drives past it.

How it is built

For anyone building something similar: the map is a 13×13 grid of tiles, and vision runs on a grid of half-tiles, 26×26 cells. Every frame, each cell is in one of three states: hidden, explored or visible. Visibility comes from recursive shadowcasting, run in eight octants from each cell the player's tank covers. Each cell also keeps a copy of the terrain it had the last time it was visible, and explored cells are drawn from that copy rather than from the live map. That copy is what makes memory go stale. The base is not a line-of-sight source; it is an unconditional reveal, because its own fort would block it.

The game is plain TypeScript and Canvas with no runtime dependencies, and it runs offline once loaded.

Try it

Fog Tank is free in your browser, with no download and no account: 35 stages, local two-player, and a level editor where you can build your own ambushes and share them as a short link.

Play Fog Tank free