← All posts

technology

Hong Kong Birthday Patrol

Hong Kong Island rendered in Birthday Patrol, with the harbour, dense buildings and green hills.
Play Birthday Patrol (opens in a new tab) lyfar.com

Hong Kong publishes occupation-permit dates. I used them to give buildings birthday parties.

  • Pick an aircraft from the live feed and take control of its game twin.
  • Fly through glowing rings to deliver presents. A building turning 40 earns you 40 points.
  • Explore a stylised Hong Kong built with real terrain, building geometry and colours extracted from photographs.

That is Hong Kong Birthday Patrol. A fairly unreasonable use of a permit register. Also a good reason to look at the city properly.

Your plane has deliveries

The opening aircraft are backed by live ADS-B observations from adsb.lol : position, direction, speed and altitude. Browse the available planes, find one you like, and take over. From that moment, you’re flying a local arcade version. The real observation continues independently.

Takeover starts at 1,000 knots. Subtlety wasn’t the priority. On a phone, drag anywhere on the scene to steer, pinch to adjust the camera, and tap the throttle to change speed. A keyboard gets WASD or arrow keys.

Pick a date. Buildings with an occupation-permit anniversary on that day become your destinations. Follow the nearest marker and cross its ring. Presents, cakes and balloons fall; the building’s age goes into your score. Older buildings ask you to climb higher. Change the date and you get another delivery round. A tiny Web Audio synthesizer makes the launch and delivery chimes from oscillators, envelopes and echo.

The source is the Buildings Department’s public building information and age records . Our retained extract has 50,575 records with complete dates and coordinates. A permit date is our birthday rule, not a claim about when the first brick was laid. Records without a usable date stay out.

The secret intelligence behind this mission is a government CSV.

Birthday Patrol gameplay above Central, with glowing delivery rings and a mission for a building turning 33.
Paused gameplay for 12 November 2026. The rings mark permit anniversaries; the aircraft position belongs to the local game.

The city has the right bones

Hong Kong Island, Kowloon, the New Territories and the outlying islands share one scene. The hills begin with the Lands Department’s 5-metre Digital Terrain Model . Official map layers supply the coastline, sand, woodland, parks and water boundaries. Matching terrain from the 3D map supplies more detailed ground around buildings.

The 3D Visualisation Map supplies roofs, podiums and building shapes at their source positions. The current scene contains 217,133 building parts. Parts matter here: a podium and its tower can be separate objects, so that number isn’t a building census.

Colour took a different route. The pipeline samples each building’s own photographic model, weights wall samples by their area, and reduces them to a small palette for walls, glass, roofs and accents. The browser draws flat colours and procedural windows. The photographs stay out of the rendered scene.

That keeps the city recognisable without baking a photograph’s shadows and reflections into every facade. There are source-derived palettes for 217,032 parts. The other 101 have no usable source photographs and keep neutral materials. Those gaps are recorded.

Central waterfront buildings with coloured facade bands and procedural windows in Birthday Patrol.
Colours estimated from each building’s own photographic source, then drawn with flat materials and procedural windows.

Some things are measured. Some are drawn.

The coastline needs to be in the right place. The little pig wandering through woodland needs to be a little pig.

I kept that distinction explicit throughout the scene:

LayerWhere the facts end
BuildingsSource geometry and estimated photographic colours; illustrated windows and night lighting.
Trees and roadsMapped positions and routes; illustrated crowns, vehicles and movement.
WeatherHong Kong Observatory observations inform the display; clouds, haze and wind ribbons are visual interpretations.
WaterMapped shorelines and inland water boundaries; simulated waves and inferred basin levels.
Birthday partiesReal permit anniversaries; invented rings, presents and delivery rules.

The ocean runs four wave scales on the GPU. Fast Fourier transforms turn a spectrum of waves into a moving surface, combining broad swell with small ripples. Reflections, foam and the underwater treatment give it weight. Reservoirs stay calm. Beaches use mapped sand areas with illustrated shoreline profiles.

Hong Kong Observatory feeds also supplied the Gweilo weather prototype . Here, you can move the sun through the day, explore another date, or return to current conditions. Birds, people, traffic and woodland animals add movement nearby. They aren’t live counts or sightings.

A mapped Hong Kong beach beside illustrated waves, trees, roads and buildings.
Mapped sand and coastline meet simulated waves and illustrated beach grading.

A whole city, one browser

The renderer uses Three.js and WebGL. Before anything reaches it, Python scripts fetch and prepare the geographic layers, transform coordinates, extract colour palettes and split permit records into daily mission files. JavaScript build tools simplify and pack the geometry. Your browser gets the prepared pieces.

Buildings arrive as compressed GLB files with several detail levels. The loader chooses detail by how much a simplified shape would differ on screen. Meshopt’s WebAssembly decoder runs in persistent workers, keeping decompression off the rendering thread. Upcoming tiles load along the flight corridor, and bounded memory and browser caches reuse places you’ve already visited. The loading code has a stagehand’s job: get the replacement ready before taking the current set away.

Roads and terrain share the same height fields. During a terrain transition, the road shader follows the same changing ground, so a sharper hillside doesn’t leave its road floating. Small creatures and traffic use instanced batches with limits on how many can appear nearby.

The first phone-profile run still hit 12 CPU stalls longer than 50 milliseconds. After the rendering and streaming work, a matched 20-second flight had zero, with 29.8% fewer submitted triangles. These were browser measurements on a Mac M5 Max at phone dimensions. Physical iPhone performance needs its own test.

Cloudflare serves the built scene and assets. Small endpoints on the same site relay the wind and aircraft feeds.

Birthday Patrol in a portrait phone browser layout, with a delivery ring, mission card and touch flight controls.
The touch layout: drag to steer, pinch the camera and use the side throttle. Captured in a mobile browser profile.

A permit record becomes easier to remember when you’ve flown over its roof carrying a cake. I like that as a way into public data. Give someone a place to explore and a reason to look closer.

The source code is on GitHub , with the renderer, data preparation scripts and local setup. The repository keeps the code licence and geographic-data terms separate.

Choose a plane and make a delivery .

Map data © HKSAR Government and the respective departments, via the CSDI Portal . Rendering and screenshots by Lyfar Studio.

Interested in this?

Learn about Technology →