-
Based on the examples, it looks like the base Entity type that all entities of a World have expects it to enumerate all of the possible components it could have? Is this right? I suppose in practice, its not that big of a deal to enumerate all of the possible types, but it feels odd from an ECS perspective. I like how lightweight this library is compared to libraries that are more hyper-focused on the performance aspect of ECS, but I can't shake the feeling that having a monolithic object that can store 1 of each possible component just feels off. How do you all tend to use your Entity class? Do you leave it totally untyped? Fully specified? What is the expected best practice here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
The library is fully typed (it infers correctly in the relevant use cases), I'm not the author but I believe that was the hardest part of building the library. Did you open and try to edit the example code in a typescript-capable editor? |
Beta Was this translation helpful? Give feedback.
So, one thing to remember is that there are many ways to actually compose the Entity type, instead of defining it monolithically. I've had projects where I did something like the following:
There are, of course, many variations on this.
In a similar vein, remember that Miniplex expects entities to be objects, but doesn't really care what these objects actually are. I've had at least one project where I actually implemented entities as class instances to explore this. It might feel far removed from typical ECS thinking, but I was enjoying it …