Skip to content

Opponent

Lets the computer play a Faction: it keeps its workers gathering, trains more, puts up the buildings in Builds, trains an army, and sends it to attack once it’s big enough, a bigger one each time.

Part of the Strategy module: Real-time strategy: factions, units that walk around obstacles and fight, workers that gather and build, buildings that train units, fog of war, the computer playing a side, the player’s controls and HUD, playing online team against team, and the Strategy template.

Requires: Faction

Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.

  • workers: a whole number = 6. How many workers it keeps. (Field: a number.)
  • builds: text = “Barracks, Farm”. Buildings it puts up, in order, e.g. “Farm, Barracks”. It adds farms as it runs short of supply. (Names prefabs: their names, separated by commas.) (Field: a name.)
  • army: text = “Soldier, Archer”. Units it trains for its army, taking turns, e.g. “Soldier, Archer”. (Names prefabs: their names, separated by commas.) (Field: a name.)
  • trainEvery: a number = 0. Seconds between the soldiers it starts training: higher is an easier game. 0 trains as fast as it can pay. (Field: a number.)
  • attackWith: a whole number = 6. How big its army has to be before it attacks. (Field: a number.)
  • waveGrowth: a whole number = 2. How many more it waits for each time after that. (Field: a number.)
  • firstAttack: a number = 120. Seconds before its first attack, however big its army. (Field: a number.)

Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.

  • waves: a whole number. How many attacks it has sent.

Scripts use it as Opponent: its methods, events and values that aren’t saved with the scene.