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
First, Spawn one entity for every team in your game.
Now you can assign a player to a team by setting their Team property.
Any two players with the same Team
property value are considered to be on the same team.
Normally Owner is set to the player that owns an entity.
You can also set the Owner
property to a team entity itself, rather than a player who is on the team.
This is useful sometimes if you have team-specific objects like bases, towers or walls
that are not owned by any one player but are owned by the team as a whole.
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 have the same ownerAlliance:Neutral
if at least one of the entities has no ownerAlliance:Ally
if the owners have the same teamAlliance:Enemy
if the owners 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!" }
}
}