Entity System with C++
- by Dono
I'm working on a game engine using the Entity System and I have some questions.
How I see Entity System :
Components : A class with attributs, set and get.
Sprite
Physicbody
SpaceShip
...
System : A class with a list of components. (Component logic)
EntityManager
Renderer
Input
Camera
...
Entity : Just a empty class with a list of components.
What I've done :
Currently, I've got a program who allow me to do that :
// Create a new entity/
Entity* entity = game.createEntity();
// Add some components.
entity->addComponent( new TransformableComponent() )
->setPosition( 15, 50 )
->setRotation( 90 )
->addComponent( new PhysicComponent() )
->setMass( 70 )
->addComponent( new SpriteComponent() )
->setTexture( "name.png" )
->addToSystem( new RendererSystem() );
My questions
Did the system stock a list of components or a list of entities ?
In the case where I stock a list of entities, I need to get the component of this entities on each frame, that's probably heavy isn't it ?
Did the system stock a list of components or a list of entities ?
In the case where I stock a list of entities, I need to get the component of this entities on each frame, that's probably heavy isn't it ?