一种高性能组件导向的 ECS 方案,可无缝支持稀疏集和原型。
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 System;
using Frent;
using Frent.Components;
using System.Numerics;
using World world = new World();
Entity entity = world.Create(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());
record struct Position(Vector2 Value);
record struct Velocity(Vector2 Delta) : IUpdate
{
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.
struct & class as componentsdeltaTimeEntityMarshal and WorldMarshal for even faster speeds!Wanna help?
Report bugs, suggest APIs, and give general feedback. Just open an issue before starting a large feature.
暂无开放 Issues,或尚未同步最近议题。