Jump to content
  • Advertisement
Sign in to follow this  
Aristotel

Application of an entity system in a turn based strategy

This topic is 1747 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

 

Share this post


Link to post
Share on other sites
Advertisement

Your second idea, have a component for each state, sounds similar to the GoF State Pattern, which may be a good sign :)

Share this post


Link to post
Share on other sites

Before even reading your options, in my head, I saw separate component's that set the entity's state.  That way, you can have a system, say HandleWaitMoveSystem, that operates on only on units only with that component, and performs whatever actions they require.

 

That's just my initial thought on it without going very deep.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!