How oliveriver/5d-diplomacy-with-multiverse-time-travel works
Main Components
• Frontend Client: Located in the “client” directory, this is written using React (with TypeScript) and uses Vite for development. It consists of many UI components (e.g., pages, user-interface elements, and game context providers) that allow users to interact with the game.
• Backend Server: Found in the “server” directory, this .NET (C#) project handles game logic, order adjudication (through many subcomponents like Evaluation, Execution, and Validation), API endpoints (GameController), database operations (via Repositories, Migrations, and Context providers), and overall game orchestration.
• Database: The project supports multiple database engines – by default, it uses SQLite (with migration scripts in the “Migrations/Sqlite” folder), and there is optional support for SQL Server as indicated by the presence of SQL Server specific contexts and migrations.
• DevOps and Deployment: Configuration files for Docker (Dockerfile in both client and server directories, plus the docker-compose.yml file at the root) and CI/CD workflows under the “.github/workflows” directory indicate how the services are containerized and deployed.
• Legacy Prototype: The “prototype” directory holds legacy Java code for graphics and core game processing from early development; it is now only kept as a reference and does not form part of the current running system.
Relationships and Interactions
• User Interaction Flow: Users access the game via a browser that loads the client application. The client communicates with the backend server through a well-defined API (the React hooks and API files under “client/src/api”).
• API Interaction: The server’s controllers (for example, GameController.cs) receive requests from the client and trigger the necessary game processing logic and database operations.
• Game Processing and Adjudication: Within the server, multiple detailed components (grouped under Adjudication, Context, Factories, Mappers, etc.) work together. For example, the Adjudication folder contains evaluators, execution routines, and validators – all of which ensure that the complex "multiverse time travel" game logic is correctly applied.
• Database and Data Persistence: The server uses Entity Framework Core to manage schema changes and persist game state. Models and Entities are clearly separated and mapped, ensuring clean access and updates to the database.
• Deployment: Docker is used to containerize both the client and server. The docker-compose file coordinates their startup, making local deployment straightforward. This also indicates clear separation between environments for consistency and testing.
Important Architectural Patterns and Design Principles
• Separation of Concerns: The clear division between the frontend and backend allows independent development and testing. The client handles presentation and interaction, while the server manages business logic and data persistence.
• Layered Architecture: The backend follows a layered approach:
• Presentation/API layer (Controllers)
• Business Logic layer (Adjudication, Factories, Validators)
• Data Access layer (Repositories, Context Providers)
• Use of Modern Frameworks/Technologies: On the client side, use of React with TypeScript and Vite; on the server side, .NET (leveraging EF Core for ORM); plus Docker for container orchestration.