Timeline for Relation between game systems and components in a component-based architecture?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 24, 2016 at 22:49 | comment | added | Sean Middleditch | @artganify: I suggest the gamedev.net forums for more open discussion, or the chat feature on this site. I avoid giving private help; if you have a question then chances are that plenty of other people have the same one, so if I spend time answering it I want it somewhere public and indexable by Google. Also, there are plenty of other people that can give the same (or much better) advice than I can, so asking in public is more beneficial for you as well. :) | |
| Jan 24, 2016 at 21:49 | comment | added | Sean Middleditch | @artganify: there are plenty of solutions there. The common ECS approach is to just have global ComponentAdded and ComponentRemoved events that your Systems listen for. A similar variant is for your Entity to have a list of not only their Components, but also the ComponentFactory used to create that Component, so the factory can now have a Destroy method called for any component instance it created. With the right allocation approach, you can even make that "automatic" without storing explicit factory references (e.g., see which page owns the component and link factories to pages). | |
| Jan 24, 2016 at 18:16 | vote | accept | artganify | ||
| Jan 24, 2016 at 18:16 | comment | added | artganify | Wow, thank you very much for your comprehensive answer. I did as you suggested and introduced some kind of 'Entity Processor' as an equvalent to a game module / game system. Whenever an entity gets added to the entity manager, I resolve the required processors and add them to the entity manager too, which will then loop through it and execute their strategy. One thing I'm yet not sure about is what to do when an component gets removed. Observer pattern? Plain old events triggered from the entity? | |
| Jan 18, 2016 at 8:11 | history | answered | Sean Middleditch | CC BY-SA 3.0 |