How oc-ean/endless_lane_rush works
Purpose and entry points
Lane Rush is a browser-based endless lane-driving game. Vue boots from src/main.ts, mounts the application shell in src/App.vue, and routes between landing, instructions, and gameplay screens through src/router/index.ts.
Route-level experience
The router separates non-game screens from the active simulation:
• Home/start screen: src/views/HomeView.vue
• Instructions and control reference: src/views/InstructionsView.vue
• Primary runtime surface: src/views/GameView.vue
GameView is the orchestration boundary that combines the road, cars, HUD, controls, and pause/game-over overlays.
Central game state and loop
src/stores/game.ts is the core domain authority. It holds game lifecycle state (running/paused/ended), score/high-score and difficulty progression, player lane/jump state, and obstacle movement/collision-related state. It also owns or coordinates the game-loop logic, making Pinia the primary shared-state and simulation boundary rather than individual components.
Domain contracts are centralized in src/types/index.ts, allowing views, store, and visual entities to share typed game models.
Runtime visual entities
Gameplay is rendered as a composition of focused Vue components:
• Road/world presentation: src/components/RoadBackground.vue
• Player visual state and interactions: src/components/PlayerCar.vue
• Moving traffic/obstacles: src/components/ObstacleCar.vue
These components should remain render-oriented consumers of store-provided state; game rules, spawning, speed scaling, and collision decisions belong in the game store.
Input and gameplay lifecycle
src/composables/useGameControls.ts bridges browser input to game actions. It supports keyboard controls plus mobile swipe/tap gestures, and should attach/remove listeners with the gameplay view lifecycle. Actions flow from this composable into src/stores/game.ts, which validates them against lifecycle state (for example, ignoring movement while paused or over).
Lifecycle presentation is separated into:
• Active score and pause control: src/components/GameHud.vue
• Pause state: src/components/GamePauseModal.vue
• Terminal score/restart state: src/components/GameOverModal.vue
Audio and asset boundary
src/composables/useSounds.ts encapsulates browser audio behavior and exposes gameplay-triggered sound effects without embedding audio control in car or HUD components. Styling and static visual assets are local: src/assets/base.css, src/assets/main.css, and src/assets/images.
Platform and deployment
The application is a Vue 3 + TypeScript single-page app built and served by Vite (vite.config.ts). Tailwind is part of the styling pipeline (tailwind.config.js, postcss.config.js). Production output is static and configured for Vercel deployment through vercel.json; no backend, database, or external runtime service is indicated.
Main entry points: GameView.vue Game runtime surface · game.ts Game state and loop · index.ts Route coordinator · App.vue Application shell
Components 20
Application
- Vue bootstrap · Creates and mounts the SPA.
src/main.ts - Application shell
src/App.vue - Route coordinator · Separates informational screens from active gameplay.
src/router/index.ts - Home screen
src/views/HomeView.vue - Instructions screen
src/views/InstructionsView.vue
Gameplay runtime
- Game runtime surface · Composes simulation visuals, controls, HUD, and lifecycle overlays.
src/views/GameView.vue - Game state and loop · Owns lifecycle, scoring, progression, movement, spawning, and collision decisions.
src/stores/game.ts - Game contracts
src/types/index.ts - Browser controls · Maps keyboard and touch gestures to validated game actions.
src/composables/useGameControls.ts - Game sounds · Encapsulates browser audio effects.
src/composables/useSounds.ts
Gameplay UI
- Road world
src/components/RoadBackground.vue - Player car · Renders player lane and jump state.
src/components/PlayerCar.vue - Traffic obstacles · Renders store-provided moving traffic.
src/components/ObstacleCar.vue - Game HUD · Shows active score and pause control.
src/components/GameHud.vue - Pause overlay
src/components/GamePauseModal.vue - Game-over overlay · Presents terminal score and restart.
src/components/GameOverModal.vue - Styles and images · Local CSS and visual assets.
src/assets
Build and deployment
- Vite build server · Builds and serves the Vue SPA.
vite.config.ts - Tailwind pipeline
tailwind.config.js - Vercel static deploy · Deploys the production static output.
vercel.json
Connections 25
- Vue bootstrap → Application shell: mounts
- Application shell → Route coordinator: hosts
- Route coordinator → Home screen: routes to
- Route coordinator → Instructions screen: routes to
- Route coordinator → Game runtime surface: routes to
- Game runtime surface → Browser controls: binds lifecycle
- Browser controls → Game state and loop: dispatches actions
- Game runtime surface → Game state and loop: orchestrates
- Game state and loop → Game contracts: uses models
- Game runtime surface → Game sounds: triggers effects
- Game runtime surface → Road world: renders
- Game runtime surface → Player car: renders
- Game runtime surface → Traffic obstacles: renders
- Game runtime surface → Game HUD: renders
- Game runtime surface → Pause overlay: renders by state
- Game runtime surface → Game-over overlay: renders by state
- Game state and loop → Player car: provides visual state
- Game state and loop → Traffic obstacles: provides obstacle state
- Game state and loop → Game HUD: provides score and lifecycle
- Game state and loop → Pause overlay: provides pause state
- Game state and loop → Game-over overlay: provides terminal state
- Styles and images → Application shell: styles UI
- Vite build server → Application shell: builds
- Tailwind pipeline → Vite build server: processes CSS
- Vite build server → Vercel static deploy: produces static output