Skip to main content
added 2 characters in body; edited title
Source Link
user1430
user1430

Why are entities in an Entitya component system composed at run time?

Why are entity component systems the way they are? For example as far as I have seen it may look like this

class Entity
    list of components
    add component
    remove component
    update comentent
    ....

So you are building your entities at runtime. I assume it will look like this

 Entity ork;
 ork.add(AI).add(movement).add(physics).add(renderer)

The problem I see with this approach is that errors appear at run time instead of compile time. It also seems to add a lot of potential errors for example the AI system only makes sense if the entity also has a movement component. What

What is the advantage of building your objects that way instead of doing it like this?

class Ork: IEntity
     movementComp
     AiComp
     physicsComp
     rendererComp
     ....
     //wire everything together

One possible advantage that I can see is that object creation takes less code because you don't really need to wire up your objects, you just add your components and your done.

Would you please enlighten me?

Why are entities in an Entity component system composed at run time?

Why are entity component systems the way they are? For example as far as I have seen it may look like this

class Entity
    list of components
    add component
    remove component
    update comentent
    ....

So you are building your entities at runtime. I assume it will look like this

 Entity ork;
 ork.add(AI).add(movement).add(physics).add(renderer)

The problem I see with this approach is that errors appear at run time instead of compile time. It also seems to add a lot of potential errors for example the AI system only makes sense if the entity also has a movement component. What is the advantage of building your objects that way instead of doing it like this?

class Ork: IEntity
     movementComp
     AiComp
     physicsComp
     rendererComp
     ....
     //wire everything together

One possible advantage that I can see is that object creation takes less code because you don't really need to wire up your objects, you just add your components and your done.

Would you please enlighten me?

Why are entities in a component system composed at run time?

Why are entity component systems the way they are? For example as far as I have seen it may look like this

class Entity
    list of components
    add component
    remove component
    update comentent
    ....

So you are building your entities at runtime. I assume it will look like this

 Entity ork;
 ork.add(AI).add(movement).add(physics).add(renderer)

The problem I see with this approach is that errors appear at run time instead of compile time. It also seems to add a lot of potential errors for example the AI system only makes sense if the entity also has a movement component.

What is the advantage of building your objects that way instead of doing it like this?

class Ork: IEntity
     movementComp
     AiComp
     physicsComp
     rendererComp
     ....
     //wire everything together

One possible advantage that I can see is that object creation takes less code because you don't really need to wire up your objects, you just add your components and your done.

Would you please enlighten me?

Tweeted twitter.com/#!/StackGameDev/status/423787775629205504
Source Link
Maik Klein
  • 443
  • 3
  • 11

Why are entities in an Entity component system composed at run time?

Why are entity component systems the way they are? For example as far as I have seen it may look like this

class Entity
    list of components
    add component
    remove component
    update comentent
    ....

So you are building your entities at runtime. I assume it will look like this

 Entity ork;
 ork.add(AI).add(movement).add(physics).add(renderer)

The problem I see with this approach is that errors appear at run time instead of compile time. It also seems to add a lot of potential errors for example the AI system only makes sense if the entity also has a movement component. What is the advantage of building your objects that way instead of doing it like this?

class Ork: IEntity
     movementComp
     AiComp
     physicsComp
     rendererComp
     ....
     //wire everything together

One possible advantage that I can see is that object creation takes less code because you don't really need to wire up your objects, you just add your components and your done.

Would you please enlighten me?