Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Posted 27 May 2013 - 07:21 AM



Posted 27 May 2013 - 07:20 AM

I'm working towards a goal with component oriented design. I've read stuff like http://www.raywenderlich.com/24878/introduction-to-component-based-architecture-in-games and have used Unity but the main issue I see is that components query for other components and that makes them reliant on each other. I'm looking to get complete independence from other components from within components. Instead I put the linking of said components together outside of component code and in a more game specific file. I do this linking between events that components fire and functions that components expose.


An easy example would be the player health and the HUD. The player game object has a health component that has an event called OnHealthReduced/OnDead. The HUD has a function called UpdateHealth(value). When the health component of the player object games damage it fires the OnHealthReduced event which is linked to UpdateHealth() function of the HUD which updates the HUD graphics. This looks great and there are no component reliance inside each component.


Now I'm looking at enemy AI vs player interaction, and ways to make the components not reliant on each other IN the component code.