Chapter 3

Hello Seidhr

Write and run your first Seidhr module with a minimal system.

This chapter is part of the commercial parity documentation stream for THUNDER-176 and uses the Asteroids demo as the canonical source model.

Use this section as the practical walkthrough, then cross-reference the Seidhr and Hammer reference chapters for details.

Worked Example

component Position { x: f32 = 0.0, y: f32 = 0.0 }
component Velocity { vx: f32 = 0.0, vy: f32 = 0.0 }

@stage(Simulation)
system IntegratePhysics
    reads(Velocity)
    writes(Position)
{
    for entity in query(Position, Velocity) {
        let ship = entity_ref(entity);
        ship[Position].x = ship[Position].x + ship[Velocity].vx * delta_time();
        ship[Position].y = ship[Position].y + ship[Velocity].vy * delta_time();
    }
}

Try This

Modify one field or system behavior and re-run `cargo run -p seidhrc -- build demos/asteroids-2p/src/asteroids.seidhr`.