| Crates.io | archetype_ecs |
| lib.rs | archetype_ecs |
| version | 1.2.0 |
| created_at | 2025-12-04 06:24:24.851074+00 |
| updated_at | 2026-01-03 03:43:28.097757+00 |
| description | Archetype ECS - High-performance Entity Component System with parallel execution |
| homepage | https://github.com/saptak7777/Archetype-ECS |
| repository | https://github.com/saptak7777/Archetype-ECS |
| max_upload_size | |
| id | 1965991 |
| size | 621,262 |
A high-performance, strictly-typed, archetype-based Entity Component System for Rust.
Archetype ECS is what happens when you take ECS seriously, strip out the "game engine" bloat, and focus on raw performance. It's the ECS equivalent of a sports car - fast, focused, and doesn't come with cup holders.
Archetype ECS is a prototype ECS library for Rust game engines. It follows Unix philosophy (does one thing, hopefully well) and provides the ECS components you'd need to integrate into a larger engine.
Fair Warning: This is a library component, not a complete solution. You'll need to bring your own rendering, materials, lighting, and scene management. Think of it as an engine block for your car - it works, but you can't drive it alone.
✅ High Performance: Cache-friendly archetype storage with SoA (Structure of Arrays) layout
✅ Parallel Execution: Automatic multi-threaded system scheduling with dependency resolution
✅ Reactive Queries: Efficient Changed<T> and Added<T> filters for change detection
✅ Hierarchy System: First-class parent-child relationships with transform propagation
✅ Serialization: Built-in JSON serialization for entities, components, and worlds
✅ Hot Reload: System hot-reloading for development workflow (Code)
✅ Profiling: Integrated tracing instrumentation for performance analysis
✅ Error Types: Asset loading error types for your asset manager
❌ Rendering (but works perfectly with ash_renderer) ❌ Physics (but integrates seamlessly with particle_accelerator) ❌ Asset Management (we intentionally separate data from logic) ❌ Materials/Lighting (that's your renderer's job)
use archetype_ecs::prelude::*;
use particle_accelerator::{PhysicsWorld, RigidBody, Collider};
fn setup_physics_world() -> Result<()> {
let mut world = World::new();
let mut physics = PhysicsWorld::new();
// Spawn physics entities
let ball = world.spawn_entity((
Position { x: 0.0, y: 10.0, z: 0.0 },
Velocity { x: 5.0, y: 0.0, z: 0.0 },
RigidBody::dynamic(),
Collider::sphere(1.0),
));
// Physics system integration
physics.update(&mut world, 0.016)?;
Ok(())
}
use archetype_ecs::prelude::*;
use archetype_assets::{AssetManager, Handle};
fn setup_assets() -> Result<()> {
let mut world = World::new();
let mut assets = AssetManager::new();
// Load assets
let texture_handle = assets.load::<Texture>("player.png")?;
let mesh_handle = assets.load::<Mesh>("player.obj")?;
// Store asset manager in world
world.insert_resource(assets);
// Spawn entity with asset handles
let player = world.spawn_entity((
Position::default(),
MeshComponent { handle: mesh_handle },
TextureComponent { handle: texture_handle },
));
Ok(())
}
[dependencies]
archetype_ecs = "1.2.0"
glam = "0.30" # Required for transform types
use archetype_ecs::prelude::*;
fn main() -> Result<()> {
let mut world = World::new();
// Spawn some entities
let player = world.spawn_entity((
Position { x: 0.0, y: 0.0 },
Velocity { x: 1.0, y: 0.0 },
));
// Query and update
for (pos, vel) in world.query_mut::<(&mut Position, &Velocity)>() {
pos.x += vel.x;
pos.y += vel.y;
}
Ok(())
}
We support hot-reloading of systems using the hot_reload module. This allows you to iterate on game logic without restarting the application.
use archetype_ecs::prelude::*;
struct MovementSystem;
impl System for MovementSystem {
fn name(&self) -> &'static str { "Movement" }
fn access(&self) -> SystemAccess {
SystemAccess::new()
.read::<Velocity>()
.write::<Position>()
}
fn run(&mut self, world: &mut World) -> Result<()> {
for (pos, vel) in world.query_mut::<(&mut Position, &Velocity)>() {
pos.x += vel.x * 0.016; // 60 FPS dt
}
Ok(())
}
}
Archetype ECS is designed for speed because slow ECS libraries are sad ECS libraries.
Walking vs Flying).(Benchmarks running on Intel Core i5-11400f, 100k entities)
archetype_assets)Check:
spawn_entity() instead of the deprecated spawn()?Check:
query vs query_mut)?Contributions are welcome. I appreciate:
Apache-2.0. Because nobody likes monsters.
This library wouldn't exist without: