Players, teams and owners

A map has twelve players and two neutral owners beside them: Neutral, which owns passive things like critters and decorations with an owner, and Neutral Aggressive, the creeps that attack everyone. That is the shape Warcraft III had before Reforged, and W4 keeps it.

The Players module

Players (Ctrl 5) shows twelve rows:

  • a name field (the default is Player 1 and so on; the players page in the game starts from these),
  • a colour swatch: a click opens the twelve classic colours, red, blue, teal, purple, yellow, orange, green, pink, grey, light blue, dark green, brown,
  • a team stepper,
  • and under the rows the map's start gold and a Reset to the defaults.

The choices are saved in map.toml under [players] (left out while they are the defaults). The Objects module's owner swatches and the 3D view draw units in these colours, so a recoloured player is visible at once.

Teams

Players with the same team number are allies: their units never attack each other, in the simulation and in the pathing. A free-for-all is twelve different teams; a two-sided map puts players 1 to 6 in team 1 and 7 to 12 in team 2. The team also decides who sees a minimap ping (Alt and a click) and who reads a team chat line.

Owners on the map

In Objects, every placed unit has an owner: a player 1 to 12 or neutral. Pick it with the swatches before placing, or select units and change it. Units of a player that nobody plays are still on the map, under that player's colour, and fight for their team.

Creeps are placed by picking the hostile owner, or spawned from a script with game.SpawnUnit(..., player.NeutralAggressive).

The players page in the game

When the engine starts a map it shows the players page: every player with the name, colour and team from the module, and Play as this on each. The one you pick is the player you see as and command; fog of war shows what that player's units see. Gold starts at the map's start gold for everyone.

The lobby for several people and computer players comes with networking; today one person plays one slot and the other slots' units stand, fight back when attacked and follow the script.

From Go

  • u.Owner() is a player.ID: player.Red and the other eleven colours, player.Neutral or player.NeutralAggressive.
  • game.SpawnUnit(name, x, y, owner) gives a new unit to a player.
  • ui.Text(p, ...) and the other interface calls take a player or player.Everyone; a map can show each player their own panel.
  • game.Command's handler gets the player who typed the command.
  • All of it is on Players and owners.

There is no API for teams yet. A script that needs them has to hard-code what you set in the Players module. More on Players and owners.

What is coming

Teams as groups you drag players between, add and rename, instead of a number per row; computer players; races and start locations; a lobby with the same groups. See the plan on the engine page.