How zengm-games/zengm works
Main System Components
a) Client-Side Architecture:
• UI Layer (React + Bootstrap)
• Worker Layer (Shared Worker/Web Worker)
• IndexedDB Storage Layer
• Cache Layer
b) Core Processing Units:
• Game Simulation Engine
• Player Management System
• Team Management System
• League Management System
Data Flow Architecture
Critical interactions:
a) Communication Channels:
• UI to Worker communication (toUI and toWorker functions)
• Worker to IndexedDB interactions
• Cache to IndexedDB synchronization
b) State Management:
• Global state handling (self.bbgm)
• Cache management system
• Data persistence flow
Key Subsystems
Major functional components:
a) Sport-Specific Modules:
• Basketball
• Football
• Baseball
• Hockey
b) Core Game Features:
• Player Generation
• Game Simulation
• Statistics Processing
• League Management
User Interface Layer
• React Components
• Bootstrap UI Elements
• View Controllers
Processing Layer
• Shared/Web Worker
• Game Logic
• Simulation Engine
Data Layer
• Cache System
• IndexedDB
• Local Storage
• Blue: UI components
• Green: Processing components
• Yellow: Data storage
• Red: Critical communication paths
Implementation Details
Technical aspects:
a) Client Architecture:
Browser Tab 1 ----\
Browser Tab 2 ------> Shared Worker <---> IndexedDB
Browser Tab 3 ----/ |
• v
• Cache Layer
b) Data Flow Patterns:
• Bi-directional communication between UI and Worker
• Cache update mechanisms
• Demonstrate database transaction flows
Integration Points
Connection points:
a) External Systems:
• Service Worker for offline support
• Build system integration
• Development tools connection
b) Development Tools:
• Testing framework integration
• Debugging interfaces
• Monitoring points
This design should effectively communicate both the high-level architecture and the important implementation details of this sophisticated browser-based sports simulation system.