A custom data-oriented game engine framework built in C#, using Unity only as a runtime for rendering and deployment.
All core systems — ECS, physics, messaging, and serialization — are implemented from scratch, with zero dependency on Unity DOTS or MonoBehaviours.
⚠️ NOTE This repository is a portfolio showcase demonstrating engine architecture and performance engineering. Visual assets and proprietary gameplay systems are intentionally excluded.
Stress Test Results — Intel Core i7-13650HX
| Scenario | Entity Count | FPS | Details |
|---|---|---|---|
| Physics + Collision | 6,000 moving | 500+ | Custom Spatial Hash Grid (O(n×k)) |
| Full Rendering | 2,000 visual | 400+ | Dynamic Mesh Batching (Chunk-based) |
| Frame Time | Combined | ~2.5ms | Logic + Render Pipeline (Heavy Load) |
Frame Time (Full Pipeline): ~2.0 – 2.5 ms
- Custom ECS: O(1) component queries via bitmask filtering (256 component types).
- Spatial Partitioning: O(n×k) collision detection vs O(n²) brute force.
- Zero-Allocation Messaging: Event bus using
structbased messaging andArrayPool<T>. - Automated Tooling: Custom-built C# Code Generation pipeline for automated binary serialization and type registries.
2,000 entities @ 500+ FPS using spatial partitioning collision detection & rendering.
Design Philosophy: Data-Oriented Design focused on cache locality and predictable memory access.
// Bitmask filtering (supports 256 component types)
var filter = ecsWorld
.Filter<PositionComponent>()
.With<VelocityComponent>();
foreach (var entity in filter) // O(1) bitmask check per entity
{
ref var pos = ref ecsWorld.GetComponent<PositionComponent>(entity);
ref var vel = ref ecsWorld.GetComponent<VelocityComponent>(entity);
pos.Value += vel.Value * deltaTime; // Direct memory access, zero copy
}Key Characteristics
- Bitmask Queries: ~3 ns per entity vs ~50 ns dictionary lookups
- Zero-Copy Access:
refreturns eliminate struct copying - ID Recycling: Stack-based free list prevents fragmentation
Custom spatial partitioning for efficient broad-phase collision detection.
// O(1) insertion / removal
spatialGrid.Add(entityId, tilePosition);
// O(k) neighbor query (k = entities in nearby cells)
foreach (var neighbor in spatialGrid.GetEntities(cellX, cellY))
{
if (CheckCollision(entity, neighbor))
HandleCollision(entity, neighbor);
}Benchmark Comparison
- Brute Force (10k entities): 50M checks / frame → ~20 FPS
- Spatial Grid (10k entities): ~100k checks / frame → 300+ FPS
A dedicated Fluent ClassBuilder API removes boilerplate and automatically handles entity ID remapping during build-time/compile-time.
Developer-Written Code
[AutoSave]
public struct PoisonComponent
{
public int Dps;
public float Timer;
[EntityReference] // Marks entity ID for auto-remapping
public int TargetEntityId;
}Generated Output (Simplified)
// PoisonSaver.cs (auto-generated)
public sealed class PoisonSaver : IComponentSaver<PoisonComponent>
{
protected override void Deserialize(
ref PoisonComponent component,
BinaryReader reader,
Dictionary<int, int> idMap)
{
component.Dps = reader.ReadInt32();
component.Timer = reader.ReadSingle();
int oldId = reader.ReadInt32();
component.TargetEntityId = idMap.GetValueOrDefault(oldId, -1);
}
}Benefits
- Zero manual serialization code
- Type-safe binary I/O
- Automatic entity reference resolution on load
High-frequency messaging without Garbage Collection pressure.
// Publishing (Pass by reference 'in' to avoid copying)
// 'EntityDamagedEvent' is a struct, not a class.
EventBus.Publish(in BlockPlacedEvent);
// Subscribing (internally uses ArrayPool<T>)
EventBus.Subscribe<BlockPlacedEvent>(OnBlockPlaced);Performance: 0 GC allocations
- C# 9.0 (.NET Standard 2.1)
- Custom ECS framework
- In-house Fluent C# Code Generation API (ClassBuilder)
- Spatial Hash Grid collision system
- Unity 2021.3+ (runtime only)
- Dynamic Mesh Batching: Custom MeshRenderer management with direct UV/Vertex modification.
- Multi-platform builds (Windows, Linux, macOS)
- Data-Oriented Design (DOD)
- Structure of Arrays (SoA)
[MethodImpl(MethodImplOptions.AggressiveInlining)]ArrayPool<T>-based object pooling
DeepBound-Engine-Core/
└── Sources/
├── Ecs/
│ ├── EcsWorld.cs # Entity lifecycle & queries
│ ├── ComponentMask.cs # Bitmask filtering (PopCount)
│ └── Filter.cs # Query API
├── Editor/
│ ├── ClassBuilding/
│ │ └── ClassBuilder.cs # Fluent C# codegen API
│ └── Ecs/
│ └── ComponentSaverGenerator.cs # [AutoSave] codegen script
├── Event/
│ └── GameEventBus.cs # ArrayPool-backed messaging
└── Physics/
└── SpatialGrid.cs # Hash-based partitioning
- Data-Oriented Design: SoA layouts for cache-friendly iteration
- Profiler-Driven Optimization: All claims backed by benchmarks
- Zero-Allocation Hot Paths: Pooling, stack allocations, no per-frame GC
- Unity as a Tool, Not a Framework: Core logic is engine-agnostic
Furkan Kırat Computer Science @ Bilkent University
Focus Areas
- Systems Programming & Memory Optimization
- Data-Oriented Architecture
- Custom Game Engine Design
This project demonstrates building a high-performance engine core from scratch, using Unity solely for rendering and deployment.
ComponentMask.cs→ Bit manipulation & PopCountEcsWorld.cs→ Entity lifecycle & static type indexingSpatialGrid.cs→ Hash-based collision detectionClassBuilder.cs→ Fluent code generation APISaverGenerator.cs→ Custom code generation pipeline
Portfolio Project — engine core architecture showcase. Game content and proprietary systems excluded.
Code License: All Rights Reserved
Last updated: February 2026
