ExPilot's arenas on Cauldron2D.Arenas: a map each, its world an ExPilot.Game,
its robots (ExPilot.Robot) and its ledger recorder seated beside it.
:ok = ExPilot.Arenas.register(:dogfight, "priv/maps/dogfight.map.gz")
ExPilot.Arenas.list()
Cauldron2D.Player.join(ExPilot.Arenas.world_name(:dogfight), "alice", %{})The map of a registered arena is kept under its name for the clients to draw from;
map/1 reads it, adopt/2 keeps a map that came from another node. Everything else
— starting on the first join, stopping when idle, humans/1, running/1 — is
Cauldron2D.Arenas's.
Summary
Functions
Keep arena as the map called name, for a client on another node whose worlds run there; map/1 finds it.
Stop arena id and remove it from the list.
The players in arena id who are not robots; [] while it is not running.
Every registered arena, as the lobby lists them, with the humans in each and its mode beside the kind.
The map a registered arena plays on, by the map's name.
Register arena id and start its world and robots at once.
Make arena id known, on the map at path (or an ExPilot.Map), without starting it.
The map name and tick rate arena id was registered with, for an arena cut from the same map; nil for an unknown id.
Whether arena id's world is running.
The name of arena id's world; using it starts the world when it is not running.
Types
@type id() :: atom()
Functions
@spec adopt(String.t(), ExPilot.Map.t()) :: :ok
Keep arena as the map called name, for a client on another node whose worlds run there; map/1 finds it.
@spec close(id()) :: :ok
Stop arena id and remove it from the list.
The players in arena id who are not robots; [] while it is not running.
@spec list() :: [Cauldron2D.Client.Game.arena()]
Every registered arena, as the lobby lists them, with the humans in each and its mode beside the kind.
@spec map(String.t()) :: ExPilot.Map.t() | nil
The map a registered arena plays on, by the map's name.
Register arena id and start its world and robots at once.
@spec register(id(), Path.t() | ExPilot.Map.t(), keyword()) :: :ok | {:error, term()}
Make arena id known, on the map at path (or an ExPilot.Map), without starting it.
Options
:robots— how many robots to seat, never more than the map's bases less one for every human in it and one to spare. Default: the map'smaxrobots:hz— the world's tick rate. Default50:seed,:lives,:only,:first_to— the game's, asExPilot.Game.init/1takes them:note— what the lobby says of the arena. Default: its size and robots:mode— its kind in the lobby. Default:ExPilot.Game.mode/1of the map
@spec registration(id()) :: %{map: String.t(), hz: pos_integer()} | nil
The map name and tick rate arena id was registered with, for an arena cut from the same map; nil for an unknown id.
Whether arena id's world is running.
@spec stop(id()) :: :ok
Stop arena id's world and robots, keeping it registered; close/1 removes it.
@spec world_name(id()) :: GenServer.name()
The name of arena id's world; using it starts the world when it is not running.