Buildings

Buildings are so common in real life that they feature in most games as well - they are often crucial to providing an interesting setting for a game or story.

In strategy games buildings tend to be a bit more abstract than in other types of games, typically just acting as a location that you must try to control, rather than being a place you can explore as they tend to be in other types of games.

In Heroes of Might and Magic there are a few types of buildings:

  • Towns / Castles: These are the most important buildings to control in the game. They produce Gold; allow you to recruit heroes; contain buildings for recruiting units; contain buildings for learning spells; and there are probably a few other things that I’m forgetting.
  • Mines: Produce resources for the player that controls them.
  • Dwellings: Provide free or recruitable units on the map.
  • Encounters: A wide variety of buildings providing once-off experience boosts; weekly random resources; temporary morale or luck boosts; tough once-off battles with nice rewards; and many more that I’m forgetting.

Here’s a screenshot of some buildings on the map:

Map buildings

A windmill; a knight village; a gold mine; a woodcutter (mine).

Here’s a screenshot of some of the buildings inside a Warlock castle:

Castle buildings

Clockwise: Hydra swamp; Dragon tower; Thieves guild; Castle; Gryphon nest; Centaur cave; Gargoyle crypt; Centaur maze; well.

ECS Design

Not much ECS design here because these are simply different ways of combining mechanics I’ve already covered. I’ll give some high level ideas of how the entities are composed - for details see all the related mechanics below.

Entities

Town/Castle

This is composed of many entities:

  • Tile: Multiple entities with tiles with varying graphics and passability.
  • Encounter: For attacking or entering the castle.
  • Controllable: For controlling the building.
  • Producer: For producing gold.
  • Offer: Many offers for building internal buildings; two offers recruiting heroes.

In addition the castle can contain various buildings with their own offers.

Mines

This is only has multiple entities for visuals and collision detection - the internals are simpler than a castle:

  • Tile: Multiple entities with tiles with varying graphics and passability.
  • Encounter: For taking control of the mine.
  • Controllable: For controlling the building.
  • Producer: For producing a resource.

Dwellings

This is only has multiple entities for visuals and collision detection - the internals are simpler than a castle:

  • Tile: Multiple entities with tiles with varying graphics and passability.
  • Encounter: For offering units for sale or giving units.
  • Producer: For producing units.
  • Offer: If units must be purchased an offer will be present.

Encounters

This is only has multiple entities for visuals and collision detection - these are the simplest internally:

  • Tile: Multiple entities with tiles with varying graphics and passability.
  • Encounter: For offering units for sale or giving units.
Author

Matt Van Der Westhuizen

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