Skip to main content

Teams

One way to make games more interesting is to add teams. Easel can support any number of teams in any configuration, whether it be a free-for-all, two equal-sized teams, or maybe even a game where most players unite against a single enemy. Teams may even change mid-game.

Assigning teams

Assign a player to a team by setting their Team property to an entity. Any two players with the same Team property value are considered to be on the same team. Any entity can be used as a team (even the player entity itself or World), however normally one would Spawn a new entity to represent a team.

Team assignment has a number of effects:

  • Players on the same team will be given the same color in-game.
  • User interface or graphical functions that take an audience parameter can be limited to only be visible to players on the same team.
  • Querying functions (such as Query) will return different results depending on alliances.

Alliance flags

The Alliance function can be used to determine the alliance status of two entities or players. The Alliance function first looks up who owns the entity according to what its Owner property is set to, and then determines the alliance status of the two owners. It can return one of four flags:

  • Alliance:Self if the two entities owned by the same player
  • Alliance:Neutral if at least one of the entities is not on any team
  • Alliance:Ally if the two entities are on the same team
  • Alliance:Enemy if the two entities are on different teams

The alliance status can be used as query criteria when using functions such as Query by passing it as the against parameter.

pub fn owner.Example() {
on Tick(1s) {
let numEnemies = QueryCount(against=Alliance:Enemy)
Transmission { "There are " + numEnemies + " enemy entities!" }
}
}