Original Post
Hi,
Am working on an Entity component system similar to the outboard system described here and other places.
I have subsystems like Renderer, Physisc, AI etc that hook into events that trigger in the scene.
One such event is EntityAddedEvent which triggers when a new entity is created.
The subsystems get this event and create their own type of component (Renderer -> RenderComponent, Physics -> PhysicsComonent) for the entity.
I'd like to be able to pass initialisation data to the subsystems for use in setting up there component eg. Mesh data, initial positiion etc
At the moment, I have created an EntityParameter object which gets passed to each subsystem.
The EntityParameter object hold a table of values per each component type it wants created eg.
table ["Renderer"] =
table ["Physics"] =
table ["Physics"] =
So each subsystem can then issues commands like - EntityParameter->GetValue ("Renderer", "Mesh") and uses that data to initialise its component.
Is this a good approach?
How do you guys handle this issues of passing data to subsystem for use during their component creation and initialisation?
Thanks.
Am working on an Entity component system similar to the outboard system described here and other places.
I have subsystems like Renderer, Physisc, AI etc that hook into events that trigger in the scene.
One such event is EntityAddedEvent which triggers when a new entity is created.
The subsystems get this event and create their own type of component (Renderer -> RenderComponent, Physics -> PhysicsComonent) for the entity.
I'd like to be able to pass initialisation data to the subsystems for use in setting up there component eg. Mesh data, initial positiion etc
At the moment, I have created an EntityParameter object which gets passed to each subsystem.
The EntityParameter object hold a table of values per each component type it wants created eg.
table ["Renderer"] =
table ["Physics"] =
table ["Physics"] =
So each subsystem can then issues commands like - EntityParameter->GetValue ("Renderer", "Mesh") and uses that data to initialise its component.
Is this a good approach?
How do you guys handle this issues of passing data to subsystem for use during their component creation and initialisation?
Thanks.