| Crates.io | kon-engine |
| lib.rs | kon-engine |
| version | 0.2.0 |
| created_at | 2026-01-09 20:11:30.02449+00 |
| updated_at | 2026-01-17 12:07:59.199934+00 |
| description | A modular 2D game engine for Rust, built with a focus on ECS performance and simplicity. |
| homepage | https://github.com/cey0225/kon |
| repository | https://github.com/cey0225/kon |
| max_upload_size | |
| id | 2032766 |
| size | 73,531 |
A modular 2D game engine in Rust with a custom SparseSet-based ECS. Built from scratch to learn how game engines actually work.
⚠️ Heads up: This is an experimental/educational project. I'm building this to understand engine internals, not to compete with existing engines.
The project is split into workspace crates:
Currently Working
kon_core - App lifecycle, plugins, eventskon_ecs - Custom ECSkon_macros - Proc macros for #[system] and #[component]kon_window - Winit-based window managementkon_input - Input handlingStill Cooking 🍳
kon_math - Math stuff with Glam integration (WIP)kon_renderer - WGPU renderer (WIP)kon_physics - 2D physics (Planned)kon_editor - Editor tools (Planned)Here's how you write a simple simulation:
use kon::prelude::*;
// Define your data
#[component]
struct Position { x: f32, y: f32 }
#[component]
struct Velocity { x: f32, y: f32 }
// Setup runs once
#[system]
fn setup(ctx: &mut Context) {
ctx.window().set_config(WindowConfig::default().with_title("A beautiful title"));
ctx.world()
.spawn()
.insert(Position { x: 0.0, y: 0.0 })
.insert(Velocity { x: 1.0, y: 0.0 })
.tag("player")
.id();
}
// Movement runs every frame
#[system]
fn movement(ctx: &mut Context) {
ctx.world()
.select_mut::<(Position, Velocity)>()
.each(|entity, (pos, vel)| {
pos.x += vel.x;
pos.y += vel.y;
println!("{:?} moved to ({}, {})", entity, pos.x, pos.y);
});
}
// Update runs every frame
#[system]
fn update(ctx: &mut Context) {
if ctx.input().just_key_pressed(KeyCode::Escape) {
ctx.quit();
}
ctx.on::<WindowCloseRequested>(|_, context| {
context.quit();
});
}
// Wire everything together
fn main() {
Kon::new()
.add_plugin(DefaultPlugins)
.add_startup_system(setup)
.add_system(movement)
.add_system(update)
.run();
}
As a dependency:
cargo add kon-engine
Or in your Cargo.toml:
[dependencies]
kon-engine = "0.2.0"
From source:
git clone https://github.com/cey0225/kon.git
cd kon
# Run examples
# Linux/macOS
./kon.sh ecs_demo/query_demo
./kon.sh ecs_demo/tag_demo
# Windows
./kon.ps1 ecs_demo/query_demo
./kon.ps1 ecs_demo/tag_demo
Dual-licensed under MIT or Apache 2.0, pick whichever works for you.