A high-performance, low-memory, archetype-based EC framework/ECS library for C#.
Whaaaat?! Aren't there enough ECS libraries out there!
While Frent's implementation is a hybrid archetype- and sparse-set-based ECS, that's not why Frent was made. Frent is primarily an EC framework—an Entity Component framework—that lets you use composition for code reuse rather than inheritance with minimal boilerplate. Write components that include behavior, lifetime management, and events while enjoying all the performance benefits of an ECS.
Want to write systems anyway? Frent also has a Systems API that lets you query entities in the style of an ECS.
Warning
Frent is still in beta and is not completely stable.
using Frent;
using Frent.Systems;
using Frent.Components;
using System.Numerics;
using World world = new World();
Entity entity = world.Create<Position, Velocity>(new(Vector2.Zero), new(Vector2.One));
// Call Update to run the update functions of your components.
world.Update();
// Position is (1, 1)
Console.WriteLine(entity.Get<Position>());
record struct Position(Vector2 Value);
record struct Velocity(Vector2 Delta) : IUpdate<Position>
{
public void Update(ref Position position) => position.Value += Delta;
}Wanna learn more? Dive into the docs or check out the Interactive Demo!
There are also samples for MonoGame, Unity, and Godot.
Frent is a lot faster than most C# ECS implementations - Benchmark.
- Tiny entity struct the size of 8 bytes
- Up to 127 components per entity
-
struct&classas components - Pass in uniform data automatically, such as
deltaTime - AOT Compatible & Zero reflection
- Links (Entity relationships)
- Tags
- Events
- Command buffer
- Multithreading
- Seamless storage in sparse sets or archetypes
- Automatic structural change management
- Create entities anytime - no command buffer
-
EntityMarshalandWorldMarshalfor even faster speeds!
Wanna help?
Report bugs, suggest APIs, and give general feedback. Just open an issue before starting a large feature.