Vittorio Romeo gave a very good talk on ECS design which is worth checking out.
Thanks for the link. I've seen quite a few videos from Vittorio, he's one of the few guys who makes high-quality videos about programming (unlike some popular tutorial authors who barely know how to write a correct C++ program, but that's a different topic...) Currently watching it, seems great so far
The RenderableComponent deals with drawing. I need to store those objects somewhere (both sf::Drawable and sf::Transformable part), so they don't just go out of scope.
Yes, as a smart pointer in RenderComponent. A smart pointer owns its pointee.
as KinematicsComponent will also need access to sf::Transformable part of sf::Sprite).
Why would a physics component need to store a sprite? Why can't it just keep its own independent copy of the transform, either as separate position/rotation/scale, or as a sf::Transformable object? There's no reason why it must reference
the same sprite used in the RenderComponent. In fact, the point of introducing components is to split data and to get rid of such implicit dependencies. Nobody cares if a few bytes are duplicated.
On the other hand, truly separating the two gives you great flexibility. Now you have an implicit dependency between RenderComponent and KinematicsComponent: The one who references the sprite cannot live with the one who stores it. That's unnecessary. You want to be able to create KinematicsComponents even if there is no corresponding RenderComponent; imagine invisible objects that still have a physical representation in the world.
Furthermore, if KinematicsComponent is supposed to live up to its name, it should at least support velocity and possibly angular velocity, as well as second derivatives (acceleration). On the other hand, I'm not sure if an origin in SFML's sense is necessary. So sf::Transform is still too limited, and you need a better representation of your physical objects anyway.
But I guess I could at least use template class (although I am not too familiar with template metaprogramming - at least I will learn something new ).
I have no idea how this relates to the rest of the discussion. In any case, template programming and template
metaprogramming are different things.
I consider it a good design choice, and am more interested if there are other disadvantages besides a minor implementation time addition.
I use a more pragmatic decision process: I don't use anything unless I can argue what critical
advantage it brings me. If I have to start arguing why a certain feature has a disadvantage and is thus not used, I won't ever get anywhere.
Besides, "minor implementation time" is not the only thing to consider. Whatever you add to your code needs to be maintained until eternity, so choose carefully. If you're not sure where to store a sprite, I doubt that an Object Pool is the one thing you need right now. Start simple, and add things when the need develops, not before.