Ok, so I've been roaming around the internet looking for actual code implementations (C++) of component based entity systems and so far I have found none. I understand the concept; you can attach components to a single 'Entity' class, and as soon as you do that a system will add the entity to a list of entities to be updated. For example you have a 'Render' component. You would do something like this:
// UNTESTED PSUEDO-C++ CODE
RenderComponentSystem rcs;
Entity e;
/*
This will somehow add the RenderComponent to a vector(?) of pointers
to the base 'Component' class. It will also add the entity to the
RenderComponentSystem to be updated accordingly.
*/
e.attachComponent(static_cast<Component*>(new RenderComponent()), static_cast<ComponentSystem*>(&rcs));
// But how would you access that component?
// e.components(RENDER_COMPONENT)->blah() ?
Then you would have the issue of removing components. Perhaps the entity could store a pointer to the ComponentSystem for each Component, then update the system accordingly?Any help is greatly appreciated.


