Repository navigation
Getting Started
Michael Yarichuk edited this page Oct 18, 2026
·
1 revision
dotnet add package RoguelikeToolkit.EntitiesDepends only on DefaultEcs and YamlDotNet. Unity users: see the Unity Guide.
Components are plain classes or structs with settable properties. Mark them with [Component].
using RoguelikeToolkit.Entities;
[Component]
public class Health
{
public int Max { get; set; }
public int Current { get; set; }
}
[Component]
public class Speed
{
public int Value { get; set; }
}The component's name in templates is the type name unless you set [Component(Name = "...")]. Matching is case-insensitive.
templates.yaml:
EnemyBase:
Tags: [AI, CanMove]
Components:
Health: { Max: 10, Current: 10 }
Speed: { Value: 5 }
Goblin:
Inherits: [EnemyBase]
Tags: [Goblin]
Components:
Health: { Max: 15, Current: 15 }using DefaultEcs;
using RoguelikeToolkit.Entities.Repository;
using RoguelikeToolkit.Entities.Factory;
var world = new World();
var repository = new EntityTemplateRepository();
repository.LoadTemplateFolder("path/to/templates"); // .yaml and .json
var factory = new EntityFactory(repository, world);
if (factory.TryCreate("Goblin", out Entity goblin))
{
var hp = goblin.Get<Health>();
}Inheritance replaces whole components, not single fields. Goblin's
Healthabove fully replaces EnemyBase'sHealth, so set every field you care about.
- Learn the full file syntax in the Template Reference.
- Turn on typo warnings:
EntityDiagnostics.WarningHandler = m => Console.WriteLine(m);(see Troubleshooting).
RoguelikeToolkit.Entities