appel wrote:
1. Do not use Entity.getComponent(), use the ComponentMapper as it's much faster.
I just had a look at the game's source code which
does use Entity.getComponent()

Snippet from PlayerShipControlSystem.java, method process(Entity e):
Code:
if (shoot) {
Entity missile = EntityFactory.createMissile(world);
missile.getComponent(Transform.class).setLocation(transform.getX(), transform.getY() - 20);
missile.getComponent(Velocity.class).setVelocity(-0.5f);
missile.getComponent(Velocity.class).setAngle(90);
missile.insert();
shoot = false;
}
Quote:
3. Therefore, components do not talk to each other. There's nothing like that. You can have system communicating, but that should be an exception.
Naah, you kind of cheat a bit here. You have ComponentMappers to retrieve certain components of an entity. For example you access the health component of the player ship to change the value if you are hit by a bullet. I would call that communication between components

No matter what, somehow you need to pass information between components - otherwise you would have a static system!
Quote:
4. Entities do not contain components, they reside elsewhere behind the scenes.
Huh?
Code snippet of StarWarriors EntityFactory.java:
Code:
public static Entity createEnemyShip(World world) {
Entity e = world.createEntity();
world.getGroupManager().add("SHIPS", e);
e.addComponent(new Transform());
e.addComponent(new SpatialForm("EnemyShip"));
e.addComponent(new Health(10));
e.addComponent(new Weapon());
e.addComponent(new Enemy());
e.addComponent(new Velocity());
return e;
}
Are you sure that entities don't have components?
Quote:
5. Having multiple components of same type in a entity is usually an indication of a design flaw.
How would you design a ship with two cannons? Create a component for double shot? Or simply use two single shot components?
Please don't get me wrong, appel - I don't want to criticise you or the framework - it was just the way I understood the framework and how I interpreted your source code. Maybe I just misunderstood something, so I already apologize ahead if this sounds too harsh.
Peace,
Tommy