Skip to content
lunditoph-siagoPublic

Repository files navigation

Sia.NET

Build License: BSD Playground: Live

Sia.NET is a reactive entity component system for .NET. Generated component views connect typed data to event-driven systems: change a value, and the systems that observe it can respond.

Quick start

Add Sia and its source generator to a .NET 10 or later project:

dotnet add package Sia
dotnet add package Sia.CodeGenerators

Here, changing a player's health triggers a system on the next stage tick:

using Sia;

using var world = new World();
var player = world.Create(HList.From(new Health(100)));

using var stage = SystemChain.Empty
    .Add((ref Health health) => Console.WriteLine($"Health: {health.Value}"),
        trigger: EventUnion.Of<Health.SetValue>())
    .CreateStage(world);

new Health.View(player, world) { Value = 75 };
stage.Tick();

public partial record struct Health([Sia] int Value);

The generated view publishes the change; the stage processes it and prints Health: 75.

The Playground lets you edit and run the C# examples in your browser, from ECS fundamentals to reactive systems. Its Editor Lab also supports C# programs and programmable WebGPU rendering.

Releases

Packages

Used by

Contributors

Languages