Skip to content

About

A genre-agnostic ECS game engine in Rust. Zero dependencies (core). Deterministic by design.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

chronos-engine

Chronos Engine

Chronos Engine

The open-source game engine. Rust-powered. Cross-platform. For every game.

Rust 2021 53,000+ lines 996 tests Zero unsafe Zero core deps Apache License 2.0


"Write the future in the present while preserving the past."

Born from the VHS static of 1984. Forged in Rust. Chronos Engine is an open-source alternative to Unity and Unreal β€” a general-purpose game engine designed for every genre. RTS, platformer, RPG, shooter, sim, puzzle β€” the engine doesn't care about your genre. It gives you entities, components, systems, and determinism.

Every byte of storage, every archetype migration, every event dispatch β€” hand-wired. No Bevy. No Legion. No shortcuts. The ECS core is zero-dependency (pure std). Subsystems are feature-gated: pull in only what you need. A 2D platformer ships without 3D physics. A puzzle game ships without audio.


Table of Contents


What's Inside

~53,000 lines of Rust across 96 source files. 996 tests (971 unit + 25 integration). cargo build --features full compiles clean with zero errors and zero warnings.

ECS Core

The foundation. Zero dependencies. Pure std library Rust.

Layer What Why It Matters
Entity Generational IDs with slot reuse β€” freed slots recycled with incremented generations Stale handles never alias live entities. Use-after-free is impossible by construction.
Component Blanket impl trait β€” any Send + Sync + 'static type is a component No macros, no registration ceremony. Just attach your type.
Storage Type-erased Box<dyn Any> per-component storage via TypeId Maximally simple. Zero unsafe. Cache-hostile but correct.
Archetypes ArchetypeKey (sorted Vec<TypeId>) β†’ Archetype (entity group) Multi-component queries skip entities that can't match.
World Central registry: entity lifecycle, component attach/detach, archetype tracking, slot reuse One-stop shop for all ECS operations.

Built-in components: Position, Velocity, Health, Damage, Dead, Transform, Sprite, CircleRadius, RigidBody, Grounded, Gravity.

Spatial Indexing

Module What
Quadtree 2D spatial index β€” O(n log n) insertion, O(k + log n) range query, cross-subtree collision support
Octree 3D spatial index β€” AABB3D, recursive 8-child subdivision, sphere/AABB/ray queries
AABB / AABB3D 2D and 3D bounding boxes with overlap/containment checks
Ray / Ray3D Origin + direction for spatial queries with hit detection

Systems & Scheduling

System What
MovementSystem Position += Velocity Γ— dt
HealthSystem Damage β†’ Health β†’ Dead pipeline with events
CollisionSystem Quadtree broad-phase + circle narrow-phase
GravitySystem Gravity acceleration (gΓ—dt)
PlatformerSystem Ground check, jump impulse, friction
RaycastSystem Point queries and ray casting via spatial index
DeathCleanupSystem Remove entities with Dead component
DebugRenderSystem Terminal grid renderer β€” no GPU needed
Scheduler Use Case
GameLoop Variable-framerate (platformers, RPGs, FPS) β€” 5-phase pipeline: PreUpdate β†’ Update β†’ PostUpdate β†’ Cleanup β†’ Render
TickScheduler Deterministic fixed-timestep (RTS, strategy, sims) β€” same inputs β†’ same outputs, every time

Event Bus

EventBus with VecDeque<Event> for cross-system communication. Six event types: Collision, DamageTaken, EntityDied, EntityDestroyed, RayHit, Custom. Systems emit; game code drains between frames.

Input System

Full multi-device input with context-based action bindings.

Feature What
Keyboard 80+ KeyCode variants
Mouse Position, delta, scroll β€” accumulated per-frame
Gamepad GamepadButton + GamepadAxis (sticks, triggers)
Action bindings Map any input to named actions. Chainable .or() API: "move_forward" β†’ W, ArrowUp, LeftStickUp
Axis support Analog thumbsticks, mouse delta, scroll via AxisBinding
Context switching Swap input maps per game state (gameplay, menu, console)
State tracking pressed, just_pressed, just_released, held per action per frame

2D Rendering (render feature)

wgpu 23 sprite batch renderer with instanced drawing.

Module What
Renderer Full wgpu pipeline, sprite instancing, camera with orthographic projection + screen shake
TextureAtlas GPU texture atlas management with frame extraction
BitmapFont ASCII grid glyph atlas, kerning, render_text() β†’ Vec<RenderSprite>
TileMap Chunked 16Γ—16 grids with frustum culling
ParticleSystem ECS-integrated particles with explosion/smoke/trail presets
PostProcessor Color grading pipeline β€” brightness, contrast, saturation, gamma, vignette, bloom. Presets: default, CRT, noir, sunset

3D Rendering (render feature)

Module What
Renderer3D Depth buffer, perspective camera, mesh pipeline, directional lighting, back-face culling
Mesh3D Cube/plane primitives with vertex normals
Transform3D TRS β†’ model matrix computation
ObjLoader Wavefront .obj parser β€” vertex/normal/UV/face parsing, fan triangulation

Physics (2D + 3D)

Module What
PhysicsWorld2D Full 2D rigid body simulation β€” AABB/circle colliders, impulse-based contact solver, raycasting
PhysicsWorld3D 3D rigid body simulation β€” static/dynamic bodies, sphere/AABB colliders
Collision response Impulse-based with restitution + friction
Constraints DistanceConstraint, PointConstraint β€” joint-like connections (3D)
Gravity integration Per-body gravity with semi-implicit Euler

Animation & Materials

Module What
AnimationStateMachine States, transitions, parameters (bool/float/trigger) for character behavior
AnimationBlendTree 1D/2D blending (idle→walk→run), additive animation layers
SpriteAnimation Sprite sheet flipbook with frame events
TimelineSystem Keyframe interpolation (linear/bezier/step), event tracks
Skeletal Animation Joint hierarchy, JointPose (TRS), quaternion SLERP, AnimationClip, AnimationBlender for cross-fade
MaterialDefinition Albedo, normal, metallic, roughness, emissive, opacity β€” 7 built-in presets (Unlit, PBR, Sprite, Particle, UI, Skybox, Terrain)
ShaderGraph Node-based shader description β€” 28 shader node types, WGSL codegen, hot-reload watcher

Advanced Systems

Module What
Lighting 2D lighting β€” Point, Directional, Spot, Area lights. Shadow casting via ShadowCaster. Visibility polygon computation. LightMap for scene-wide lighting.
Fog of War FogGrid with Unexplored/Explored/Visible states. FogRevealer for line-of-sight. WallSegment obstacles block visibility.
UI Immediate-mode widgets β€” Button, Slider, Label, Panel. Hit-testing, UiContext, style presets (dark/light/accent).
Camera2D Orthographic camera with shake, follow, bounds
TilemapEx Layered tilemap with collision tiles, autotile
Pathfinder2D A* on tilemap grids with variable cost
AudioZone Spatial audio regions, reverb zones, occlusion, footstep tracking

Audio (audio feature)

Rodio 0.20 backend.

Module What
AudioEngine Device init, output stream management
SfxPlayer Load .wav/.ogg, play one-shot sounds with volume
MusicPlayer Stream long audio with crossfade support
VolumeControl Master, Music, SFX independent channels
SpatialAudio Position-based inverse distance attenuation
SoundBuffer Byte cache β€” reuse buffers, avoid per-play allocations

Scene System (serialize feature)

JSON scene/level serialization with serde_json.

Module What
Scene Named collection of EntityPrefabs with metadata
EntityPrefab Template: component list with default values
ComponentValue 11 variants matching all built-in components β€” round-trip JSON
World integration world.spawn_prefab(scene, prefab_name)

Asset Pipeline (dev-tools feature)

Module What
Asset trait fn load(path) -> Result<Self> for any asset type
AssetRegistry Path β†’ loaded asset with handle-based access
HotReloadWatcher notify 7 file watcher β€” reload changed assets at runtime
AssetLoader File I/O with format detection, combines registry + watcher

Developer Overlay (render feature)

Module What
DevOverlay In-game toggleable dev tools panel
EntityInspector Show all components on selected entity with live values (11 component types)
StatsPanel FPS ring buffer, entity count, draw calls, memory
DevConsole Command parser + capped log output
SceneTree Hierarchical entity list with selection

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Chronos Editor (Phases 7–9)                        β”‚
β”‚  Panels: Viewport β”‚ Hierarchy β”‚ Inspector β”‚ Assets β”‚ Console     β”‚
β”‚  Workspace: Undo β”‚ Grid β”‚ Gizmo β”‚ Selection β”‚ Shortcuts          β”‚
β”‚  Project: New/Open/Save β”‚ Templates β”‚ Recent β”‚ Docking           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                     Scripting Layer                               β”‚
β”‚   Rhai Bridge β”‚ Script Components β”‚ Lifecycle β”‚ Hot-Reload       β”‚
β”‚   Script API: Entities β”‚ Queries β”‚ Input β”‚ Audio β”‚ Physics       β”‚
β”‚   Modding: ModLoader β”‚ ModBuilder β”‚ Sandboxing                   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                        Game Code                                  β”‚
β”‚                  (your game logic here)                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                      Game Module                                  β”‚
β”‚   Combat β”‚ RPG β”‚ AI β”‚ Squads β”‚ Dialogue β”‚ Factions β”‚ World       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                     Developer Tools                               β”‚
β”‚   Dev Overlay β”‚ Asset Pipeline β”‚ Hot Reload β”‚ Scene I/O          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                     Subsystem Layer                                β”‚
β”‚  Rendering β”‚ Audio β”‚ Physics2D/3D β”‚ Lighting β”‚ Animation β”‚ Fog   β”‚
β”‚  Materials β”‚ Shaders β”‚ Tilemaps β”‚ Particles β”‚ Post-Processing    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                    System Pipeline                                 β”‚
β”‚  Movement β”‚ Health β”‚ Collision β”‚ Gravity β”‚ Raycast β”‚ AI           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                       ECS Core                                    β”‚
β”‚    Entity β”‚ Component β”‚ Storage β”‚ World β”‚ Archetypes              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                  Spatial Indexing                                  β”‚
β”‚          Quadtree (2D) β”‚ Octree (3D) β”‚ AABB β”‚ Ray                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                      Schedulers                                   β”‚
β”‚    GameLoop (variable) β”‚ TickScheduler (deterministic)            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                       EventBus                                    β”‚
β”‚    Collision β”‚ Damage β”‚ Death β”‚ RayHit β”‚ Custom Events             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Quick Start

# Clone
git clone https://github.com/Blackshield-Company/chronos-engine.git
cd chronos-engine

# Terminal demos (no GPU needed):
cargo run

# GPU demo with rendering (needs a display):
cargo run --features render

# Everything:
cargo run --features full

# Launch the editor:
cargo run --features editor --bin chronos-editor

# Run tests:
cargo test --features full

# Minimal ECS only:
cargo test

Feature Flags

Flag What Dependencies
(default) ECS core, systems, spatial indexing, input, physics, animations, materials, shaders, tilemaps, particles, lighting, fog of war None β€” pure std
render 2D/3D rendering, UI, post-processing, developer overlay wgpu 23, winit 0.30, bytemuck, rand, tokio, image
serialize Scene/level serialization, entity prefabs serde, serde_json
audio Audio engine, spatial audio, music crossfade rodio 0.20
dev-tools Asset pipeline, hot reload notify 7, serde, serde_json
game Chronos Company demo game modules render (transitive)
editor Desktop editor application (winit + wgpu + egui) egui 0.30, egui-wgpu, egui-winit, wgpu, winit, pollster, serde, serde_json
scripting Rhai scripting engine, component scripts, modding rhai 1
asset-pipeline Advanced importers (glTF, audio, fonts, images), GUID registry, metadata gltf, symphonia, ab_glyph, uuid, serde, serde_json, image
full Everything above all of the above

Project Structure

chronos-engine/
β”œβ”€β”€ Cargo.toml                  # Feature-gated deps
β”œβ”€β”€ LICENSE                     # Apache License 2.0
β”œβ”€β”€ README.md                   # This file
β”œβ”€β”€ ROADMAP.md                  # Full development plan (Phases 1–14)
β”œβ”€β”€ icon.png                    # App icon
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ lib.rs                  # Public API β€” re-exports all modules
β”‚   β”œβ”€β”€ main.rs                 # Terminal demos
β”‚   β”‚
β”‚   β”‚  ═══ ECS Core ═══
β”‚   β”œβ”€β”€ entity.rs               # Generational entity IDs
β”‚   β”œβ”€β”€ component.rs            # Component trait + 11 built-in types
β”‚   β”œβ”€β”€ storage.rs              # Type-erased component storage
β”‚   β”œβ”€β”€ world.rs                # World β€” entity lifecycle, archetypes, queries
β”‚   β”‚
β”‚   β”‚  ═══ Systems & Scheduling ═══
β”‚   β”œβ”€β”€ system.rs               # 8 systems, GameLoop, TickScheduler, EventBus
β”‚   β”œβ”€β”€ input.rs                # Input system β€” keyboard, mouse, gamepad
β”‚   β”‚
β”‚   β”‚  ═══ Spatial & Physics ═══
β”‚   β”œβ”€β”€ spatial.rs              # Quadtree, AABB, Ray (2D)
β”‚   β”œβ”€β”€ octree.rs               # Octree, AABB3D, Ray3D (3D)
β”‚   β”œβ”€β”€ physics2d.rs            # 2D physics β€” rigid bodies, contact solver, raycasting
β”‚   β”œβ”€β”€ physics3d.rs            # 3D physics β€” rigid bodies, constraints, collision response
β”‚   β”‚
β”‚   β”‚  ═══ Rendering ═══
β”‚   β”œβ”€β”€ render.rs               # 2D sprite batch renderer (wgpu)
β”‚   β”œβ”€β”€ render3d.rs             # 3D renderer with depth buffer
β”‚   β”œβ”€β”€ texture.rs              # Texture atlas + frame extraction
β”‚   β”œβ”€β”€ font.rs                 # Bitmap font rendering
β”‚   β”œβ”€β”€ tilemap.rs              # Chunked tile map with frustum culling
β”‚   β”œβ”€β”€ particle.rs             # Particle emitter + presets (explosion/smoke/trail)
β”‚   β”œβ”€β”€ postprocess.rs          # Post-processing β€” color grading, bloom, vignette, CRT/noir/sunset
β”‚   β”œβ”€β”€ obj_loader.rs           # Wavefront .obj parser
β”‚   β”‚
β”‚   β”‚  ═══ Animation & Materials ═══
β”‚   β”œβ”€β”€ animation.rs            # State machine, blend tree, sprite animation, timeline
β”‚   β”œβ”€β”€ skeletal.rs             # Skeletal animation β€” joints, poses, SLERP, blending
β”‚   β”œβ”€β”€ material.rs             # Material system β€” 7 built-in presets
β”‚   β”œβ”€β”€ shader.rs               # Shader graph β€” 28 node types, WGSL generation, hot-reload
β”‚   β”‚
β”‚   β”‚  ═══ Advanced Systems ═══
β”‚   β”œβ”€β”€ lighting.rs             # 2D lighting + shadow casting
β”‚   β”œβ”€β”€ fog_of_war.rs           # Fog of war + line-of-sight
β”‚   β”œβ”€β”€ ui.rs                   # UI widgets β€” Button, Slider, Label, Panel
β”‚   β”œβ”€β”€ general_systems.rs      # Camera2D, TilemapEx, Pathfinder2D, AudioZone, Footsteps
β”‚   β”‚
β”‚   β”‚  ═══ Scene & Assets ═══
β”‚   β”œβ”€β”€ scene.rs                # Scene/level serialization
β”‚   β”œβ”€β”€ audio.rs                # Audio engine (rodio)
β”‚   β”œβ”€β”€ asset.rs                # Asset pipeline + hot reload
β”‚   β”‚
β”‚   β”‚  ═══ Editor ═══
β”‚   β”œβ”€β”€ editor.rs               # Developer overlay
β”‚   β”œβ”€β”€ editor_app.rs           # Editor desktop app (winit + wgpu + egui)
β”‚   β”œβ”€β”€ editor_panels/          # Editor UI panels
β”‚   β”‚   β”œβ”€β”€ mod.rs              # EditorPanel trait, EditorState, shared types
β”‚   β”‚   β”œβ”€β”€ viewport.rs         # Scene viewport (camera, grid, FPS, gizmo)
β”‚   β”‚   β”œβ”€β”€ hierarchy.rs        # Entity tree (add/delete/duplicate/search)
β”‚   β”‚   β”œβ”€β”€ inspector.rs        # Component property editor (drag sliders, 11 types)
β”‚   β”‚   β”œβ”€β”€ asset_browser.rs    # File browser (list/grid views, type detection)
β”‚   β”‚   β”œβ”€β”€ console.rs          # Log output + command processor (help/clear/echo/entities)
β”‚   β”‚   β”œβ”€β”€ toolbar.rs          # Play/Pause/Stop, gizmo mode, snap toggle
β”‚   β”‚   β”œβ”€β”€ menu_bar.rs         # File/Edit/View/Help menus, shortcuts dialog, about dialog
β”‚   β”‚   └── welcome.rs          # Welcome screen β€” new project, open recent, templates
β”‚   β”œβ”€β”€ editor_workspace/       # Editor workspace tools
β”‚   β”‚   β”œβ”€β”€ mod.rs              # Shared types (PickResult, SelectionRect, snap_to_grid)
β”‚   β”‚   β”œβ”€β”€ undo.rs             # UndoStack + EditorCommand trait (dual-stack, type-erased)
β”‚   β”‚   β”œβ”€β”€ grid.rs             # Infinite ground grid renderer (axis coloring, snap)
β”‚   β”‚   β”œβ”€β”€ gizmo.rs            # Translate/Rotate/Scale gizmos (mouse drag, axis hit-test)
β”‚   β”‚   β”œβ”€β”€ selection.rs        # Viewport click-pick (ray), box select, multi-select
β”‚   β”‚   β”œβ”€β”€ shortcuts.rs        # Configurable keybindings (Blender-style defaults)
β”‚   β”‚   β”œβ”€β”€ settings.rs         # Settings dialog (rendering/editor/shortcuts tabs)
β”‚   β”‚   └── docking.rs          # Panel docking β€” tree layout, drag-drop, serialize/restore
β”‚   β”œβ”€β”€ editor_project/         # Project management
β”‚   β”‚   β”œβ”€β”€ mod.rs              # Project module root
β”‚   β”‚   └── project.rs          # ProjectManager β€” open/save/validate, templates, recent
β”‚   β”‚
β”‚   β”‚  ═══ Scripting ═══
β”‚   β”œβ”€β”€ scripting/              # Rhai scripting engine
β”‚   β”‚   β”œβ”€β”€ mod.rs              # Scripting module root
β”‚   β”‚   β”œβ”€β”€ bridge.rs           # Rhai engine bridge β€” register ECS types, compile/eval
β”‚   β”‚   β”œβ”€β”€ component.rs        # ScriptComponent, ScriptHandle, ScriptRegistry
β”‚   β”‚   β”œβ”€β”€ lifecycle.rs        # ScriptLifecycle β€” on_start/on_update/on_destroy/on_collision
β”‚   β”‚   β”œβ”€β”€ api.rs              # Script API β€” math, entity, debug, time, input, audio, physics
β”‚   β”‚   β”œβ”€β”€ hotreload.rs        # Script hot-reload β€” polling watcher, configurable policies
β”‚   β”‚   └── modloader.rs        # ModLoader, ModMetadata, ModBuilder, sandboxing
β”‚   β”‚
β”‚   β”‚  ═══ Asset Import Pipeline ═══
β”‚   β”œβ”€β”€ import/                 # Advanced asset importers
β”‚   β”‚   β”œβ”€β”€ mod.rs              # Import module root
β”‚   β”‚   β”œβ”€β”€ audio_import.rs     # WAV/OGG/MP3/FLAC β†’ PCM buffers (symphonia)
β”‚   β”‚   β”œβ”€β”€ font_import.rs      # TTF/OTF β†’ bitmap glyph atlases (ab_glyph)
β”‚   β”‚   β”œβ”€β”€ gltf_import.rs      # glTF/GLB β†’ meshes, materials, animations, skins
β”‚   β”‚   β”œβ”€β”€ image_import.rs     # PNG/JPG/BMP/TGA β†’ RGBA + mipmaps (box-filter)
β”‚   β”‚   β”œβ”€β”€ metadata.rs         # .meta files β€” GUIDs, import settings, staleness detection
β”‚   β”‚   └── registry.rs         # GUID-based asset registry β€” ref counting, GC
β”‚   β”‚
β”‚   β”‚  ═══ Demo Game ═══
β”‚   └── game/                   # Chronos Company β€” demo RPG (28 modules)
β”‚       β”œβ”€β”€ mod.rs              # Game module root
β”‚       β”œβ”€β”€ components.rs       # Game components (11 types)
β”‚       β”œβ”€β”€ mercenary.rs        # Mercenary factory + Warrior/Archer/Mage/Scout templates
β”‚       β”œβ”€β”€ terrain.rs          # Terrain grid + procedural heightmap
β”‚       β”œβ”€β”€ navigation.rs       # A* pathfinding on terrain
β”‚       β”œβ”€β”€ camera.rs           # Tabletop/isometric camera (orbit, pan, zoom, auto-follow)
β”‚       β”œβ”€β”€ selection.rs        # Unit selection system
β”‚       β”œβ”€β”€ squad.rs            # Squad controller + 4 formations (Line/Column/Circle/Wedge)
β”‚       β”œβ”€β”€ ai.rs               # Enemy AI state machine (patrol, aggro, chase, combat)
β”‚       β”œβ”€β”€ combat.rs           # Combat system (melee/ranged/magic, STR/DEX/INT scaling)
β”‚       β”œβ”€β”€ ability.rs          # Ability system (6 types, cooldowns, mana, 4 slots/unit)
β”‚       β”œβ”€β”€ loot.rs             # Loot drops, auto-pickup, gold stacking
β”‚       β”œβ”€β”€ stats.rs            # STR/DEX/INT/VIT, leveling, XP, stat allocation
β”‚       β”œβ”€β”€ equipment.rs        # 7 equipment slots, stat bonuses, level gating
β”‚       β”œβ”€β”€ jobs.rs             # Procedural bounty/contract generation (6 types, 5 tiers)
β”‚       β”œβ”€β”€ dialogue.rs         # Branching NPC conversations, condition gates
β”‚       β”œβ”€β”€ factions.rs         # 7 factions, reputation, pricing modifiers
β”‚       β”œβ”€β”€ inventory_ui.rs     # Item management, sorting, filtering, drag-drop
β”‚       β”œβ”€β”€ world_map.rs        # Procedural biomes, exploration
β”‚       β”œβ”€β”€ poi.rs              # Points of interest β€” towns, dungeons, camps, discovery
β”‚       β”œβ”€β”€ daynight.rs         # Day/night cycle, 6-phase lighting
β”‚       β”œβ”€β”€ encounters.rs       # Random encounters, ambushes, difficulty scaling
β”‚       β”œβ”€β”€ save.rs             # Save/load, versioning, checksums, auto-save
β”‚       β”œβ”€β”€ minimap.rs          # Explored/fog cells, POI/enemy markers, terrain colors
β”‚       β”œβ”€β”€ hud.rs              # Health/mana/XP bars, tooltips, notifications, squad panel
β”‚       β”œβ”€β”€ screens.rs          # Screen stack, transitions, button layouts, presets
β”‚       β”œβ”€β”€ effects.rs          # 16 visual effect types, particle profiles
β”‚       β”œβ”€β”€ ambience.rs         # Sound zones, music triggers, footstep tracking
β”‚       └── tutorial.rs         # Objectives, hints, guided sequences
└── tests/
    └── integration_tests.rs    # 25 integration tests

Chronos Company β€” Demo Game

The first game built on Chronos Engine. A 3D real-time strategy open-world RPG sandbox. Will be built inside the Chronos Editor as a proof of concept.

You command a band of mercenaries navigating an open world, taking job boards and bounties, moving as a unit, fighting in RTS-style tactical combat. Tabletop/isometric camera view. The world persists. Your company grows.

Status: All game logic modules implemented (28 files, 23 tests) β€” components, mercenary factory, terrain, navigation, camera, squads, combat, abilities, loot, RPG stats, equipment, job board, dialogue, factions, inventory, world map, POIs, day/night cycle, encounters, save/load, minimap, HUD, screens, effects, ambience, and tutorial. The playable demo (Phase 14) is work in progress.

Core pillars:

  • Open world traversal (3D, tabletop camera)
  • RTS-style unit control (select, move, fight as a squad)
  • RPG progression (mercenary stats, equipment, skills)
  • Job board / bounty system (mission generation)
  • Faction reputation (7 factions, pricing, access gates)
  • Dialogue system (branching conversations, condition gates)
  • Sandbox freedom (go anywhere, take any contract)

Implemented modules (28 game files):

Category Modules
Foundation Components, Mercenary Factory, Terrain, Navigation (A*), Camera, Selection, Squads
Combat Enemy AI, Combat System, Abilities, Loot Drops
RPG Stats/Leveling, Equipment, Jobs, Dialogue, Factions, Inventory
World World Map, Points of Interest, Day/Night Cycle, Encounters, Save/Load, Minimap
Polish HUD, Screen Manager, Visual Effects, Ambience, Tutorial

Editor Application

Desktop editor built with winit 0.30 + wgpu 23 + egui 0.30.

Module What
EditorApp Main application β€” window, wgpu surface, egui render loop, 60fps
ViewportPanel Central viewport with orbit/pan/zoom camera, grid overlay, FPS counter
HierarchyPanel Left panel β€” entity tree, add/delete/duplicate, search, selection sync
InspectorPanel Right panel β€” component property editor with drag sliders for all 11 types
AssetBrowserPanel Bottom panel β€” file browser with list/grid views, type detection
ConsolePanel Bottom panel β€” log output with severity filters, command processor
ToolbarPanel Top panel β€” Play/Pause/Stop, gizmo mode, snap toggle
MenuBarPanel Top panel β€” File/Edit/View/Help menus, shortcuts dialog, about dialog
WelcomePanel Initial screen β€” new project wizard (Empty, 2D Platformer, 3D Shooter, RPG templates), recent projects
UndoStack Dual-stack undo/redo with type-erased Box<dyn EditorCommand>
GridRenderer Infinite ground grid with axis coloring and snap-to-grid
GizmoSystem Translate/Rotate/Scale gizmos with mouse drag interaction
ViewportSelector Click-pick (ray), box select, multi-select, hover highlight
ShortcutMap Configurable keybindings with Blender-style defaults
SettingsDialog Rendering/editor/shortcuts tabs with validation
PanelDocking Resizable, dockable panels β€” tree layout, drag-drop, save/restore
ProjectManager New/Open/Save/Close projects, .chronos project format, manifest, templates

Engine Generalization

Systems extracted to make every game genre a first-class citizen.

Module Lines Tests What
physics2d.rs 1,344 24 Full 2D physics β€” AABB/circle collisions, RigidBody2D, impulse solver, raycasting
animation.rs 1,484 29 Animation state machine, blend trees (1D/2D), sprite flipbook, keyframe timeline
material.rs 757 14 Material system β€” 7 built-in presets (Unlit, PBR, Sprite, Particle, UI, Skybox, Terrain)
shader.rs 1,075 21 Shader graph β€” 28 node types, WGSL code generation, hot-reload watcher
general_systems.rs 1,198 21 Camera2D, layered TilemapEx with autotile, A* Pathfinder2D, AudioZone system

Scripting & Modding

Full Rhai scripting engine β€” make games without touching Rust.

Module Lines Tests What
bridge.rs 664 18 Rhai engine bridge β€” register Vec2/Vec3/Entity/Transform, compile/eval scripts
component.rs 395 17 ScriptComponent β€” attach Rhai scripts to entities, per-entity state
lifecycle.rs 577 15 Script hooks β€” on_start, on_update, on_destroy, on_collision
api.rs 595 21 Full scripting API β€” vec math, entity CRUD, debug, time, input, audio, physics, events, scenes
hotreload.rs 861 20 Polling-based script hot-reload β€” configurable reload policies
modloader.rs 1,087 18 ModLoader β€” metadata, dependency resolution, sandboxing

Asset Pipeline

Advanced importers for production asset workflows (feature: asset-pipeline).

Module Lines Tests What
audio_import.rs β€” 15 WAV/OGG/MP3/FLAC β†’ raw f32 PCM via symphonia (normalization, mono conversion, silence trim, resampling)
font_import.rs β€” 17 TTF/OTF β†’ bitmap glyph atlases via ab_glyph (ASCII coverage, kerning, atlas packing)
gltf_import.rs β€” 17 glTF/GLB β†’ meshes, PBR materials, skeletal animation, scene hierarchy, skin data
image_import.rs β€” 17 PNG/JPG/BMP/TGA β†’ RGBA8/RGB8/Grayscale8 + box-filter mipmap chain generation
metadata.rs β€” 18 .meta companion files β€” stable GUID, import settings, timestamps, content hash
registry.rs β€” 25 GUID-based asset registry β€” type-erased storage, reference counting, garbage collection
Total 5,450 92

How It Compares

Aspect Chronos Engine Unity Unreal Bevy
License Apache-2.0 β€” fully open-source Proprietary Proprietary (source) Open-source
Language Rust C# C++/Blueprints Rust
Core Dependencies Zero β€” pure std Heavy Heavy Heavy
Deterministic Simulation First-class β€” TickScheduler Not guaranteed Not primary Not designed for lockstep
Safety 100% safe Rust β€” zero unsafe GC, no memory safety GC or manual Extensive unsafe for perf
Cross-Platform Linux/Windows/macOS/WASM (planned) 25+ platforms 15+ platforms Linux/Windows/macOS/WASM
Editor βœ… egui-based β€” all panels, workspace tools, project management, docking Full editor Full editor No editor yet
Scripting βœ… Rhai β€” full engine API, hot-reload, modding C# C++/Blueprints Rust
2D Physics βœ… Built-in AABB/circle, impulse solver, raycasting Box2D Paper2D Rapier/Avian
3D Physics βœ… Built-in rigid body, constraints, collision response PhysX Chaos Rapier/Avian
Animation βœ… State machine, blend trees, sprite flipbook, timeline, skeletal Mecanim Animation Blueprints Animation graph
Networking Rollback netcode (planned) Netcode, Relay Netcode, Replication Not built-in
Codebase Size ~53K lines β€” readable, auditable Millions Millions Very large

The key differentiator: Chronos Engine is a self-contained, zero-dependency ECS with a complete game systems layer that compiles with only the Rust standard library, yet scales to full wgpu rendering with 3D pipelines, post-processing, audio, scripting, and a desktop editor. It prioritizes deterministic lockstep simulation for multiplayer β€” a niche not well-served by existing engines. And it's fully open-source with no license fees.


Roadmap

See ROADMAP.md for the full phased development plan.

Phase 1  β€” Core ECS                          βœ… Done
Phase 2  β€” Systems & Game Loop               βœ… Done
Phase 3  β€” Spatial Index & Physics           βœ… Done
Phase 4  β€” Rendering & Advanced Systems      βœ… Done
Phase 5  β€” Developer Experience              βœ… Done
Phase 6  β€” Chronos Company (game modules)    🚧 WIP
Phase 7  β€” Editor Application                βœ… Done
Phase 8  β€” Engine Generalization             βœ… Done
Phase 9  β€” Scripting & Modding               βœ… Done
Phase 10 β€” Asset Pipeline                    🚧 WIP (importers done, processing pipeline TODO)
Phase 11 β€” Cross-Platform Distribution       πŸ“‹ TODO
Phase 12 β€” Networking                        πŸ“‹ TODO
Phase 13 β€” Plugin System                     πŸ“‹ TODO
Phase 14 β€” Chronos Company Demo              πŸ“‹ TODO

Architecture Principles

  1. Zero-dependency core β€” the ECS itself is std only. Optional subsystems pull in their own deps and are feature-gated.

  2. Determinism is a feature β€” TickScheduler guarantees same inputs β†’ same outputs. This makes replays, lockstep multiplayer, and testing trivial.

  3. No unsafe β€” not a single unsafe block in the engine. Type-erased storage uses Box<dyn Any> + downcast, safe by construction.

  4. Systems own nothing β€” systems operate on World via queries. No state between ticks (except configuration). Testable, parallelizable, order-independent.

  5. Data-oriented by default β€” components are flat data. Systems are transform functions. No inheritance, no virtual dispatch, no hidden state.

  6. Genre-agnostic β€” the same ECS core powers RTS lockstep, platformer variable-timestep, RPG event-driven, and shooter pipelines. You bring the game logic.

  7. Open by default β€” every line is open-source. No license tiers, no revenue share, no feature gates behind paywalls.


Stats

Metric Value
Lines of Rust ~53,000
Source files 96
Engine core modules 33
Game modules 28
Editor panels 9
Editor workspace modules 8
Editor project modules 2
Scripting modules 7
Asset import modules 7
Binaries 2 (main demo + chronos-editor)
Unit tests 971
Integration tests 25
Total tests 996
unsafe blocks 0
Core dependencies 0
Feature-gated dependencies 19

License

Apache-2.0 β€” see LICENSE for full text.


Write the future in the present while preserving the past.

---

β˜• Support the Developer

If this project saved you time, solved a problem, or just made your day a little more neon, you can fuel the next one:

Buy Me A Coffee

About

A genre-agnostic ECS game engine in Rust. Zero dependencies (core). Deterministic by design.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages