How ybz777/china-1937-survivalgame works
China 1937 is a browser-based historical survival game. Players create a campaign, explore a changing wartime map, encounter events and people, manage supplies, and resolve combat; campaign state is saved locally with optional cloud backup. The graph preserves the major gameplay domains and the UI/state layer. Evidence for some modules comes from SOURCE INDEX references or README capability descriptions; unsampled internals are not assumed to define additional call paths.
Main entry points: engine.ts Campaign simulation · Game.tsx Game shell · world.ts Cities and routes · Create.tsx Campaign creation
Components 24
Game interface
- Game shell
frontend/src/ui/Game.tsx - Campaign creation
frontend/src/ui/Create.tsx - Travel interface
frontend/src/ui/World.tsx - Journal and panels
frontend/src/ui/Panels.tsx - Equipment interface
frontend/src/ui/Equipment.tsx - Shared controls
frontend/src/ui/common.tsx
Campaign runtime
- Campaign simulation
frontend/src/game/engine.ts - Dynamic events
frontend/src/game/events.ts - Tactical combat
frontend/src/game/combat.ts - Ambush encounters
frontend/src/game/ambush.ts - Audio and music
frontend/src/game/audio.ts
World and content
- Items and inventory
frontend/src/game/items.ts - Scavenging and trade
frontend/src/game/acquisition.ts - Cities and routes
frontend/src/game/world.ts - NPCs and companions
frontend/src/game/people.ts - Historical events
frontend/src/game/historicalEvents.ts - Major encounters
frontend/src/game/majorEvents.ts - Major targets
frontend/src/game/majorTargets.ts - Weapon performance
frontend/src/game/firepower.ts
Campaign state
- Game state store
frontend/src/game/store.ts - Save management
frontend/src/game/persistence.ts
Persistence services
- FastAPI save service
backend/server.py - MongoDB
Other components
- Player
Connections 48
- Player → Campaign creation: creates campaign
README.md - Player → Travel interface: explores map
README.md - Player → Game shell: plays game
README.md - Game shell → Campaign creation: renders
frontend/src/ui/Game.tsx - Game shell → Game state store: reads state
frontend/src/ui/Game.tsx - Game shell → Campaign simulation: dispatches gameplay
frontend/src/ui/Game.tsx - Game shell → Travel interface: renders
frontend/src/ui/Game.tsx - Game shell → Audio and music: controls audio
frontend/src/ui/Game.tsx - Campaign creation → Campaign simulation: starts campaign
frontend/src/ui/Create.tsx - Campaign creation → Cities and routes: reads locations
frontend/src/ui/Create.tsx - Campaign creation → NPCs and companions: reads backgrounds
frontend/src/ui/Create.tsx - Campaign creation → Items and inventory: selects purchases
frontend/src/ui/Create.tsx - Travel interface → Cities and routes: reads routes
frontend/src/ui/World.tsx - Travel interface → Campaign simulation: requests travel
frontend/src/ui/World.tsx - Travel interface → Game state store: dispatches action
frontend/src/ui/World.tsx - Journal and panels → Campaign simulation: reads campaign date
frontend/src/ui/Panels.tsx - Equipment interface → Items and inventory: reads equipment
frontend/src/ui/Equipment.tsx - Equipment interface → Campaign simulation: uses game logic
frontend/src/ui/Equipment.tsx - Shared controls → Items and inventory: renders item data
frontend/src/ui/common.tsx - Shared controls → Game state store: reads labels
frontend/src/ui/common.tsx - Shared controls → Audio and music: plays click sound
frontend/src/ui/common.tsx - Campaign simulation → Dynamic events: selects events
frontend/src/game/engine.ts - Campaign simulation → Items and inventory: updates inventory
frontend/src/game/engine.ts - Campaign simulation → Scavenging and trade: resolves acquisition
frontend/src/game/engine.ts - Campaign simulation → Cities and routes: uses routes and control
frontend/src/game/engine.ts - Campaign simulation → NPCs and companions: uses character data
frontend/src/game/engine.ts - Campaign simulation → Tactical combat: runs combat
frontend/src/game/engine.ts - Campaign simulation → Historical events: uses ambush data
frontend/src/game/engine.ts - Campaign simulation → Major encounters: uses encounter data
frontend/src/game/engine.ts - Dynamic events → Cities and routes: checks control
frontend/src/game/events.ts - Dynamic events → Historical events: includes events
frontend/src/game/events.ts - Dynamic events → Major encounters: includes encounters
frontend/src/game/events.ts - Dynamic events → Ambush encounters: includes ambush events
frontend/src/game/events.ts - Tactical combat → Campaign simulation: uses simulation actions
frontend/src/game/combat.ts - Tactical combat → Items and inventory: uses weapons
frontend/src/game/combat.ts - Tactical combat → Major targets: loads enemy data
frontend/src/game/combat.ts - Tactical combat → Weapon performance: uses weapon stats
frontend/src/game/combat.ts - Ambush encounters → Cities and routes: checks locations
frontend/src/game/ambush.ts - Ambush encounters → Historical events: uses event content
frontend/src/game/ambush.ts - Ambush encounters → Major encounters: uses major content
frontend/src/game/ambush.ts - Scavenging and trade → Items and inventory: uses item catalog
frontend/src/game/acquisition.ts - Major encounters → Cities and routes: checks control
frontend/src/game/majorEvents.ts - Major encounters → Major targets: uses target data
frontend/src/game/majorEvents.ts - Major encounters → Historical events: uses inspection rules
frontend/src/game/majorEvents.ts - Cities and routes → Player: defines exploration
README.md - Game shell → Journal and panels: renders
frontend/src/ui/Game.tsx - Game shell → Equipment interface: renders
frontend/src/ui/Game.tsx - Game state store → Save management: loads and saves
frontend/src/game/store.ts