The arenas a game offers: a Cauldron2D.World each, with whatever runs beside it,
started on the first use of its name and stopped again once no player has been in it
for a while.
:ok = Cauldron2D.Arenas.register(:pit, game: MyGame, game_opts: [map: map], name: "The Pit", map: "pit")
Cauldron2D.Arenas.list()
Cauldron2D.Player.join(Cauldron2D.Arenas.world_name(:pit), "alice", %{username: "alice"})register/2 makes an arena known; world_name/1 names its world, and any call to
that name starts the arena if it is not running. Cauldron2D.Arenas.Sweeper stops
arenas that have had no human in them for a while and seats missing children again.
list/0 is what a lobby shows, running or not, in the shape
Cauldron2D.Client.Game's arenas/0 gives.
Options
:game,:game_opts,:hz,:tick,:record— the world's, asCauldron2D.World.start_link/1takes them.:gameis required:name— what the lobby calls the arena. Default: the id as a string:map,:note,:kind,:teams— shown in the lobby, asCauldron2D.Client.Game's arena describes them. Default: none:children— a function from%{id: id, world: world_name, humans: count}to child specs started under the arena beside its world: computer players, aCauldron2D.Ledger.Recorder. Called when the arena starts and on everyreseat/1; a spec whose id is already running is left alone, one that has stopped is started again. Default: none
A player whose id is {:robot, n} is not a human.
Summary
Functions
Stop arena id and forget it.
The players in arena id who are not robots; [] while it is not running.
The ids of every registered arena.
Every registered arena, as a lobby lists them, with the humans in each — their count as players, their ids as humans — by name.
Register arena id and start it at once.
Make arena id known without starting it; see the module documentation for the options.
Start the children arena id is missing, as its :children function gives them now.
The pid of arena id's world while it runs, else nil.
Whether arena id's world is running.
The ids of every arena whose world is running.
Start registered arena id; the running world's pid if it already is.
Stop arena id, its world and its children, keeping it registered.
The name of arena id's world; using it starts the arena when it is not running.
Types
@type id() :: term()
Functions
@spec close(id()) :: :ok
Stop arena id and forget it.
The players in arena id who are not robots; [] while it is not running.
@spec ids() :: [id()]
The ids of every registered arena.
@spec list() :: [map()]
Every registered arena, as a lobby lists them, with the humans in each — their count as players, their ids as humans — by name.
Register arena id and start it at once.
Make arena id known without starting it; see the module documentation for the options.
@spec reseat(id()) :: :ok
Start the children arena id is missing, as its :children function gives them now.
The pid of arena id's world while it runs, else nil.
Whether arena id's world is running.
@spec running_ids() :: [id()]
The ids of every arena whose world is running.
Start registered arena id; the running world's pid if it already is.
@spec stop(id()) :: :ok
Stop arena id, its world and its children, keeping it registered.
@spec world_name(id()) :: GenServer.name()
The name of arena id's world; using it starts the arena when it is not running.