Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 04 Aug 2011
Offline Last Active Aug 01 2014 02:46 PM

Topics I've Started

Application of an entity system in a turn based strategy

03 August 2013 - 11:55 AM

Hello GameDev,


currently I am working on a project with two friends where we decided to implement and use an entity system for a turn based strategy game like Advanced Wars.


The current problem we are having (or are rather discussing) is what is the best way of actually using the entity system? For context I am going to describe the flow of a single units turn.


  1.  The player clicks the unit -> the unit is now selected and the possible move locations are highlighted
  2.  The player clicks again to select a move location, after moving the possible targets are displayed
  3.  The player clicks a valid target for the unit to attack
  4.  The unit finishes its turn or is destroyed


Keep in mind that for each action where the player clicks the unit again it is equivalent of the wait command in AW (for now excluding the special case for artillery and loading units into transports).


The current idea we have is that each unit has a state component that stores the state the unit is in and for each click switches to the apropriate state (pretty standard, the current state is stored in a component instead of the object).


Another idea we have is instead of a single state component we use the actual components themself  for handling unit state, in this case we can check if a unit has the (let's say) waitingForMove component and continue like above by adding and removing respective components.


My questions are:


Which approach will be more elegant?

Which approach will be more flexible?

Can you come up with a different approach?


This is the first time we are actually using an entity system for handling our objects so I wanted to see more perspectives on this matter.


Thank you for reading smile.png



P.S if you have any resources on the general application of the entity system to a turn based strategy, please do share


Problem with understanding data access and responding to events in component based system

06 May 2013 - 02:09 PM

Hi GameDev,


I have a problem figuring out how something like this would work:


In a component based system I have solid objects (which can collide) and gameplay type objects (which have various stats like damage...) which are combined (inherited).


Now if I detect a collision between 2 solid objects, in C++ how should I go about checking if the objects are gameplay type and consequently do damage to each other?



I will elaborate when I get more time, thanks in advance