Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@lorentz Glad it finally found a use. I wanted to use it for my ECS in rust but that wasn't a particularly good idea :D
-
@lorentz I wanted to differentiate it from more traditional ecs terminology bacause I had something quite a bit different in mind
-
@12bitfloat I'm a bit uncertain as to what ECS actually is. Bevy's approach is very conservative, but there's also Unity where behaviours have inheritance and the tree is kinda just for context, Godot where behaviours have both a tree (object tree) and an inheritance hierarchy, and identities are realised in the Scenes which are comparable to React components.
In my model, traits can implement other traits and entities have exactly one trait, but because casting to a trait is done via view objects, this is most efficiently realised by creating instances of parent traits on the distinguished traits that manage an entity's state. Conceptually it's somewhere between an is-a and a has-a relation, hence why I call it ECS. -
And just as I wrote this I realized that I forgot to pick an implementation based on the root trait, so it's very possible to end up with two different instances of the same trait - one direct and one indirect - referencing the same entity. Rubber ducking internet strangers is great!
-
@lorentz Traditionally ecs have dumb entities to which you can attach components which are just data. Then you have systems that specify which component combinations they want to work on and then they run over all entities with the given combinations
I don't know if I understood how you're doing it but what I like is that in your approach you can have entity "classes" (by having a super trait for each entity). That's not something an ecs typically does, which always annoyed me
Also behaviour on components/traits is a must! I don't understand how these people build pure data oriented ecs'. Have they never heard of encapsulation?
Related Rants
What do I call Components as used in ECS when my app is entirely written in React and I want to avoid the tedium of qualifying the names?
This is a really fundamental thing to the project so I get to pick less-than-ideal but short names since anyone who works with the code will encounter it within the first 5 minutes.
question
ecs
react
component