Jump to content

  • Log In with Google      Sign In   
  • Create Account


phiwer

Member Since 14 Apr 2013
Offline Last Active Sep 20 2013 12:19 PM

#5053506 Component Design in Component Based Game Engine

Posted by phiwer on 15 April 2013 - 11:43 AM

I'm developing a turn-based strategy game using a component based game engine and have been wondering how to structure my components.

 

There are quite a lot of collection components in my game. E.g. an Army contains many units. Is it suitable to have an ArmyComponent containing many UnitCpmponents? Is that a suitable level of abstraction for a component?

 

Another thing I've been considering is the level of abstraction for the buildings I'll have in the game and also connected properties. A player can create a farm, which produces food. A player can also create a barrack to construct units, but this building also increases the offense points of troops by 10%. These types of properties can obviously change (although not likely that any other building than a farm will produce food), and as such this should be customizable easily. My question is what level of abstraction the components should be? Should there be a BuildingComponent, ProductionComponent, and ResourceComponent? Or should there be a FarmComponent, ProductionComponent and FoodComponent? Am I making my components too granular?

 

I obviously want to create a flexible system, but I don't want to over engineer either. Most buildings will be static, while their properties will change. That's why I'd like to hear your opinion of how you'd structure these relationships using a component based engine.

 

One more thing, and this question is about sub systems. I intend on making the sub systems handle the logic, and only have the components store data. Does anyone have some tips & tricks regarding how to think about sub systems? I've read that one should aim for a 1:1 relationship between components/sub systems, I am not sure this would be the case for me given my current setup with regards to my granularity of my components.




PARTNERS