← Back to the gamebug or idea?Terrapin Trail//Code BibleIIhow the game works, archive to van
Reel 13 · 6 min read

Where the tours come from

How real concerts on the Internet Archive become a playable tour, a map, and music you can hear.

Every tour in this game is real. It comes from the Internet Archive's Live Music Archive, where fans have shared recordings of hundreds of thousands of concerts. This chapter follows the data from the archive to your screen.

Concept: "API". An API is a way for one program to ask another for data. The Internet Archive has one: ask it 'every recording by this band' and it answers with a list the code can read.

From the archive to a tour

  1. Bands. One question to the archive lists every band collection, about 7,800 of them.
  2. Shows. For the band you pick, the server fetches every recording. Many fans may have taped the same night, so recordings are grouped into one entry per night.
  3. Tours. A year's nights are split into tours wherever the band took more than eleven days off:
●archive.py : 293–307trace ↗
293def _split_into_tours(nights: list[dict]) -> list[list[dict]]:
294    """Split date-sorted nights into runs, breaking where a long gap appears."""
295    runs: list[list[dict]] = []
296    current: list[dict] = []
297    prev: date_cls | None = None
298    for n in nights:
299        d = date_cls.fromisoformat(n["ymd"])
300        if prev is not None and (d - prev).days > _TOUR_GAP_DAYS:
301            runs.append(current)
302            current = []
303        current.append(n)
304        prev = d
305    if current:
306        runs.append(current)
307    return runs
Walk through the nights in date order; a long gap starts a new tour.
  1. The legendary night. The night with the most recordings is marked legendary. The idea: the more people kept a show, the more celebrated it was.

Concept: "cache". A cache is a saved copy of something that was slow to get. The server saves every list it fetches from the archive, so the next player who picks the same band gets it instantly.

Putting towns on the map

To draw the route and count the miles, each town needs a position. The game knows towns of about 15,000 people and up. For a smaller US town, it uses the middle of its state, which is close enough to estimate a drive:

●geocode.py : 166–177trace ↗
166def resolve(coverage: str | None) -> Place | None:
167    """Resolve a coverage string to a Place, falling back to the state's centre for
168    a US town too small for the city index."""
169    place = _resolve_city(coverage)
170    if place is not None or not coverage:
171        return place
172    parts = [p.strip() for p in coverage.split(",")]
173    st = _region_to_us_state(parts[1]) if len(parts) > 1 and parts[1].strip() else None
174    if st and st in _STATE_CENTERS:
175        lat, lon = _STATE_CENTERS[st]
176        return Place(parts[0], lat, lon, st, "US", 0)
177    return None
Try the town list first; if it's a small US town, use its state's centre. (Before this fix, Alta, Wyoming landed in Alta, Norway.)

The music

For each night, the server reads the recording's file list and keeps the songs, in order, with the name of the fan who taped it. The songs play straight from archive.org, both in the browser and on the van stereo inside the game.

The ideas to keep
  • An API lets the server ask the Internet Archive for bands, shows and songs.
  • Recordings become nights, nights become tours, and the most-recorded night is legendary.
  • A cache keeps everything the server fetched, so it's fast the next time.
  • Small towns go to the middle of their state on the map.