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.
- The player clicks the unit -> the unit is now selected and the possible move locations are highlighted
- The player clicks again to select a move location, after moving the possible targets are displayed
- The player clicks a valid target for the unit to attack
- 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
P.S if you have any resources on the general application of the entity system to a turn based strategy, please do share