Skip to content

Decision ADR-0010 · The Lighthouse

Each visitor's own sky, from the edge's city-level location

Accepted ·

Context

Kenil wants the island to feel like real life: the sun, moon, stars, shadows and park lamps should follow the real sky of the person looking at it, and show their city. A browser GPS prompt felt intrusive for a portfolio. He chose "city from IP, no pop-up, never stored, never shown to others".

Decision

  • Source: CloudFront's geolocation headers on the /rt WebSocket upgrade.
    • CloudFront-Viewer-Latitude, -Longitude, -City, -Country-Region-Name, -Country, -Time-Zone.
    • At M6, the /rt origin request policy must forward them.
  • Delivery: the realtime server sends them back only to that socket, as welcome.viewer, with coordinates rounded to 0.01° (about 1 km).
  • Privacy: they are never logged, persisted, broadcast, or put in telemetry.
  • Fallback order in the browser (apps/web/src/world/env/sky-location.ts):
    1. ?sky=lat,lon,City, for QA only;
    2. the edge's welcome.viewer;
    3. the browser's IANA time zone, mapped to its main city;
    4. Ahmedabad, Kenil's city.
  • Display: a chip reads "Sky over {city} · {local time}". Its tooltip says the location is approximate and not stored.
  • Lamps: the shared lamp switch is now auto | on | off.
    • In auto, each visitor's lamps follow their own sunset and sunrise.
    • Anyone can force them on or off for everyone. The override lasts 20 minutes (LAMPS_OVERRIDE_MS), then reverts to auto.
    • The server no longer computes the sun.
  • Local dev: tools/dev-edge adds the same headers. Defaults come from DEV_VIEWER_* and point to Ahmedabad.

Consequences

  • + No permission prompt. City-level accuracy is plenty for the sun's position.
  • + Location stays with the visitor; other players only ever see callsigns.
  • + Each visitor's sky is computed in their browser, at no server cost.
  • − VPNs and mobile carriers can place someone in another city. The sky is then slightly off, which is harmless.
  • − Visitors in different places see different light on the same island. That is intended: it's their own sky.