(this is my first post on lemmy, I hope this works like I expect it does. critique and advice are very welcome and appreciated)
fennecs 🔗
Hello, I’m tiger (aka jupiter), and since earlier this year I’ve been working on a free, libre, and open source Entity-Component System in pure C# that aims to minimize boilerplate and dependencies, works without code generators, and give decent flexibility and performance.
Who is it for?
ECS are an architecture to apply game or other logic to large numbers (ballpark: tens and hundreds of thousands) of objects or actors in an interactive game or simulation, and ECS libraries usually enable expressive composition that go beyond the the intrinsic optimizations of keeping data close together in memory.
fennecs is lightweight and works well with Godot 4.x, The NuGet package is going into its 0.6.0 release soon (about 20 releases so far - see the roadmap)
fennecs is made to operate in just about any sufficiently advanced .NET environment (.NET 8 or later), sadly this precludes using it with Unity for about another two years - but it was created after I spent around five years working with DOTS and coming to the conclusion that it is just too heavy on boilerplate for small teams or solo developers.
There are two simple demos for Godot, a demo for the Stride engine, and when I or one of the other contributors get around to it, demos for raylib_cs, Flax, MonoGame, and others are coming, as well as more demos for Godot.
Possibly ShapeEngine and especially Murder Engine are first in line, though.
What would I like?
Easy - I’d love to hear your thoughts or questions about it if you find the time. It means the world to me to hear other viewpoints or discuss features and contributions with the wider public.
Performance?
Funny you should ask. Everywhere I post, somehow with ECS this appears to be the first question.
Even though top performance isn’t the focus (minimum boilerplate is!), thanks to its compact memory layout, fennecs is doing quite all right in Doraku’s synthetic C# ECS benchmarks; of which you can find an excerpt on fennecs’s github. Performance hardliners can rest assured that another optimization pass comes with the 0.7.x release cycle, after the SIMD interfaces are made available.
Unique traits
fennecs is relational, allowing grouping entities by data-backed relations with other entities (bob owes alice
) that are automatically cleaned on entity despawn; by link objects (in physics world P
); and soon by arbitrary typed secondary keys (version 0.6.x).
Its Stream Views
allow code to access the contiguous storage components are stored in in various ways (including just the raw memory to submit to GPUs or game engines),
Batch operations can modify whole groups of entities or components at once, in a fast and intuitive way.
The SIMD operators currently in development are likely to keep fennecs at the forefront for a wide variety of typical tasks, such as integrating positions and accelerations, matrix transforms, increments, etc.
SIMD ops internally use AVX2, SSE2, and AdvSIMD intrinsics to vectorize their operations where possible, and more complex operations can be composed by sequential ops.
This field is where fennecs’ “low boilerplate” design goal doesn’t clash with actual high performance and systems programming, and it is great for the optimization stages in game development.
Each release has close to 100% unit test coverage, and because it’s pure C#, debugging, inspection and refactoring tools work very well with it.
One last, hidden advantage of being pure C# is that fennecs keeps its data in the .NET domain. Potential performance drawbacks of this are compensated very well by having to marshal function calls and component data back and forth much less frequently than many native-code ECS with C# bindings would.
Cute mascot!
Whenever ECS is brought up, I just can’t think of a game I’d make where the pros outweigh the cons. I’ve come to the conclusion that I just don’t understand it yet, so I’d love it if someone who’s as passionate as you clearly are, could impart some of the things that made you fall in love with it.
@Charzard4261 @jupiter I’ve implemented an “ECS-like” sort of for the game I’m working on and so far it has huge advantages. I’ve (mostly) distinct components that I can attach to my entities and I can modify these at runtime.
Therefore I can easily add/modify/remove stats for an entity, change its model or define that it’s burnable in their respective components. I’m currently able to define new Items and somewhat “configure” this items based on the current components without writing code!
That’s really awesome, would love to see how and what you’re doing with it! There are many approaches to composition in the various ECS flavors, and the “OG” ECS, “Entity System” in Dungeon Siege, had no-code composability for designers as one of its core principles.
@jupiter Oh I didn’nt knew that :D is there more info on the Dungeon Siege approach?
I’m working on a first person 3D dungeon crawler inspired by Arx Fatalis etc and interactions are really important. I’ve configured several items for testing purposes, so I can take a Torch that has a ModelComponent for the 3D Model and physics properties and a ChemistryComponent that’s configured so it’s burnable. I can take that Item and carry it to a fire in order to heat it up and it starts burning :)
It’s been a while since this was “hot news” - but here’s a link to one of their GDC talks :) https://www.gamedevs.org/uploads/data-driven-game-object-system.pdf