Skip to content
Unstable-KernelPublic

About

Simulation runtime -- spatial hashing, movement systems, environment engine

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

sim

Simulation runtime for the Unstable Kernel ecosystem. Provides the foundational infrastructure that all other simulation crates build on.

Architecture

graph LR
    subgraph "kernel-sim"
        C[components<br/>Position, Velocity, Energy]
        S[spatial<br/>hash grid, neighbor queries]
        M[movement<br/>toroidal wrapping]
        E[environment<br/>obstacles, food sources]
    end

    S --> C
    M --> C
    E --> C
Loading

Modules

Module Responsibility
components Core data types: Position, Velocity, Species, Energy
spatial Spatial hash grid for O(1) neighbor lookups on toroidal domains
movement Position update with velocity integration and edge wrapping
environment Static world elements: obstacles, food sources, terrain

Usage

use kernel_sim::{components::*, spatial::SpatialHash, movement::movement_system};

let mut positions = vec![Position { x: 100.0, y: 200.0 }];
let velocities = vec![Velocity { x: 1.5, y: -0.8 }];

// Move agents
movement_system(&mut positions, &velocities, 1200.0, 800.0, 1.0/60.0);

// Query neighbors
let mut grid = SpatialHash::new(1200.0, 800.0, 50.0);
grid.rebuild(&positions);
let nearby = grid.query_radius(&positions, 0, 50.0);

Spatial Hash

The spatial hash divides the world into cells of size equal to the query radius. Neighbor lookups check only adjacent cells, giving O(1) amortized performance for uniform distributions.

Supports toroidal (wrap-around) distance calculations for seamless edge behavior.

Tests

cargo test

License

MIT

About

Simulation runtime -- spatial hashing, movement systems, environment engine

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages