Conversation
Notices
-
Embed this notice
iced depresso (icedquinn@blob.cat)'s status on Tuesday, 14-Jan-2025 08:36:51 JST iced depresso
@copygirl @ajmmertens i looked at flecs' papers a few times. it seemed to involve a lot of intermediary object types (ex. every combination of components ends up getting its own table) which kinda :gutkato_strabas: eeeh'd me -
Embed this notice
copygirl (copygirl@fedi.anarchy.moe)'s status on Tuesday, 14-Jan-2025 08:36:52 JST copygirl
Reason why I like Flecs so much:
Question in the Flecs Discord: “What’s the best pattern for ‘replacing’ one system with another?”
(A “system” here being a function that is periodically run, and returns entities and their components based on a query, so that you can update them for example.)
In any other ECS, this would either not be possible, difficult, or kind of useless. A lot of them are “locked in” at compile time. Maybe hot swapping can help you during development. But in Flecs, it’s just this:
world.system("foo") .run([](flecs::iter& it) { // old implementation }); world.system("foo") .run([](flecs::iter& it) { // new implementation });(Example by @ajmmertens, the man himself.)
Of course this wouldn’t really be that useful, unless you literally plan on switching out pre-made systems, for which there’s more ECS-y ways to achieve the same thing.
Buuuut, if you dig a little deeper, you’ll find out that you can create every aspect of a system, a query, a component, … dynamically at runtime. And modify, replace or delete them. So, combine that with scripting and you can mod basically any aspect of the game at runtime.
In addition, Flecs uses its ECS “database” to store its own primitives. Components are entities, systems are entities, they are organized hierarchically in modules which, you guessed it, also entities. So on top of being able to inspect everything, you can even add new components to these system and component entities. For example, I dunno, to implement a permission system to restrict which entities a script is allowed to access / modify.
I could go on. Anyway, I’m really looking forward to whatever first makes use of this insane runtime moddability potential.
-
Embed this notice