I've been interested in the component based entity system for a while, and read countless articles on it (The Insomiac games, the pretty standard Evolve Your Hierarchy, the T-Machine, Chronoclast ... just to name a few).
They all seem to have a structure on the outside of something like:
Entity e = Entity.Create(); e.AddComponent(RenderComponent, ...); //do lots of stuff e.GetComponent<PositionComponent>(...).SetPos(4, 5, 6);
And if you bring in the idea of shared data (this is the best design I've seen so far, in terms of not duplicating data everywhere)
e.GetProperty<string>("Name").Value = "blah";
Yes, this is very efficient. However, it isn't exactly the easiest to read or write; it feels very clunky and working-against-you.
I personally would like to do something like:
e.SetPosition(4, 5, 6); e.Name = "Blah";
Though of course the only way to get to that kind of design is back in the Entity->NPC->Enemy->FlyingEnemy->FlyingEnemyWithAHatOn kind of hierarchy this design tries to avoid.
Has anyone seen a design for this kind of component system which is still flexible, yet maintains a level of user friendliness? And for that matter, manages to get around the (probably the hardest problem) data storage in a good way?
What designs are there for a component based entity system that are user friendly but still flexible?