Skip to content

itsBuggingMe/Frent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a98ab2f · Mar 1, 2025
Jan 12, 2025
Feb 28, 2025
Feb 23, 2025
Mar 1, 2025
Feb 28, 2025
Feb 22, 2025
Mar 1, 2025
Feb 27, 2025
Feb 1, 2025
Dec 30, 2024
Jan 12, 2025
Jan 1, 2025
Jan 1, 2025
Feb 24, 2025

Repository files navigation

NuGet NuGet GitHub commit activity (branch) GitHub Repo stars

A high preformance, low memory usage, archetyped based ECF/ECS library for C#.

Whaaaat?! Aren't there enough ECS libraries out there!

While Frent's implementation is an archetype based ECS, thats not why Frent was made. Frent is primarily an ECF - Entity Component Framework - that allows you to easily use composition for code reuse rather than inheritance with minimal boilerplate. Think Unity's Monobehavior powered by the principles and speed of an ECS, as well as less boilerplate.

Want to write systems anyways? Frent also has a Systems API that allows you to query entities in the style of an ECS.

Caution

Frent is still in beta and is not completely stable.

Quick Example

using Frent;
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) : IComponent<Position>
{
    public void Update(ref Position position) => position.Value += Delta;
}

Wanna learn more? Check out the docs!

Preformance

Frent is a lot faster than most C# ECS implementations - Benchmark.

Features

Implemented

  • Entity struct the size of a 64 bits
  • Up to 127 components per entity
  • Getting, Adding, and Removing components
  • Classes as components
  • Structs as components
  • Deconstructing entities
  • Component memory stored contiguously (when using structs)
  • Get/Has/TryGet O(1) and highly optimised
  • Pass in uniform data e.g., deltaTime
  • Deconstructing entities
  • Zero reflection
  • AOT Compatible
  • Built in Uniform Provider implementation
  • Non-Generic Entity Creation
  • Entity Tags
  • World Update Filtering
  • Command buffer
  • Component/Tag Add/Remove Events (with generic version)
  • Automatic structual change management during queries

Future

  • Comprehensive docs
  • 100% Test coverage
  • More samples, examples, & explanations!
  • Multithreading
  • EntityMarshal and WorldMarshal for even faster speeds!

Contributing

Wanna help?

Report bugs, suggest APIs, and give general feedback. Just open an issue before starting a large feature.