Overview - shmellyorc/Box GitHub Wiki

Overview

Box Engine is a lightweight, high-performance 2D game engine for .NET, powered by SFML under the hood. It provides a modular architecture centered on Screens, Entities, and Services, along with core subsystems to help you ship games faster:

  • Screen Management: Push, pop, and transition between full-screen game states (menus, levels, overlays).

  • Entity Factory: fluent, hierarchical builder to spawn and configure game objects in one line.

  • Signal Bus: Decoupled pub/sub messaging for events and cross-system communication.

  • Coroutine Scheduler: Lightweight coroutines for sequencing actions and time-based logic.

  • Sprite Batching: Automatic grouping of draw calls per texture to minimize GPU state changes.

  • Service Container: Register game-wide or screen-scoped services (e.g., save/load, audio, input) for easy dependency injection.

  • Input System: Unified handling of keyboard, mouse, gamepad, and touch input with configurable bindings.

  • Audio System: Simple API for playing music, sound effects, and managing audio groups.

  • Debug Tools: Built-in FPS counter, live logging, and optional debug overlay for rapid iteration.

  • Localization & UI: Support for multiple languages, fonts, and dynamic UI layout components.

  • Configuration & Logging: Easy-to-use config files and structured logging for troubleshooting and analytics.

Architecture Diagram

App
└── Engine
    ├── ScreenManager
    │    └── Current Screen
    │         └── Entities
    │              └── Children
    ├── SignalBus
    ├── CoroutineScheduler
    ├── InputSystem
    ├── AudioSystem
    ├── ServiceContainer
    │    ├── Log
    │    ├── FastRandom
    │    ├── Clock
    │    ├── Assets
    │    ├── Signal
    │    ├── Renderer
    │    ├── Coroutine
    │    ├── SoundManager
    │    └── ScreenManager
    ├── EngineSettings
    ├── SaveTypeWriterReader
    ├── AStar
    └── DebugTools