# fennecs > fennecs is a tiny, fast, free Entity-Component System for C# and .NET games and simulations, with zero dependencies and zero code generation. fennecs is a free & open-source Entity-Component System (ECS) for modern C#/.NET, made for games and simulations. Zero codegen, zero dependencies, archetype storage, entity-entity relations, object links, and SIMD-friendly streams. NuGet package: `fennecs` - https://www.nuget.org/packages/fennecs/ Every page below is also served as raw Markdown: replace `.html` with `.md` (the URLs below already point at the Markdown versions). The entire site is also available concatenated at https://fennecs.net/llms-full.txt. ## For Coding Agents - [fennecs Agent Skill (zip)](https://fennecs.net/downloads/fennecs-skill.zip): The official skill - SKILL.md plus three reference files of source-verified fennecs 0.7.0 API guidance. Unzip into your skills directory (Claude Code: `.claude/skills/`, Codex: `.agents/skills/`, OpenCode, Pi, Hermes: see guide). - [Agent install guide](https://fennecs.net/cookbook/mise-en-place/Agents.md): where the skill goes for each agent. ## Documentation - [Documentation](https://fennecs.net/docs/index.md): API documentation for fennecs, the tiny, high-energy Entity-Component System for C# - covering Worlds, Entities, Queries, Streams, and Aspects. - [Concepts](https://fennecs.net/docs/Concepts.md): Overview of ECS concepts in fennecs: Entities, Components, Queries, and Streams, plus unique features like Relations, Object Links, and Aspects. - [Worlds](https://fennecs.net/docs/World.md): How fennecs Worlds hold Entities, Components, and Queries - instantiation, limits (up to a billion Entities), spawning, disposal, and the Main Aspect. - [Entities](https://fennecs.net/docs/Entities/index.md): Entities in fennecs are lightweight 64-bit handles you attach components to - covering lifecycle, composition, Archetypes, and per-Entity CRUD. - [Add Component](https://fennecs.net/docs/Entities/ComponentAdd.md): Entity.Add attaches plain components, tags, Entity relations, and object links in fennecs, with fluent chaining and match expression uniqueness rules. - [Ensure Component](https://fennecs.net/docs/Entities/ComponentEnsure.md): Entity.Ensure guarantees a component exists on a fennecs entity and returns a ref to it - the get-or-create pattern for counters and lazy initialization. - [Check for Component](https://fennecs.net/docs/Entities/ComponentHas.md): Entity.Has checks a fennecs entity for plain components, relations, and object links, including wildcard match expressions like Match.Any and Entity.Any. - [Read/Write Component](https://fennecs.net/docs/Entities/ComponentRefGet.md): Reading and writing fennecs component data with Entity.Ref, Get for wildcard matches, and the boxed Components property for runtime inspection. - [Remove Component](https://fennecs.net/docs/Entities/ComponentRemove.md): Entity.Remove detaches components, relations, and object links from a fennecs entity - a structural change that moves it to a new Archetype. - [Despawn](https://fennecs.net/docs/Entities/Despawning.md): Despawning entities in fennecs with Entity.Despawn - component cleanup, automatic relation removal, identity recycling, and deferred despawns in runners. - [Liveness](https://fennecs.net/docs/Entities/Liveness.md): Entity.Alive tells you whether a fennecs entity still exists - generational identity recycling, implicit bool conversion, and deferred despawn behavior. - [Spawn](https://fennecs.net/docs/Entities/Spawning.md): Creating single entities in fennecs with World.Spawn - the entity springs to life immediately, ready for fluent Add calls to attach components. - [Templates](https://fennecs.net/docs/Entities/Templates.md): Entity templates and fast bulk spawning in fennecs with the EntityTemplate (World.Template): reusable templates, required per-spawn components via Needs, spawning waves straight into their final Archetype, and getting spawned Entity handles back via Span. - [Components](https://fennecs.net/docs/Components/index.md): Components in fennecs ECS - value types, tags, shareables, relations, and object links, and how Archetypes keep component data packed contiguously. - [Fox Typing](https://fennecs.net/docs/Components/FoxTyping.md): Best practices for designing fennecs components in C# - record structs, type wrapping to avoid ambiguous data, and implicit conversion operators. - [Shareables](https://fennecs.net/docs/Components/Shareables.md): Shareable components in fennecs use reference types so many entities point at one instance - ideal for shared state, configs, and heavyweight objects. - [Tags](https://fennecs.net/docs/Components/Tags.md): Tag components in fennecs are zero-size empty structs that mark and categorize entities, filtered in Queries with Has, Not, and Any expressions. - [Values](https://fennecs.net/docs/Components/ValueTypes.md): Value type components in fennecs are stored contiguously per Archetype for cache-friendly iteration - record structs are the recommended pattern. - [Queries](https://fennecs.net/docs/Queries/index.md): fennecs Queries are fast, reactive views matching Entities by component signature - the basis for Stream Views, bulk CRUD, and Match Expressions. - [Bulk CRUD](https://fennecs.net/docs/Queries/CRUD.md): Bulk CRUD on fennecs Queries - Add, Remove, Despawn, and Truncate across all matched Entities, plus Batch operations with conflict strategies. - [Matching](https://fennecs.net/docs/Queries/Matching.md): Match Expressions define what a fennecs Query contains - Has, Not, Any clauses and target wildcards like Match.Plain (the default) and Match.Entity. - [๐ŸŒˆ Streams](https://fennecs.net/docs/Streams/index.md): Stream Views are lightweight typed views over fennecs Queries, exposing the For, Job, and Raw runners for fast component iteration and processing. - [Delegates](https://fennecs.net/docs/Streams/Delegates.md): Delegate signatures for fennecs Stream runners - ComponentAction, EntityComponentAction, and MemoryAction, with uniform variants for passing data in. - [Filtering](https://fennecs.net/docs/Streams/Filters.md): Stream filters in fennecs narrow a Query on the fly - clone a Stream with a with-expression and set its Subset and Exclude component sets. - [๐Ÿฅ‡For](https://fennecs.net/docs/Streams/Stream.For.md): Stream.For runs your delegate for every Entity in a fennecs Query on the calling thread, with ref component parameters, uniforms, and EntityRef access. - [Job](https://fennecs.net/docs/Streams/Stream.Job.md): Stream.Job executes a ComponentAction across CPU cores in parallel chunks - the multithreaded counterpart to Stream.For in the fennecs ECS. - [Raw](https://fennecs.net/docs/Streams/Stream.Raw.md): Stream.Raw hands your delegate whole Archetypes as contiguous Memory blocks - ideal for SIMD work, GPU upload, and serialization in fennecs. - [Advanced](https://fennecs.net/docs/Advanced/index.md): Advanced fennecs topics for big simulations: Aspects storage universes, secondary Keys for Relations and Links, SIMD Blit, and Comp expressions. - [Aspects](https://fennecs.net/docs/Advanced/Aspects/index.md): Aspects split a fennecs World into contiguous component storage universes - declare them with AddAspect and Owns to group hot data and fight fragmentation. - [Membership](https://fennecs.net/docs/Advanced/Aspects/Membership.md): How Entities join and leave fennecs Aspects - lazy membership, eviction, the Main Aspect, EntityTemplates, Batches, deferred mode, and despawning. - [Ownership](https://fennecs.net/docs/Advanced/Aspects/Ownership.md): Declaring component ownership in fennecs with Aspect.Owns, the StrictAspects mode, and the freeze-at-first-use rule for component storage routing. - [Queries & Streams](https://fennecs.net/docs/Advanced/Aspects/Queries.md): Querying fennecs Aspects: the single-Aspect rule for Queries and Streams, crossing Aspects with entity.Ref, and the shared per-Aspect query cache. - [Expressions](https://fennecs.net/docs/Advanced/Expressions.md): Component Expressions (Comp) reference fennecs components at a meta level for dynamic query building, stream filters, and boxed runtime inspection. - [Keys](https://fennecs.net/docs/Advanced/Keys/index.md): Secondary Keys in fennecs let component types target an Entity or Object, turning plain components into Relations and Object Links between Entities. - [Link (Object)](https://fennecs.net/docs/Advanced/Keys/Link.md): Object Links in fennecs ECS attach a reference type as both component data and secondary key, grouping Entities by shared objects via Link.With. - [Relation (Entity)](https://fennecs.net/docs/Advanced/Keys/Relation.md): Entity-Entity Relations in fennecs are components with an Entity secondary key - added via Add(data, target) and queried with wildcards like Entity.Any. - [SIMD](https://fennecs.net/docs/Advanced/SIMD.md): Bulk component mutations in fennecs with the SIMD query interface - Stream.Blit writes values to all matched entities using vectorized operations. ## Cookbook (tutorials) - [Cookbook](https://fennecs.net/cookbook/index.md): The fennecs cookbook: install the tiny C# Entity-Component System via NuGet or git and start with hands-on recipes for entities, components, and queries. - [Appetizers](https://fennecs.net/cookbook/appetizers/index.md): Overview of the fennecs appetizer recipes: short runnable C# examples that tour entities, components, queries, relations, links, and stream filters. - [0. Hello! (Basics)](https://fennecs.net/cookbook/appetizers/HelloWorld.md): Hello World in fennecs: define components, spawn entities in a World, and build Stream queries with Has and Not filters to greet matching entities. - [2. Initial D (Components)](https://fennecs.net/cookbook/appetizers/InitialD.md): Build a drift car from plain entities and components, learning tag components and bulk add, remove, and query operations in fennecs. - [4. Kill Bill (Relations)](https://fennecs.net/cookbook/appetizers/KillBill.md): Demonstrates fennecs entity-entity relations: attach relation components between entities, query for them, and clean up grudges in a Stream.For loop. - [6. One Ring (Links)](https://fennecs.net/cookbook/appetizers/OneRing.md): Shows fennecs Object Links: spawn ring bearers with an EntityTemplate, link them to a shared object instance, and query all linked entities at once. - [1. Star Trek (Entities)](https://fennecs.net/cookbook/appetizers/StarTrek.md): Explores fennecs entity identity: how entities print in logs, what happens on despawn, and how IDs are recycled with rising generations in a World. - [5. Thanos (Filters)](https://fennecs.net/cookbook/appetizers/Thanos.md): Teaches fennecs query filtering with Subset and Exclude, then uses Stream.Despawn to bulk-remove half the entity population in one call. - [3. Tsubasa (Runners)](https://fennecs.net/cookbook/appetizers/Tsubasa.md): A soccer mini-game showing fennecs runners: read one entity's position each frame and pass it as a uniform so every player entity can chase the ball. - [Staple Foods](https://fennecs.net/cookbook/staples/index.md): Staple recipes for fennecs: engine-agnostic snippets of good practice for indexing entities, damage over time, relations, and OOP interop. - [3-Body Problem](https://fennecs.net/cookbook/staples/3Body.md): Simulate three gravitating bodies with fennecs entity relations, modeling N:M influence inside cache-friendly query loops without reverse lookups. - [Damage over Time](https://fennecs.net/cookbook/staples/DamageOverTime.md): Implement damage over time in fennecs by passing a scaled uniform into Stream.For and despawning entities whose health reaches zero. - [1,2,3 Numbering Entities](https://fennecs.net/cookbook/staples/Numbering.md): Five ways to assign contiguous index numbers to entities in fennecs, comparing enumerator uniforms, closures, concurrent queues, and Raw spans. - [OOP & Inheritance](https://fennecs.net/cookbook/staples/OOP.md): Using inheritance with fennecs components: register one instance under base and derived types to opt into polymorphic queries and shared methods. - [Exotics (WIP)](https://fennecs.net/cookbook/substitutes/index.md): Introduction to the exotic fennecs recipes: experimental architecture substitutes and refactoring tricks for adventurous ECS developers. - [Queries as Components](https://fennecs.net/cookbook/substitutes/QueryComponents.md): Work-in-progress recipe exploring metaprogramming in fennecs by storing Query objects inside components; a placeholder with more content coming soon. - [Self-Modifying Systems](https://fennecs.net/cookbook/substitutes/SelfModifying.md): Work-in-progress sketch of self-modifying systems in fennecs, storing runner delegates in component data to build data-driven state machines. - [Godot Cuisine](https://fennecs.net/cookbook/godot/index.md): Landing page for Godot-specific fennecs recipes: patterns for combining the ECS with Godot's scene tree, starting with entity-node association. - [EntityNode](https://fennecs.net/cookbook/godot/EntityNode.md): Pattern for pairing fennecs entities with Godot nodes: spawn an entity in _EnterTree, expose the node as a component, and despawn on Dispose. - [Mise en Place](https://fennecs.net/cookbook/mise-en-place/index.md): The tools and places to cook with fennecs - coding agents, IDE install guides, engines, and other kitchen setup. - [Agents](https://fennecs.net/cookbook/mise-en-place/Agents.md): How to install the official fennecs skill for AI coding agents like Claude Code, Codex, and OpenCode - a compact, source-verified API guide. - [Cursed Meals](https://fennecs.net/cookbook/cursed/index.md): Performance hexes, haunted benchmarks, and other kitchen nightmares - debugging war stories from the fennecs den. - [Microcode](https://fennecs.net/cookbook/cursed/Microcode.md): How subnormal floats and FP assists can silently make identical code 3x slower - a fennecs benchmark ghost story, with reproducible code. ## Examples & Demos - [Examples](https://fennecs.net/examples/index.md): Gallery of fennecs example projects: the Cubes and N-Body demos integrated with game engines like Godot and Stride, with videos and source links. - [Demo: Lots of Cubes](https://fennecs.net/examples/Cubes.md): fennecs demo walkthrough: simulate masses of cube entities on the CPU and bulk-transfer their transforms into the Godot and Stride renderers. - [Demo: N-Body Problem](https://fennecs.net/examples/NBody.md): fennecs demo walkthrough: an N-body gravity simulation built with entity-entity relations, shown running in the Godot engine with a concise update loop. ## Optional - [Misc, etm.](https://fennecs.net/misc/index.md): Landing page for the miscellaneous section of the fennecs docs, which collects the changelog, glossary, roadmap, and acknowledgements. - [Glossary](https://fennecs.net/misc/Glossary.md): Definitions of ECS terms used in the fennecs documentation, including Aspects, Fragmentation, Identity, Structural Changes, and the World Lock. - [Changelog](https://fennecs.net/misc/Changelog.md): Release notes for fennecs, the tiny C# Entity-Component System: every version's new features, breaking changes, bug fixes, and upgrade guidance. - [Roadmap](https://fennecs.net/misc/Roadmap.md): Planned features and milestones for the fennecs Entity-Component System, from Aspects and the unified entity refactor to SIMD math and a benchmark suite. - [Acknowledgements](https://fennecs.net/misc/Acknowledgements.md): Credits for fennecs, the tiny C# Entity-Component System: thanks to HypEcs creator Byteron, illustrator Maria Angelica, Volpeon's Neofox emoji, and more.