Ok, I've got another one for you if you could be so kind.
Basically, we've extended the XNA framework slightly and bastardized it slightly to suit our needs.
In XNA the main 'Game' class calls methods.. (Initialize(), LoadContent(), Update(), Draw()). It calls update and draw x times per second.
We've set things up so that you add Screens to the main game class, then you add components to screens. Components also have their own list of components and they have their own list of components and so on.
When Update() is called in the main Game class, it'll call Update() on all the screens, which'll call Update() on all the Components and their components..etc..
So, a small example would be like this:
code:
Game Screen Component Component
------- ------------- ------------ ----------
Game -> 3dScreen -> Sheep -> AI
-> Render
-> Physics
-> Dog -> Controller
-> Animation
-> MenuScreen -> Setup
-> HUDScreen -> Radar
-> Healthbar
Although we're not at the stage of making any actual game logic just yet, I know that components will need to talk to eachother and/or their parent component.
In an example of an engine that i've seen, they use this big messaging system to talk between components/screens, whereby components (or screens) can listen to a certian messages and will receive all messages of that type.
This seems all complicated to me and using events and eventhandlers seems like the way to go.
Can you think of a better way to do any of this? I'm also concerned about speed.. for example, would a onPositionChanged event on model (which can fire 100 times a second) be too much?