How huarox/luftlinie works
1. Repository shape
- This repo is intentionally minimal: a single index.html contains the entire application, with only README, license, and ignore rules alongside it.
- Architecturally, it is a client-side monolith hosted as static files, with no build step and no custom backend service.
2. Primary runtime boundary
- The app runs entirely in the browser on mobile devices and desktop spectators.
- All game logic, UI state, GPS handling, and rendering live in the frontend; persistence and synchronization are delegated to external services.
3. Core app roles
- The game is split into three user-facing roles:
- Host: creates the game, selects target placement, and controls game settings.
- Navigator: joins on a phone and receives only distance/direction feedback while moving in the real world.
- Spectator: watches a live map view with player routes and status.
- These roles are represented as different UI states over the same underlying shared game session.
4. Real-time game state subsystem
- Shared session state is stored in Firebase Realtime Database.
- Firebase is the central coordination layer for:
- game codes and session metadata
- player presence and position updates
- target position changes
- timers, elimination events, and mode-specific transitions
- Because updates are pushed in real time, the app does not rely on polling.
5. Location and motion subsystem
- The navigator experience depends on browser GPS/geolocation updates.
- The app continuously converts current GPS position into:
- straight-line distance to target
- arrival detection
- movement/velocity feedback for modes like Hot & Cold
- compass-relative bearing for Sailor mode
- GPS accuracy is surfaced as a first-class UI signal, including blocked/poor/live states.
6. Map and route rendering subsystem
- The spectator/results views use Leaflet with CartoDB tile layers for the map base.
- Player tracks, target markers, and color-coded routes are rendered on top of the map.
- Route shapes are likely fetched from an external routing service rather than computed locally.
7. External data services
- OSRM public API is used for routing-related path visualization.
- Overpass API is used by Smart target placement to find realistic road-based targets near the desired distance.
- These APIs materially affect the game experience: target placement is road-aware, and spectator maps can show route context rather than just points.
8. Mode engine
- The application contains multiple game modes that alter how the shared session state is interpreted and what navigators see:
- Standard
- Elimination
- Whisper
- Hot & Cold
- Sailor
- Multi-Target
- Dynamic
- These modes are not separate subsystems; they are behavioral overlays on the same core game/session model.
9. Results, replay, and sharing
- After game completion, the app switches to a results flow that includes:
- winner and leaderboard
- route stats
- replay of player trails
- shareable vertical result card image
- This is a distinct post-game UI boundary built from the same stored session history and player track data.
10. Local persistence and continuity
- The app uses localStorage for persistent player stats across sessions.
- Rejoin support and session recovery are also client-managed, allowing a player to reconnect after reload within a limited window.
- This is separate from Firebase session state: local storage is for personal history and convenience, while Firebase is for live multiplayer state.
11. Progressive-web-app concerns
- The repository supports PWA-style installability and mobile-first operation.
- Because GPS access requires HTTPS, deployment is expected on a static HTTPS host such as GitHub Pages.
12. Security and trust model
- There is no authentication layer described; the game relies on open Realtime Database rules during development or permissive production rules.
- The README emphasizes validation rules to prevent malformed writes, but not access control.
- That means the architecture is intentionally lightweight and trust-based, suitable for small multiplayer sessions rather than hardened public tenancy.
13. Recommended diagram boundaries
- A good architecture diagram would show:
- browser clients for host/navigator/spectator
- a shared Firebase Realtime Database in the center
- browser GPS / device sensors feeding navigator state
- external APIs for Overpass, OSRM, and map tiles
- localStorage as a per-device persistence layer
- GitHub Pages or any static host as the delivery mechanism for index.html
Main entry points: index.html App shell · README.md README
Components 17
Delivery
Static hosting and repository docs
- Static host · HTTPS static delivery for the app
- README · Project description and operational notes
README.md
Browser client
Single-page app and in-browser runtime boundaries
- App shell · Client-side monolith containing the full application
index.html - Host view · Creates sessions, chooses placement, and controls settings
index.html - Navigator view · Mobile play view with live distance, direction, and GPS feedback
index.html - Spectator view · Live map and route monitoring for observers
index.html - Results flow · Winner, leaderboard, replay, and share card screens
index.html - Mode engine · Standard, elimination, whisper, hot and cold, sailor, multi-target, and dynamic behaviors
index.html - GPS sensor · Browser geolocation input and accuracy states
- Distance calc · Computes distance, bearing, arrival, and motion feedback
index.html - Map renderer · Leaflet map with routes, markers, and live trails
index.html - Route logic · Builds route context for spectator and results views
index.html
Shared state
Live multiplayer coordination and local persistence
- Realtime DB · Shared game codes, presence, targets, timers, and updates
- Local stats · Per-device persistence for player history and rejoin continuity
External services
Third-party APIs for maps, routing, and target placement
- Overpass API · Road-aware nearby target discovery
- OSRM API · External routing source for path visualization
- Carto tiles · Basemap tiles used by the map view
Connections 20
- Static host → App shell: serves · Static host delivers the single-page app
- App shell → Host view: renders · Host role is a UI state in the app
- App shell → Navigator view: renders · Navigator role is a UI state in the app
- App shell → Spectator view: renders · Spectator role is a UI state in the app
- App shell → Results flow: renders · Post-game screens reuse the same client state
- App shell → Mode engine: applies · Mode-specific behavior overlays the shared session model
- Navigator view → GPS sensor: reads · Navigator view consumes device location updates
- GPS sensor → Distance calc: feeds · Location and accuracy drive navigation calculations
- Mode engine → Distance calc: modifies · Modes adjust feedback and elimination logic
- Distance calc → Realtime DB: updates · Live position and status are synchronized in realtime
- Host view → Realtime DB: writes · Creates and configures shared sessions
- Spectator view → Realtime DB: subscribes · Spectator view watches live session state
- Realtime DB → Map renderer: streams · Routes, trails, and target state update the map
- Map renderer → Carto tiles: uses · Leaflet renders on top of Carto basemaps
- Route logic → OSRM API: queries · Route shapes are sourced externally
- Mode engine → Overpass API: queries · Smart target placement searches for realistic roads
- Results flow → Local stats: reads/writes · Persistent player stats and continuity live on device
- Results flow → Route logic: shows · Replay and route stats are assembled from stored tracks
- Route logic → Map renderer: draws · Replay paths and route context are visualized on the map
- README → App shell: describes · Repository documentation points to the single-file app