Skip to content

jonathangehrke/IndustrieLite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

IndustrieLite

Economic simulation game built with Godot 4 and C#

Build & Tests DI Pattern Enforcement License: MIT

What is this?

Build and manage a small economy: place production buildings (farms, power plants, water pumps), connect them with roads, and fulfill dynamic city orders through a logistics system.

Core Gameplay:

  • ๐Ÿ—๏ธ Build - Place farms, power plants, and infrastructure
  • โšก Manage Resources - Balance power, water, and production
  • ๐Ÿšš Logistics - Road-based transport system with pathfinding
  • ๐Ÿ’ฐ Trade - Fulfill dynamic market orders from cities
  • ๐Ÿ“ˆ Upgrade - Improve building capacity and truck logistics

๐ŸŽฎ Play the Game

โ–ถ๏ธ Play on itch.io (Coming soon - in development)

For Developers: This project showcases modern C# architecture patterns in a game development context. See Technical Highlights below for implementation details.

Tech Stack

  • Engine: Godot 4.x (C# / .NET 8)
  • Architecture: Clean DI, Event-Driven, Manager Pattern
  • Key Patterns: Dependency Injection Container, CQRS, Deterministic Simulation (20Hz)
  • Data-Driven: Buildings, Resources, and Recipes via .tres definitions
  • Testing: Unit tests (.NET), Integration tests (Godot Headless), CI/CD (GitHub Actions)

Key Features

Architecture & Code Quality

โœ… Dependency Injection - DIContainer as Composition Root, no Service Locator โœ… Event-Driven Architecture - EventHub decouples UI from game logic โœ… Deterministic Simulation - Fixed 20Hz timestep for reproducible state (save/load, future multiplayer) โœ… Result Pattern - Structured error handling with typed results โœ… Data-Driven Design - Game content via Godot Resources (.tres files)

Gameplay Systems

โœ… Production Chains - Resource flow from producers to consumers โœ… Road Network - A* pathfinding with dynamic rerouting โœ… Market Simulation - Cities generate orders with dynamic pricing โœ… Building Upgrades - Logistics capacity and speed improvements โœ… Save/Load System - Versioned saves with automatic migration

Technical Highlights for Developers

Architecture Achievements

Hexagonal/Ports & Adapters Architecture

  • Core business logic decoupled from Godot engine via port interfaces
  • PlacementService uses ILandReadModel, IEconomy, IRoadReadModel ports
  • Adapter pattern bridges Godot managers to port interfaces (EconomyPort, RoadReadModelPort)
  • Enables unit testing without Godot runtime dependencies

Explicit Dependency Injection

  • Custom DIContainer with constructor-based injection (~500 LOC composition root)
  • 20+ services wired explicitly at startup
  • ServiceContainer serves as named registry for Godot/GDScript bridge only
  • CI enforcement: No runtime ServiceContainer lookups in managers

Event-Driven Design

  • EventHub provides pub/sub messaging between systems
  • Loose coupling: UI, simulation, and managers communicate via events
  • Type-safe event definitions with structured payloads

Result Pattern

  • Structured error handling without exception-driven control flow
  • Type-safe error codes (ErrorIds) with localized messages
  • Success/failure state with optional error details

Recent Refactorings

BuildingManager โ†’ Service Extraction (code/buildings/services)

  • Refactored 689-line "God Object" into focused services:
    • PlacementService - Placement validation (bounds, ownership, costs, collisions)
    • BuildingFactory - Building instantiation from definitions
    • BuildingIndex - GUID and cell-based indexing
    • BuildingQueries - Stateless query helpers
    • BuildingRegistry - Spatial indexing for fast lookups
  • Port-based architecture enables unit testing with mocks
  • Clear single responsibilities per service

Production System

  • Recipe-based production with input/output buffers
  • Tick-based simulation (20Hz deterministic)
  • Resource constraints and capacity management

Transport System

  • Autonomous truck agents with A* pathfinding
  • Order management with priority queuing
  • Economic calculations (fuel costs, delivery pricing)

Code Quality Gates

Automated CI/CD Pipeline

  • โœ… .NET build with Release configuration
  • โœ… Unit & integration tests with coverage reports
  • โœ… Code formatting verification (dotnet format)
  • โœ… DI pattern enforcement (custom analyzers)
  • โœ… Nullability checks (<Nullable>enable</Nullable>)
  • โœ… Warnings as errors
  • โœ… Roslyn static analysis

Development Standards

  • Conventional commit messages
  • XML documentation for public APIs
  • Centralized constants (no magic strings via ResourceIds, ErrorIds)
  • Structured logging with categories (DebugLogger)

Quick Start

Prerequisites

Run the Game

  1. Clone the repository
  2. Open project.godot in Godot 4
  3. Press F5 to run

Run Tests

dotnet test

Architecture

This project demonstrates Clean Architecture principles in a game context:

  • DIContainer - Explicit dependency injection, all manager dependencies wired at startup
  • ServiceContainer - Named service registry for GDScript โ†” C# bridge (no typed Service Locator)
  • EventHub - Pub/sub pattern for loose coupling between systems
  • Deterministic Simulation - All state changes via fixed-timestep ITickable.Tick(), guarded by validation
  • Manager Pattern - Clear separation: BuildingManager, EconomyManager, TransportManager, etc.

See ARCHITECTURE.md for:

  • System overview with Mermaid diagrams
  • ADR-style architecture decisions
  • Known trade-offs & technical debt
  • Test strategy

Development

Code Standards

  • English identifiers (classes, methods, properties)
  • German comments/logs (bilingual codebase)
  • Centralized constants (no magic strings)
  • XML documentation for public APIs

Build & Quality Gates

# Format check
dotnet format --verify-no-changes

# Build
dotnet build

# Run tests
dotnet test

CI enforces:

  • โœ… Code formatting (via dotnet format)
  • โœ… Nullability checks (<Nullable>enable</Nullable>)
  • โœ… Warnings as errors (-warnaserror)
  • โœ… Roslyn analyzers

See docs/DEVELOPMENT.md for detailed development docs:

  • DI guidelines & migration
  • GameClock design & phases
  • UI architecture & signals
  • Build commands & clean scripts

Project Structure

.
โ”œโ”€โ”€ .github/                # GitHub workflows & templates
โ”œโ”€โ”€ assets/                 # Game assets (buildings, tiles, resources, etc.)
โ”œโ”€โ”€ code/                   # C# source
โ”‚   โ”œโ”€โ”€ buildings/          # Building logic & services
โ”‚   โ”œโ”€โ”€ common/             # Shared utilities & constants
โ”‚   โ”œโ”€โ”€ data/               # Data models
โ”‚   โ”œโ”€โ”€ input/              # Input handling
โ”‚   โ”œโ”€โ”€ managers/           # Core managers (Building, Economy, Transport, etc.)
โ”‚   โ”œโ”€โ”€ roads/              # Road system
โ”‚   โ”œโ”€โ”€ runtime/            # Runtime services (GameManager, UIService, Database)
โ”‚   โ”œโ”€โ”€ sim/                # Simulation (ProductionSystem, ITickable)
โ”‚   โ””โ”€โ”€ transport/          # Transport subsystem
โ”œโ”€โ”€ data/                   # Game data (.tres definitions)
โ”œโ”€โ”€ dev-scripts/            # Development scripts (PowerShell)
โ”œโ”€โ”€ docs/                   # Documentation
โ”œโ”€โ”€ export/                 # Export presets
โ”œโ”€โ”€ scenes/                 # Godot scenes
โ”œโ”€โ”€ tests/                  # Unit & integration tests
โ”œโ”€โ”€ tools/                  # CI tools & scripts
โ””โ”€โ”€ ui/                     # GDScript UI

License

MIT License - Copyright (c) 2025 Jonathan Gehrke

See LICENSE file for full license text.

This game is built with Godot Engine (MIT License). For third-party licenses and attributions, see THIRD_PARTY_LICENSES.md.

Assets

All game assets under assets/ were created in-house using an AI tool and are released under CC0 1.0 (Public Domain). See ASSETS_LICENSE.md for details.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors