Is there any link to for Component based architecture in some complex case / real case that objects has a lot of relation to each other?
I have faced some difficulty when tried create some relation Ex. Bullet-Component rotating around Rocket-Component.
It is hard to find good links, here is what I have :-
- a lot of text, link to many others place .... http://gbgames.com/blog/2010/10/state-of-the-art-game-objects/
- textbook-like, gang of four ........... http://gameprogrammingpatterns.com/component.html
- religious-like description ......... http://t-machine.org/index.php/2007/12/22/entity-systems-are-the-future-of-mmog-development-part-3/
- great tutorial but only basic ........ http://www.raywenderlich.com/24878/introduction-to-component-based-architecture-in-games
- apply with Pooling ......... http://bitsquid.blogspot.se/2014/08/building-data-oriented-entity-system.html
None of these links show how to manage relation.
The order of execution of system (that manage each type of Component) seems to important too (Ex. Physic must before Graphics),
but none of these links describe it.
I am noob, help!
Edit
The problem is mainly "Where should I store the relation? Bullet or Rocket? Something above them?"
If I create some component/system that depends on two (e.g. BulletRocketSystem) , I will have to aware the order of execution.
BulletRocketSystem should execute after Bullet and Rocket's system.
If Bullet will be deleted by Bullet_System's command, the BulletRocketSystem must be notified and remove reference of it.
This promotes couple between System, which is bad.
Moreover, there have to be a headquarter to enforce the order, I don't know if there is non-ugly way to do it.
---
Thank for a lot of responses, I have learned a lot. +1 all
@Alberth: Thank! I forgot to think about it carefully. I should not force myself to use entity system to solve everything.
@Norman Barrows: You are right. Unity does it, so I followed it. I do it for business (hopefully).
@phil_t: I have edited OP. XD
@Tangletail: You caught me. Rocket should = Shootable + HP + Physics + Graphics + .... I hope this is what you mean.