How setube/ogame-vue-ts works
Purpose and Delivery Targets
OGame Vue TS is a local-first, single-player space-strategy game: browser gameplay, encrypted local persistence, optional WebDAV backup/sync, and packaged desktop/mobile delivery. The primary web bootstrap is src/main.ts, which mounts the Vue application from src/App.vue. Alternative shells include Electron (electron/main.ts), Capacitor Android (android/app/src/main/java/games/wenzi/ogame/MainActivity.java), and a Go-based web-service build target (main.go).
Application Composition and Navigation
Vue 3 + TypeScript provides the client runtime; Pinia stores own mutable game/UI state and Vue Router selects gameplay screens. The root app coordinates global layout, dialogs, notifications, and routed content. Major game domains are represented as views—empire construction, research, fleets, galaxy, diplomacy, campaign, rankings, settings, and battle simulation.
Paths: src/App.vue, src/router/index.ts, src/views/OverviewView.vue, src/views/GalaxyView.vue, src/views/BattleSimulatorView.vue.
State, Persistence, and Security Boundary
The game is designed to run without a central game backend. gameStore is the primary gameplay state boundary; universe/NPC state and detail-dialog state are separated into dedicated Pinia stores. Persisted progress is encrypted before browser-local storage through crypto and migration utilities. This makes browser storage the authoritative save source, while version/migration handling protects upgrades.
Paths: src/stores/gameStore.ts, src/stores/universeStore.ts, src/utils/crypto.ts, src/utils/migration.ts.
Rules Engine and Simulation Pipeline
Domain logic is deliberately separated from Vue components. Player actions flow from views/stores into rules modules that validate prerequisites, compute resource costs and timers, manage queues, and update empire state. The core domains cover buildings, research, ships/defense, fleets, planets/moons, officers, diplomacy, achievements, campaign progression, and resource production. Battle calculation is isolated further for simulator and combat-report consumers.
Paths: src/logic/gameLogic.ts, src/logic/buildingLogic.ts, src/logic/fleetLogic.ts, src/logic/battleLogic.ts, src/utils/battleSimulator.ts.
Asynchronous Gameplay and Heavy Computation
Time-based construction/research/fleet work is modeled through queue logic and UI queue animation. Battle processing can execute in a Web Worker, keeping expensive simulations off the main rendering thread; workerManager is the application-side worker boundary. Resulting state drives reports, alerts, unlock overlays, and other gameplay dialogs rather than requiring server callbacks.
Paths: src/logic/waitingQueueLogic.ts, src/composables/useQueueAnimation.ts, src/workers/battle.worker.ts, src/workers/workerManager.ts, src/components/dialogs/BattleReportDialog.vue.
Content, UX, and Localization
Static game balance/content is centralized in configuration modules, while components render domain-specific interfaces and reusable shadcn-vue-style primitives. Custom i18n selects among bundled locale dictionaries. Theme behavior is client-side and styling is rooted in global CSS/Tailwind variables.
Paths: src/config/gameConfig.ts, src/config/campaignConfig.ts, src/composables/useI18n.ts, src/locales/index.ts, src/style.css.
External Integration and Deployment
WebDAV is the main external service integration, exposed through settings dialogs and a dedicated service rather than embedded in game logic. Builds use Vite/Node; Docker/Nginx support browser deployment. Electron, Android Capacitor/Gradle, and Go provide platform-specific packaging or serving routes, with CI workflows building and publishing artifacts.
Paths: src/services/webdavService.ts, src/components/settings/WebDAVConfigDialog.vue, Dockerfile, nginx.conf, capacitor.config.ts.
Main entry points: main.ts Vue bootstrap · OverviewView.vue Game views · gameLogic.ts Game rules · App.vue Root application
Components 24
Vue Client
- Vue bootstrap
src/main.ts - Root application · Coordinates layout, dialogs, notifications, and routed content.
src/App.vue - Gameplay router
src/router/index.ts - Game views · Overview, galaxy, battle simulator, and other domain screens.
src/views/OverviewView.vue - Game state · Primary mutable gameplay-state boundary.
src/stores/gameStore.ts - Universe state · Separates universe and NPC state from player state.
src/stores/universeStore.ts - Localization
src/composables/useI18n.ts - Battle reports
src/components/dialogs/BattleReportDialog.vue
Gameplay Engine
- Game rules · Validates actions and applies empire progression rules.
src/logic/gameLogic.ts - Building rules · Computes building prerequisites, costs, and timers.
src/logic/buildingLogic.ts - Fleet rules
src/logic/fleetLogic.ts - Timed queues · Models construction, research, and fleet work.
src/logic/waitingQueueLogic.ts - Battle rules
src/logic/battleLogic.ts - Battle worker · Runs expensive combat simulation off the rendering thread.
src/workers/battle.worker.ts - Worker manager
src/workers/workerManager.ts - Game content · Centralized game balance and campaign content.
src/config/gameConfig.ts
Save and Sync
- Encrypted saves · Encrypts and upgrades persisted game progress.
src/utils/crypto.ts - Browser local storage
- WebDAV backup · Optional external backup and sync integration.
src/services/webdavService.ts - WebDAV settings
src/components/settings/WebDAVConfigDialog.vue
Delivery Targets
- Web deployment
Dockerfile - Electron desktop
electron/main.ts - Capacitor Android
android/app/src/main/java/games/wenzi/ogame/MainActivity.java - Go web service
main.go
Connections 24
- Vue bootstrap → Root application: mounts
- Root application → Gameplay router: hosts
- Gameplay router → Game views: selects
- Game views → Game state: reads and dispatches actions
- Game views → Universe state: reads
- Game views → Localization: localizes
- Game state → Game rules: applies actions through
- Game rules → Building rules: uses
- Game rules → Fleet rules: uses
- Game rules → Timed queues: schedules
- Game rules → Game content: uses rules and balance
- Game views → Worker manager: requests simulations
- Worker manager → Battle worker: dispatches
- Battle worker → Battle rules: executes
- Worker manager → Battle reports: returns results to
- Game state → Encrypted saves: persists through
- Encrypted saves → Browser local storage: encrypted save
- WebDAV settings → WebDAV backup: configures
- WebDAV backup → Browser local storage: backs up and restores
- Root application → WebDAV settings: opens
- Vue bootstrap → Web deployment: built for
- Vue bootstrap → Electron desktop: packaged in
- Vue bootstrap → Capacitor Android: packaged in
- Vue bootstrap → Go web service: served by