DavidPeicho / ecstra

Fast & Flexible EntityComponentSystem (ECS) for JavaScript & TypeScript
MIT License
51 stars 2 forks source link

Time / Name components #20

Open delaneyj opened 3 years ago

delaneyj commented 3 years ago

It appears you are treating entity name and time as a special case. I've found having a global "singleton" entity with a TimeConponent advantageous as systems can conditional manipulate time given events. Same with the createEntity(name) is possibly better suited to a NameComponent{name:string}. It makes things like stats generation much easier if there is no special case and the system is generic as possible.

DavidPeicho commented 3 years ago

I agree at least for the name. I am thinking of actually just having entity IDs, generated or set by the user. Right now I have a name, as well as an auto-generated ID.

I am not really treating time right now in any special case. I just accept the delta time in the systems. I think you would still be able to use your singleton and your own time component with this