Players
A player is a human or bot who is able to send inputs into the game to control it.
Spawning players
The SpawnEachPlayer function defines the main behavior of players in the game. It takes a block of code (a subblock) as an argument, which should be used to initialize the player entity. For example, it could create a hero unit for the player to control, and display some helpful messages to the player to get them started.
pub fn Example() {
SpawnEachPlayer owner {
// Initialization code for the player goes here
}
}
Spawning bots
The SpawnBot function causes a bot player to join the game.
Any SpawnEachPlayer hooks will run first on the new bot player entity,
then SpawnBot
's subblock will be run with the same bot player entity.
This can be used to specialize the bot player further, if necessary.
The IsHuman function can be used to determine whether a player entity is a human or a bot.
The DespawnBot function can be used to force a bot player to leave the game.