Skip to main content
added 15 characters in body
Source Link
danijar
  • 5.8k
  • 10
  • 42
  • 64

How do you currently communicate between systems? If you have some kind of messaging or event manager, you could have a create_entity message that gets send to all systems along with the parsed XML tree. Each systemsSystems looks for its propertiestags describing their components and createdcreate them if found.

You could also share the propertycomponent arrays between systems. For example you can create a PropertyCollectionsComponentCollections class and pass a reference to the constructors of your systems. It can be related and doesn't need to know about your propertycomponent types. This way, a system can create complete entities. You may want one dedicated system to load and create entities though so that the other systems depend on as few propertiescomponents as possible.

This is also useful if the RenderSystem wants to access the world position of objects that is updated by the PhysicsSystem.

By the way, if you want cache-locality, the propertiescomponents must be stored consecutively in memory i.e. in an array or vector rather than a map. You can however have a map from entity id to vector index for random access.

How do you currently communicate between systems? If you have some kind of messaging or event manager, you could have a create_entity message that gets send to all systems along with the parsed XML tree. Each systems looks for its properties and created them if found.

You could also share the property arrays between systems. For example you can create a PropertyCollections class and pass a reference to the constructors of your systems. It can be related and doesn't need to know about your property types. This way, a system can create complete entities. You may want one dedicated system to load and create entities though so that the other systems depend on as few properties as possible.

This is also useful if the RenderSystem wants to access the world position of objects that is updated by the PhysicsSystem.

By the way, if you want cache-locality, the properties must be stored consecutively in memory i.e. in an array or vector rather than a map. You can however have a map from entity id to vector index for random access.

How do you currently communicate between systems? If you have some kind of messaging or event manager, you could have a create_entity message that gets send to all systems along with the parsed XML tree. Systems looks for tags describing their components and create them if found.

You could also share the component arrays between systems. For example you can create a ComponentCollections class and pass a reference to the constructors of your systems. It can be related and doesn't need to know about your component types. This way, a system can create complete entities. You may want one dedicated system to load and create entities though so that the other systems depend on as few components as possible.

This is also useful if the RenderSystem wants to access the world position of objects that is updated by the PhysicsSystem.

By the way, if you want cache-locality, the components must be stored consecutively in memory i.e. in an array or vector rather than a map. You can however have a map from entity id to vector index for random access.

added 218 characters in body; added 70 characters in body
Source Link
danijar
  • 5.8k
  • 10
  • 42
  • 64

How do you currently communicate between systems? If you have some kind of messaging or event manager, you could have a create_entity message that gets send to all systems along with the parsed XML tree. Each systems looks for its properties and created them if found.

You could also share the property arrays between systems. For example you can create a PropertyCollections class and pass a reference to the constructors of your systems. It can be related and doesn't need to know about your property types. This way, a system can create complete entities. You may want one dedicated system to load and create entities though so that the other systems depend on as few properties as possible.

This is also useful if the RenderSystem wants to access the world position of objects that is updated by the PhysicsSystem.

By the way, if you want cache-locality, the properties must be stored consecutively in memory i.e. in an array or vector rather than a map. You can however have a map from entity id to vector index for random access.

How do you currently communicate between systems? If you have some kind of messaging or event manager, you could have a create_entity message that gets send to all systems along with the parsed XML tree. Each systems looks for its properties and created them if found.

You could also share the property arrays between systems. For example you can create a PropertyCollections class and pass a reference to the constructors of your systems. This way, a system can create complete entities. You may want one dedicated system to load and create entities though so that the other systems depend on as few properties as possible.

This is also useful if the RenderSystem wants to access the world position of objects that is updated by the PhysicsSystem.

How do you currently communicate between systems? If you have some kind of messaging or event manager, you could have a create_entity message that gets send to all systems along with the parsed XML tree. Each systems looks for its properties and created them if found.

You could also share the property arrays between systems. For example you can create a PropertyCollections class and pass a reference to the constructors of your systems. It can be related and doesn't need to know about your property types. This way, a system can create complete entities. You may want one dedicated system to load and create entities though so that the other systems depend on as few properties as possible.

This is also useful if the RenderSystem wants to access the world position of objects that is updated by the PhysicsSystem.

By the way, if you want cache-locality, the properties must be stored consecutively in memory i.e. in an array or vector rather than a map. You can however have a map from entity id to vector index for random access.

Source Link
danijar
  • 5.8k
  • 10
  • 42
  • 64

How do you currently communicate between systems? If you have some kind of messaging or event manager, you could have a create_entity message that gets send to all systems along with the parsed XML tree. Each systems looks for its properties and created them if found.

You could also share the property arrays between systems. For example you can create a PropertyCollections class and pass a reference to the constructors of your systems. This way, a system can create complete entities. You may want one dedicated system to load and create entities though so that the other systems depend on as few properties as possible.

This is also useful if the RenderSystem wants to access the world position of objects that is updated by the PhysicsSystem.