RACEngine

RACEngine is a modular, modern game engine built with .NET 8 and C#. It serves as a learning platform and a foundation for developing custom games without relying on existing game engines. The project emphasizes clarity, separation of concerns, and practical elegance.


πŸš€ Features


πŸ“ Project Structure

RACEngine/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ Rac.ECS/            # Core ECS module
β”‚   β”œβ”€β”€ Rac.Rendering/      # 4-phase rendering pipeline
β”‚   β”œβ”€β”€ Rac.Engine/         # Engine orchestration and facade
β”‚   β”œβ”€β”€ Rac.AI/             # AI subsystem
β”‚   β”œβ”€β”€ Rac.Animation/      # Animation subsystem
β”‚   β”œβ”€β”€ Rac.Audio/          # Audio subsystem
β”‚   β”œβ”€β”€ Rac.Assets/         # Asset management
β”‚   └── Rac.Core/           # Core utilities and extensions
└── samples/
    β”œβ”€β”€ SampleGame/         # Multiple game samples and demos
    └── TicTacToe/          # Simple turn-based game example

🎨 4-Phase Rendering Pipeline

RACEngine features a sophisticated rendering architecture that separates concerns into four distinct phases, enabling better performance, tool development, and maintainability.

Architecture Overview

graph LR
    A[Configuration] --> B[Preprocessing]
    B --> C[Processing]
    C --> D[Post-Processing]

Phase 1: Configuration

var config = RenderConfiguration.Create(new Vector2D<int>(1920, 1080))
    .WithPostProcessing(new PostProcessingConfiguration { EnableBloom = true })
    .WithQuality(new QualityConfiguration { MsaaSamples = 4 })
    .Build();

Phase 2: Preprocessing

Phase 3: Processing

Phase 4: Post-Processing

Benefits

βœ… Separation of Concerns: Each phase has a single, clear responsibility
βœ… Enforced Ordering: Cannot render without completing preprocessing
βœ… Performance: Asset loading never blocks frame rendering
βœ… Tool Integration: Each phase can be controlled independently
βœ… Extensibility: New features fit clearly into appropriate phases

Usage in Engine

The engine automatically manages all four phases:

// Happens once during initialization
renderer.Initialize(window);           // Phase 1: Configuration
renderer.InitializePreprocessing();    // Phase 2: Asset loading & validation
renderer.InitializeProcessing();       // Phase 3: GPU resource setup
renderer.InitializePostProcessing();   // Phase 4: Post-processing setup

// Happens every frame in the render loop
renderer.Clear();                      // Phase 3: Begin frame
renderer.UpdateVertices(vertices);     // Phase 3: Upload data
renderer.Draw();                       // Phase 3: Render geometry
renderer.FinalizeFrame();              // Phase 4: Apply effects & present

πŸ› οΈ Getting Started

Prerequisites

System Requirements

For optimal performance and full audiovisual effects support:

Note: The engine will automatically detect your graphics and audio capabilities and gracefully fall back to basic rendering/no audio if requirements aren’t met. Update your graphics drivers or use a newer graphics card for full visual effects support. Audio will use the NullAudioService as fallback if OpenAL initialization fails.

Building the Engine

  1. Clone the repository:

    git clone https://github.com/tomasforsman/RACEngine.git
    cd RACEngine
    
  2. Navigate to the sample game:

    cd samples/SampleGame
    
  3. Build and run the sample game:

    dotnet run
    

πŸ§ͺ Sample Games

The repository includes multiple sample applications demonstrating different aspects of RACEngine:

Available Samples

Running Samples

Navigate to the sample game directory and run with specific sample names:

cd samples/SampleGame
dotnet run -- boidsample      # Default: Boid flocking simulation
dotnet run -- shootersample   # Interactive shooter
dotnet run -- bloomtest       # HDR bloom effects
dotnet run -- camerademo      # Camera system demonstration
dotnet run -- pipelinedemo    # 4-phase rendering pipeline demo
dotnet run -- containersample # Container system with inventory patterns

Educational Features

Each sample includes:


πŸ“š Documentation

Comprehensive documentation is forthcoming. In the meantime, refer to the source code and the SampleGame project for insights into the engine’s usage and capabilities.


🀝 Contributing

Contributions are welcome! If you’re interested in contributing:

  1. Fork the repository.
  2. Create a new branch:

    git checkout -b feature/YourFeature
    
  3. Commit your changes:

    git commit -m 'Add YourFeature'
    
  4. Push to the branch:

    git push origin feature/YourFeature
    
  5. Open a pull request.

Please ensure that your code adheres to the project’s coding standards and includes appropriate tests.


πŸ“„ License

This project is licensed under the MIT License.

πŸ“¬ Contact

For questions, suggestions, or feedback: