back to home

friflo / Friflo.Engine.ECS

High-performance C# ECS

572 stars
53 forks
36 issues
C#Wolfram LanguageGLSL

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing friflo/Friflo.Engine.ECS in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/friflo/Friflo.Engine.ECS)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

friflo ECS Friflo ECS is a high performance C# ECS with focus on simplicity and reliability. The library is designed for easy integration and a smooth developer experience. Among various C# ECS projects, it is currently the only one fully implemented in Managed C#. By this no use of code preventing crashes due to memory corruption. What is ECS - Entity Component System? An ECS is a software architecture pattern. See ECS ⋅ Wikipedia. It is often used in the Gaming industry - e.g. Minecraft - and used for high performant data processing. An ECS provide two strengths:• It enables writing *highly decoupled code*. Data is stored in **Components** which are assigned to objects - aka **Entities** - at runtime. Code decoupling is accomplished by dividing implementation in pure data structures (**Component types**) - and code (**Systems**) to process them. • It enables *high performant system execution* by storing components in continuous memory to leverage CPU caches L1, L2 & L3. It improves CPU branch prediction by minimizing conditional branches when processing components in tight loops. Highlights• 🔥 **Top Performance** - C/C++/Rust speed and memory efficiency. Various benchmarks below.• 🧩 **Bare Essentials** - Provide only ECS core concepts: components, tags, relations and systems. Thats it!• 🎯 **Simple** - Clean & Simple API. No boilerplate. Check the Documentation with many examples.• 🛡️ **Reliable** - Built for production. Fully Managed C# - No unsafe code. High test coverage.• 🙏 **Community** - Helpful and welcoming support on Discord and Github. Features **🚀 New in v3.5.0** Introduced new pattern to process events on adding/removing components or tags more performant and concise. See: Map components to enums and Map tags to enums.• [x] High performant / type-safe queries• [x] Efficient multithreaded queries• [x] Fast batch / bulk operations• [x] Command buffers *aka* deferred operations• [x] Clone / Copy entities• [x] Entity hierarchy *aka* scene tree• [x] Relationships and relations• [x] Component Search in O(1)• [x] Entity / component events• [x] Allocation free enumerators• [x] Systems and groups• [x] JSON Serialization• [x] SIMD Support• [x] Type-safe Add/Remove/Get component. No potential memory corruption like in Arch.• [x] Single library. No exclusive feature combinations such as events, assertions or debug/release.• [x] Zero allocations after buffers are large enough.• [x] Automatic component type registration• [x] Supports .NET Standard 2.1 .NET 5 .NET 6 .NET 7 .NET 8 .NET 9 .NET 10 WASM / WebAssembly, Unity (Mono, AOT/IL2CPP, WebGL), Godot, MonoGame• [x] Native AOT• [x] CLS Compliant API - supporting all .NET languages: C#, F#, VB.NET, ...• [x] Debug Tools: Watch entities, components, tags, relations, query results, systems, ... Screenshot - Watch ad-hoc query result in debugger • [x] Fully Managed C#. No *unsafe code*, *native dll bindings* and *access violations*. Behavior of access violation bugs using unsafe code Get package on nuget or use the dotnet CLI. Projects using friflo ECS Louis Adventure      Play in Browser Tech Demo of a 2D platformer with focus on movement mechanics. ECS is used for core game logic, component-base abilities, physics / collisions & triggers, state machines / behavior logic, gameplay events and UI integration. more ... RaygueLike Challenge      Play in Browser · GitHub Project is hosted on GitHub and supports Desktop and WASM. Rendering of 3D environment and 2D sprites is implemented with Raylib. Interesting note: It combines behavior trees with ECS. more ... Horse Runner DX Quote from developer: *"Just wanted to let you know that Friflo ECS 2.0.0 works like a charm in my little game. I use it for basically everything (landscape segments, vegetation, players, animations, collisions and even the floating dust particles are entities). After some optimization there is no object allocation during gameplay - the allocation graph just stays flat - no garbage collection."* **Want to add a project?** Create a GitHub Discussion or message on Discord. Demos MonoGame Demo is available as WASM / WebAssembly app. **Try Demo in your browser**. Demo projects on GitHub below. MonoGame Unity Godot *Desktop Demo performance:* Godot 202 FPS, Unity 100 FPS at 65536 entities. All example Demos - **Windows**, **macOS** & **Linux** - available as projects for **MonoGame**, **Unity** and **Godot**. See Demos · GitHub **New features in 3.0.0**• Index / Search used to search entities with specific component values in O(1). E.g• To lookup entities having a *TileComponent* with a specific tile id.• To lookup network entities with a *NetComponent* using a custom identifier like a , or a .• Relationships to create links / connections between entities. Used for:• Attack systems• Path finding / Route tracing• Model social networks. E.g friendship, alliances or rivalries• Build any type of a directed graph using entities as *nodes* and links or relations as *edges*• Relations to add multiple *"components"* of the same type to a single entity. E.g.• Inventory systems• To model one-to-many data structures Big shout out to **fenn**ecs and **flecs** for the challenge to improve the feature set and performance of this project! ⏩ Examples This section contains two typical use cases when using an ECS. More examples describing use of various features are at friflo ECS - Documentation. **🚀 Hello World** The hello world examples demonstrates the creation of a world, some entities with components and their movement using a simple call. In case of moving (updating) thousands or millions of entities an optimized approach can be used. See: Enumerate Query Chunks, Parallel Query Job and Query Vectorization - SIMD. All query optimizations are using the same but with different enumeration techniques. **⚙️ Systems** Systems are new in **Friflo.Engine.ECS v2.0.0** Systems in ECS are typically queries. So you can still use the shown in the "Hello W…