KeenEyes Documentation
Welcome to the KeenEyes ECS framework documentation.
What is KeenEyes?
KeenEyes is a high-performance Entity Component System (ECS) framework for .NET 10, reimplementing OrionECS in C#.
Quick Start
using KeenEyes.Core;
// Create a world
using var world = new World();
// Create an entity with components using the fluent builder
var entity = world.Spawn()
.With(new Position { X = 10, Y = 20 })
.With(new Velocity { X = 1, Y = 0 })
.Build();
// Query and process entities
foreach (var e in world.Query<Position, Velocity>())
{
ref var pos = ref world.Get<Position>(e);
ref readonly var vel = ref world.Get<Velocity>(e);
pos.X += vel.X;
pos.Y += vel.Y;
}
Key Features
- No Static State - All state is instance-based. Each
Worldis completely isolated. - Components are Structs - Cache-friendly, value semantics for optimal performance.
- Entities are IDs - Lightweight
(int Id, int Version)tuples for staleness detection. - Fluent Queries -
world.Query<A, B>().With<C>().Without<D>() - Source Generators - Reduce boilerplate while maintaining performance.
- Parallel Execution - Automatic system batching and job system for multi-threaded processing.
- Native AOT Compatible - No reflection in production code.
Documentation Sections
Learn
| Section | Description |
|---|---|
| Getting Started | Build your first ECS application step-by-step |
| Core Concepts | Understand ECS fundamentals: World, Entity, Component, System |
| Cookbook | Practical recipes for common game patterns |
Reference
| Section | Description |
|---|---|
| Features | Complete guides for all KeenEyes features |
| Libraries | Package documentation: Abstractions, Common, Spatial, Graphics |
| API Reference | Auto-generated API documentation |
Understand
| Section | Description |
|---|---|
| Design Philosophy | Why KeenEyes is designed the way it is |
| Architecture Decisions | Detailed ADRs explaining key decisions |
| Research | Technical research for planned features |
Help
| Section | Description |
|---|---|
| Troubleshooting | Common issues and solutions |
Cookbook Highlights
Jump straight to practical examples:
| Recipe | What You'll Learn |
|---|---|
| Basic Movement | Position, velocity, acceleration, delta-time |
| Health & Damage | Damage events, healing, death, invulnerability |
| State Machines | AI states, transitions, behavior systems |
| Entity Pooling | Reuse entities to avoid allocation |
| Physics Integration | Sync ECS with physics engines |
| Input Handling | Keyboard, mouse, gamepad, action mapping |
| Scene Management | Load, unload, and transition between scenes |
Design Philosophy
KeenEyes makes deliberate choices that differ from many game engines:
- Explicit over implicit - No magic auto-registration
- Composition over inheritance - Build entities from small components
- Data-oriented design - Cache-friendly memory layouts
- No hidden dependencies - Every dependency is visible
- Source generators over reflection - Compile-time code generation
- Native AOT compatible - Works with ahead-of-time compilation
Modular Architecture
KeenEyes is designed as a fully-featured game engine that is also completely customizable. Rather than a monolithic framework, KeenEyes uses a layered architecture with clear abstraction boundaries.
┌─────────────────────────────────────────────────────────┐
│ Your Game │
├─────────────────────────────────────────────────────────┤
│ KeenEyes.Graphics │ KeenEyes.Audio │ Physics │
│ (Silk.NET OpenGL) │ (OpenAL) │ (Your Pick) │
├──────────────────────┴───────────────────┴──────────────┤
│ KeenEyes.Core (ECS Runtime) │
├─────────────────────────────────────────────────────────┤
│ KeenEyes.Abstractions (Interfaces) │
└─────────────────────────────────────────────────────────┘
| Package | Purpose |
|---|---|
| KeenEyes.Abstractions | Core interfaces (IWorld, ISystem, IComponent) - no implementation dependencies |
| KeenEyes.Core | Full ECS runtime with archetype storage, queries, and system execution |
| KeenEyes.Graphics | OpenGL/Vulkan rendering via Silk.NET |
| KeenEyes.Audio | Spatial audio via OpenAL |
| KeenEyes.Spatial | Transform components and spatial partitioning |
Swap Any Subsystem
Don't like our physics implementation? Use your own. Prefer FMOD over OpenAL? Swap it out:
// The default setup - everything works out of the box
using var world = new WorldBuilder()
.WithPlugin<SilkGraphicsPlugin>() // Built-in OpenGL rendering
.WithPlugin<OpenALAudioPlugin>() // Built-in audio
.Build();
// Or bring your own implementations
using var world = new WorldBuilder()
.WithPlugin<MyCustomRendererPlugin>() // Your Vulkan renderer
.WithPlugin<FmodAudioPlugin>() // Third-party audio
.WithPlugin<BulletPhysicsPlugin>() // Your physics choice
.Build();
Features Guide
Entity Features
- Entities - Entity lifecycle and management
- Bundles - Group related components
- Prefabs - Reusable entity templates
- Relationships - Parent-child entity hierarchies
- String Tags - Runtime-flexible entity tagging
Component Features
- Components - Component patterns and best practices
- Change Tracking - Track component modifications
- Component Validation - Enforce component constraints
- Events - Component and entity lifecycle events
System Features
- Systems - System design patterns
- Queries - Filtering and iterating entities
- Command Buffer - Safe entity modification during iteration
- Messaging - Inter-system communication patterns
- Parallelism - Parallel system execution and job system
World Features
- Singletons - World-level resources
- Serialization - Save and restore world state
- Plugins - Modular extensions and feature packaging
- Logging - Pluggable logging system
UI Features
- UI System - Retained-mode UI with ECS entities
- Widget Factory - Pre-built widgets (buttons, panels, sliders, etc.)
- Anchor-based Layout - Responsive positioning system
- Flexbox Containers - Automatic child arrangement
Libraries
- Abstractions - Lightweight interfaces for plugin development
- Common - Shared utilities (float extensions, velocity components)
- Spatial - 3D transform components with System.Numerics
- Graphics - OpenGL/Vulkan rendering with Silk.NET
- Input - Keyboard, mouse, and gamepad input handling
- UI - ECS-based retained-mode UI system
Architecture Decisions
Key design decisions are documented as Architecture Decision Records:
- ADR-001: World Manager Architecture - Refactoring World into specialized managers
- ADR-002: Complete IWorld Event System - Entity lifecycle events
- ADR-003: CommandBuffer Abstraction - Plugin isolation (20-50x performance boost)
- ADR-004: Reflection Elimination - Native AOT compatibility
Research
Technical research reports for planned features:
Planned Systems
Foundation Research
Getting Help
- Troubleshooting - Common issues and solutions
- GitHub Issues - Bug reports and feature requests
API Reference
See the API Documentation for detailed reference of all public types.