Hello dear community,
I would like to use an EntitySystem in my next game. I read about how they work and I decided to just give it a try.
I want my models to have one certain attribute: the EntityType (e.g. Torch, Stone, Player, …). I would add this as user data to the spatial. In order to illustrate how I would organize the whole thing I made the following picture in Paint ^^
EntityType is an enum which contains all types of entites with their (default) components and also defines the specific control which has to be a subclass of EntityControl.
Now, let’s assume I have a scene with some models (e.g. several torches laying on the ground).
When the game world is loaded the scenegraph is searched through for spatials with an EntityType attribute. For those an the specific control is added which in turn adds a real Entity object.
A torch for example would have a FireComponent which holds a boolean “isOn”. Depending on this value the TorchControl would activate / deactivate a particle effect.
Is this approach good or bad, and why?