/ #mechanics 

Control

Vying for control of strategically important resources is what this mechanic is all about… not the literal controlling of game characters as the banner image suggests.

Most games do have the latter form of control as a crucial mechanic, but I’m writing about Turn-Based Strategy games here, so this page is about the mechanic of taking control of a resource or a position to gain a benefit from it or to deny your enemy of the benefit it provides.

This mechanic is commonly used in almost any strategy game I can think of, for example:

  • Heroes of Might & Magic Series: Players can take control of cities, towns and mines.
  • Master of Orion Series: Players control planets or star systems.
  • Civilization Series: Players control cities.

In all cases in all of these games an important aspect of the control mechanic is that a one player can wrest control of a strategic resource away from another player, which is often a pivotal part of overcoming that enemy.

ECS Design

Components

Controllable

  • owner: Integer

The owner is an entity ID indicating which Player controls the entity.

Player

From Turn-based: Static Order or Turn-based: Priority Order. The entities representing the players of the game will have this component on them and those are the entities that will be able to control Controllabe entities.

TakeControl

  • new_owner: Integer

This component is added to indicate a change in control. The Controllable.owner will be set to TakeControl.new_owner.

Entities

Anything that can be controlled will have Controllable.

Each player in the game has Player.

Systems

ControlSystem

This example does not show how a TakeControl component gets added - that will typically come out of the movement system or the combat system when a battle has been resolved. This system can be implemented as follows and is simply responsible for changing the controller:

flipped = world.get_entities_with_components(Controllable, TakeControl)

for entity in flipped:
    entity.controllable.owner = entity.take_control.new_owner
    world.remove_component(entity, TakeControl)
Author

Matt Van Der Westhuizen

Back-end service developer at Ubisoft Blue Byte by day - wannabe game designer & developer by night.