Faction
A team in a strategy game: its name (the Unit.Team and Building.Team of everything it owns, the same teams every genre shares, see Teams), its color, and the resources it has to spend. Teams with different names are enemies. A team is beaten when it has no buildings left.
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.
Resources are items, the one idea every genre shares (see Items), kept a row each, “Gold 200”, as an Inventory keeps its items, so they show (and can be changed) in the Inspector while the game runs, and rewind with everything else. They’re the team’s items: anything else on its team without items of its own (a platformer hero, a card hand) collects into them and pays from them. Any name works for a resource: whatever a Resource’s Kind or a pickup’s Item says.
Works with: Opponent (lets the computer play this team)
Needed by: Opponent
Saved data version: 2 (older scenes are upgraded as they load).
Properties
Section titled “Properties”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.
team: text = “Player”. The team’s name, e.g. “Player” or “Enemy”. Units and buildings with this Team belong to it. (Names a team: this entity’s own, which other fields can name.) (Field: a name.)color: a color, “#RRGGBB” or “#RRGGBBAA” = “#4C9AFFFF”. The team’s color: selection rings, its dots on the minimap. (Field: a color.)resources: lines of text: an array of strings, or one string with line breaks = [“Gold 250”,“Wood 100”]. What it has to spend, a row each, e.g. “Gold 250” and “Wood 100”. Starts as what it starts with. (Items and how many of each, one a line: the item’s name then how many, e.g. “Key 2” (just “Key” is one). The Inspector lists them a row each, the item picked from those the game gives.) (Field: its own editor: Item Counts.)supplyLimit: a whole number = 100. The most supply it can ever have, however many farms it builds. (Field: a number.)defeatMessage: text = “Defeated”. Sent (with the team’s name) when it loses its last building. (Names a message.) (Field: a name.)
Outputs
Section titled “Outputs”What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.
Amount(a whole number, read by a kind after a colon, e.g. “Amount:Gold”). How much of kind (e.g. “Gold”) it has. Read as “Amount:Gold”.Units(a whole number). How many units its team has left in the scene.Buildings(a whole number). How many buildings its team has left in the scene, built or going up.
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
isDefeated: true or false. True once it has no buildings left. (Sent in a network game.)units: a whole number. How many units its team has left in the scene.buildings: a whole number. How many buildings its team has left in the scene, built or going up.
Scripts use it as Faction: its methods, events and values that aren’t saved with the scene.