Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualjischneider

Posted 14 April 2012 - 09:37 AM

Thanks!

In this kind of hierarchy, should the parent and child knows about each other's components in general, and work accordingly?


Depends how you interpreted “knowing each other”.  The child only need to know the father world matrix and nothing more. It is possible that some custom script could also read some information from the father.

- Ideally all entities should be treated exactly the same (on the outside nothing knows or can know what components does the entity have)


Yes. The entity does not have an update, only the components.

- Each component is capable of working completely independently without the assumption or knowledge of any other component within the same entity


This is tricky. For example, a renderer component needs the world matrix from the transform component and the model from the model component. You just can’t avoid not knowing anything.
That said, yes, the component update has to be isolated. The only exception is the transform component; a physic component for instance could modify the entity’s transformation.

For the communication, the way I picture it huge switch-case blocks will need to be used for the "just in case there is a xyz component in this entity". Is that how it should be?


No, messages or events are the best. The component that needs information asks for the information, not the other way around. Read Jason book, read Unity3D reference, or look at my engine.

For the custom hierachy, when an entity is in Father-Child relationship, how does that affect the general operation? Does each component have to have a different set of switch-case statements in case the holding entity is a Child, or is a Father?


The components normally are very simple. Transformation components (a maybe physics components, I don’t know) are the only that needs to know the entity father. And actually, in the actual implementation the transform component is the only that holds the father (not even the entity). This is intended for data oriented optimizations and because is somehow logical.

#8jischneider

Posted 13 April 2012 - 05:30 PM

Thanks!

In this kind of hierarchy, should the parent and child know about each other's components in general, and work accordingly?


Depends how you interpreted “knowing each other”.  The child only need to know the father world matrix and nothing more. It is possible that some custom script could also read some information from the father.

- Ideally all entities should be treated exactly the same (on the outside nothing knows or can know what components does the entity have)


Yes. The entity does not have an update, only the components.

- Each component is capable of working completely independently without the assumption or knowledge of any other component within the same entity


This is tricky. For example, a renderer component needs the world matrix from the transform component and the model from the model component. You just can’t avoid not knowing anything.
That said, yes, the component update has to be isolated. The only exception is the transform component; a physic component for instance could modify the entity’s transformation.

For the communication, the way I picture it huge switch-case blocks will need to be used for the "just in case there is a xyz component in this entity". Is that how it should be?


No, messages or events are the best. The component that needs information asks for the information, not the other way around. Read Jason book, read Unity3D reference, or look at my engine.

For the custom hierachy, when an entity is in Father-Child relationship, how does that affect the general operation? Does each component have to have a different set of switch-case statements in case the holding entity is a Child, or is a Father?


The components normally are very simple. Transformation components (a maybe physics components, I don’t know) are the only that needs to know the entity father. And actually, in the actual implementation the transform component is the only that holds the father (not even the entity). This is intended for data oriented optimizations and because is somehow logical.

#7jischneider

Posted 13 April 2012 - 05:29 PM

Thanks!

In this kind of hierarchy, should the parent and child know about each other's components in general, and work accordingly?


Depends how you interpreted “knowing each other”.  The child only need to know the father world matrix and nothing more. It is possible that some custom script could also read some information from the father.

- Ideally all entities should be treated exactly the same (on the outside nothing knows or can know what components does the entity have)


Yes. The entity does not have an update, only the components.

- Each component is capable of working completely independently without the assumption or knowledge of any other component within the same entity


This is tricky. For example, a renderer component needs the world matrix from the transform component and the model from the model component. You just can’t avoid not knowing anything.
That said, yes, the component update has to be isolated. He could ask information. The only exception is the transform component; a physic component for instance could modify the entity’s transformation.

For the communication, the way I picture it huge switch-case blocks will need to be used for the "just in case there is a xyz component in this entity". Is that how it should be?


No, messages or events are the best. The component that needs information asks for the information, not the other way around. Read Jason book, read Unity3D reference, or look at my engine.

For the custom hierachy, when an entity is in Father-Child relationship, how does that affect the general operation? Does each component have to have a different set of switch-case statements in case the holding entity is a Child, or is a Father?


The components normally are very simple. Transformation components (a maybe physics components, I don’t know) are the only that needs to know the entity father. And actually, in the actual implementation the transform component is the only that holds the father (not even the entity). This is intended for data oriented optimizations and because is somehow logical.

#6jischneider

Posted 13 April 2012 - 05:27 PM

Thanks!

In this kind of hierarchy, should the parent and child know about each other's components in general, and work accordingly?


Depends how you interpreted “knowing each other”.  The child only need to know the father world matrix and nothing more. It is possible that some custom script could also read some information from the father.

- Ideally all entities should be treated exactly the same (on the outside nothing knows or can know what components does the entity have)


Yes. The entity does not have an update, only the components.

- Each component is capable of working completely independently without the assumption or knowledge of any other component within the same entity


This is tricky. For example, a renderer component needs the world matrix from the transform component and the model from the model component. You just can’t avoid not knowing anything.
That said, yes, the component update has to be isolated. He could ask information. The only exception is the transform component; a physic component for instance could modify the entity’s transformation.

For the communication, the way I picture it huge switch-case blocks will need to be used for the "just in case there is a xyz component in this entity". Is that how it should be?


No, messages or events are the best. The component that needs information asks for the information, not the other way around. Read Jason book, read Unity3D reference, or look at my engine.

For the custom hierachy, when an entity is in Father-Child relationship, how does that affect the general operation? Does each component have to have a different set of switch-case statements in case the holding entity is a Child, or is a Father?


The components normally are very simple. Transformation components (a maybe physics components, I don’t know) are the only that needs to know the entity father. And actually, in the actual implementation the transform component is the only that holds the father (not even the entity). This is intended for data oriented optimizations and because is something logical.

#5jischneider

Posted 13 April 2012 - 05:22 PM

Thanks!

In this kind of hierarchy, should the parent and child know about each other's components in general, and work accordingly?


Depends how you interpreted “knowing each other”.  The child only need to know the father world matrix and nothing more.

- Ideally all entities should be treated exactly the same (on the outside nothing knows or can know what components does the entity have)


Yes. The entity does not have an update, only the components.

- Each component is capable of working completely independently without the assumption or knowledge of any other component within the same entity


This is tricky. For example, a renderer component needs the world matrix from the transform component and the model from the model component. You just can’t avoid not knowing anything.
That said, yes, the component update has to be isolated. He could ask information. The only exception is the transform component; a physic component for instance could modify the entity’s transformation.

For the communication, the way I picture it huge switch-case blocks will need to be used for the "just in case there is a xyz component in this entity". Is that how it should be?


No, messages or events are the best. The component that needs information asks for the information, not the other way around. Read Jason book, read Unity3D reference, or look at my engine.

For the custom hierachy, when an entity is in Father-Child relationship, how does that affect the general operation? Does each component have to have a different set of switch-case statements in case the holding entity is a Child, or is a Father?


The components normally are very simple. Transformation components (a maybe physics components, I don’t know) are the only that needs to know the entity father. And actually, in the actual implementation the transform component is the only that holds the father (not even the entity). This is intended for data oriented optimizations and because is something logical.

#4jischneider

Posted 13 April 2012 - 05:20 PM

Thanks!

In this kind of hierarchy, should the parent and child know about each other's components in general, and work accordingly?


Depends how you interpreted “knowing each other”.  The child only need to know the father world matrix and nothing more.

- Ideally all entities should be treated exactly the same (on the outside nothing knows or can know what components does the entity have)


Yes. The entity does not have an update, only the components.

- Each component is capable of working completely independently without the assumption or knowledge of any other component within the same entity


This is tricky. For example, a renderer component needs the world matrix from the transform component and the model from the model component. You just can’t avoid not knowing anything.
That said, yes, the component update has to be isolated. He could ask information. The only exception is the transform component; a physic component for instance could modify the entity’s transformation.

For the communication, the way I picture it huge switch-case blocks will need to be used for the "just in case there is a xyz component in this entity". Is that how it should be?


No, messages or events are the best. Read Jason book, read Unity3D reference, or look at my engine.

For the custom hierachy, when an entity is in Father-Child relationship, how does that affect the general operation? Does each component have to have a different set of switch-case statements in case the holding entity is a Child, or is a Father?


The components normally are very simple. Transformation components (a maybe physics components, I don’t know) are the only that needs to know the entity father. And actually, in the actual implementation the transform component is the only that holds the father (not even the entity). This is intended for data oriented optimizations and because is something logical.

PARTNERS