Skip to content

Day 1: A comic filter over NASA images

· by nicroc

Every strategy game stands or falls with its map. In WebCiv the map is not some fantasy island, it is our Earth. So that is exactly where I started. This diary tells the story of how WebCiv is made, from day 1 onwards: what was built, in which order, and what ended up in the bin again.

How the work is done here

One thing up front, because honesty demands it: I am not building WebCiv alone with my ten fingers. The programming is done in tandem with an AI assistant (Claude). I set the direction, try things out, decide and discard, and I do that rather often. The AI writes a large part of the code and the tests. Whenever this diary says “we”, this team of two is meant. The ideas, the taste and the blame for every bad decision are mine.

At the end of every entry there is a logbook: all commits of the period, that is, the individual saved states of the work, each with the time, its short id and an explanation in plain language.

The idea

With Blue Marble, NASA makes beautiful satellite images of the whole Earth freely available. I took the images from July, not the ones from December, otherwise half of Europe would be lying under snow. A comic filter was to run over them, and the game world would be done.

The goal behind it was clear from the start: a browser game in the spirit of the first Civilization, with research, founding cities and expansion, but with 100 and more players on one single, huge world map.

The foundation first

Before there was anything to see, the project needed a framework. WebCiv runs on Laravel, a PHP framework that takes care of login, database and much more for me. On top of that came an admin area for me and a first data model: players, game rounds, sign-ups.

On the very first day there was also already a simple home page, a login, the option to sign up for a game round, and a very first game view. Much of it was more sketch than game, but it showed where the journey was meant to go.

The technology behind the map

A map of the whole Earth is huge. The largest source images are 86,400 pixels wide; no browser loads that in one piece. That is why the map is cut into a tile pyramid: for every zoom level there are small tiles, and your browser only fetches the ones you are looking at right now. I built something like this once before, years ago, with NASA image segments; this time it was meant to be done properly.

The map generator of the first day could already do quite a lot: load the NASA sources, put the comic filter on top, cut the tiles and record for every field which terrain lies there.

The first battles

Along the way came the first battles with the technology:

  • The image-processing tool that is meant for images this large was missing on my machine. So a fallback route was needed that processes the giant images in pieces.
  • Seams were visible between the tiles, fine lines exactly where two pieces meet.
  • The elevation thresholds were wrong: from which height on is something a mountain range? That only fitted after some trial and error.

The result

It worked, but it did not look like what I had in my head. A filter over a photo remains a filtered photo. Coasts turned blurry as soon as you zoomed in close, and the comic look came across more like a washed-out watercolour.

So I made a decision that hurts: everything back to square one. How it went on is in the next entry.

Logbook: Saturday, 31 October

  • 12:24 · d35424a The very first commit. Two files: a project description and the list of files that are not to be saved. Nothing more, but every project starts somewhere.
  • 13:45 · 3661227 The basic framework: Laravel 13 with admin area, login and the first data model. 120 files in one go, most of them supplied by the framework.
  • 13:52 · 5c0efcd The first home page, the pages for login and registration, the sign-up for game rounds, the start of a round and a first game view.
  • 14:07 · 59e9f4c The world map generator: NASA sources, comic filter, tile pyramid, the terrain grid and the map management in the admin.
  • 14:19 · 0ee49f8 The repairs: the fallback route for giant source images, the seams between the tiles and newly adjusted elevation thresholds.