DEV Community

muxin
muxin

Posted on

Building a Fast, Zero-Paywall HTML5 Canvas Map & GeoGuessr for GTA 6 Leonida

Most companion interactive maps for open-world games suffer from two frustrations: heavy DOM marker bloat that drops frame rates once 1,500+ pins render on mobile, and arbitrary 100-pin paywalls that lock completionists out unless they subscribe.

While exploring community cartography for Rockstar Games' upcoming State of Leonida, I built GTA 6 Streets โ€” a lightweight, vanilla JavaScript + HTML5 <canvas> atlas tracking 1,784+ named points of interest (plus 2,300+ secondary street sites), alongside a browser-based GTA 6 GeoGuessr location game.

Here is a quick breakdown of the rendering and data techniques that kept the entire interactive bundle under 95 KB with zero framework dependencies.


1. Multi-Tier Pyramid Tiles + Instant Borderless Fallback on <canvas>

Instead of mounting thousands of DOM nodes over Leaflet or Mapbox GL, the entire atlas runs in a single hardware-accelerated 2D <canvas> loop:

  • Zero-Blank First Paint: A lightweight borderless WebP base overview (~40 KB) paints the full State of Leonida on the first animation frame while visible viewport tiles stream in asynchronously across 6 zoom levels (k = 0..6).
  • Multi-Mirror WebP Acceleration: Every street tile and location screenshot tries a wsrv.nl WebP edge proxy first (q=82), with automatic timeout failover to cdn.jsdelivr.net and raw GitHub mirrors so broken CDN nodes never leave blank squares.
  • Path2D Vector Shields (evenodd): Category icons are stored as compact SVG path strings around [-10..10, -10..10], instantiated once as new Path2D(d), and shared identically between <canvas> map markers and sidebar <svg> filter badges.

2. Packing 4,100+ Photo Availability Flags into a 1.4 KB Bitset

Over 600 locations in the dataset (adapted from open-source community street triangulation at gtadb.org under CC BY 4.0) carry both in-game trailer captures and real-life South Florida Street View counterparts.

Rather than shipping photo URLs in the initial JSON payload or firing speculative HEAD requests that 404 in the console:

// 2 bits per location ID: bit 0 = In-Game frame, bit 1 = Real-Life counterpart
function photoFlags(numId) {
  if ((numId >> 2) >= PHOTO_BITS.length) return 0;
  return (PHOTO_BITS[numId >> 2] >> ((numId & 3) * 2)) & 3;
}
๐Ÿ”ด Live TV: muxin/building a fast zero paywall html canvas map geoguessr for gta leonida pi - Info Live Streaming 2026 ๐Ÿ”ด Live TV: muxin/building a fast zero paywall html canvas map geoguessr for gta leonida pi - Info Live Streaming 2026

A single Base64-encoded Uint8Array (~1,400 chars) tells the UI instantaneously whether to reserve a 152px zero-CLS shimmer skeleton and whether to display the In-Game / Real-Life toggle bar.


3. Turning Verified Trailer Sightlines into a Seeded GeoGuessr Mode

Because each verified landmark already maps pixel coordinates (mx, my) to in-game meter coordinates (gx, gy), building GTA 6 GeoGuessr took only ~25 KB of self-contained JS:

  1. Regional Stratification: An 80-landmark pool is split evenly across five distinct geographic zones (Vice Beach, Mainland Vice City, Port Gellhorn & Kelly County, Hamlet & the Leonida Keys, and Northern Leonida) so every 5-round seed tests completely different architecture and terrain.
  2. Deterministic mulberry32 Seeds: Hashing either today's calendar date (Daily Challenge) or a 6-digit ?seed= query parameter guarantees two friends clicking a shared link get the exact same five frames in the exact same order.
  3. Exponential Meter Scoring: Guesses within 65 m award a perfect 5,000 points, decaying smoothly via 5000 * Math.exp(-distMeters / 2100), then unlocking the real-world Miami / Key Largo photo comparison right after locking in your pin.

Try It Live

Feedback on canvas touch inertia, cluster spiderfying, or tricky Leonida street rounds is very welcome!

Top comments (0)