Entity System with C++
Posted
by
Dono
on Game Development
See other posts from Game Development
or by Dono
Published on 2012-09-07T15:21:45Z
Indexed on
2012/09/07
21:51 UTC
Read the original article
Hit count: 475
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 ?
© Game Development or respective owner