The worlds 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.Worlds.register(:pit, game: MyGame, game_opts: [map: map], name: "The Pit", map: "pit")
Cauldron2D.Worlds.list()
Cauldron2D.Player.join(Cauldron2D.Worlds.world_name(:pit), "alice", %{username: "alice"})register/2 makes a world known; world_name/1 names its process, and any call to
that name starts the world if it is not running. Cauldron2D.Worlds.Sweeper stops
worlds 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 worlds/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 world. Default: the id as a string:map,:note,:kind,:teams— shown in the lobby, asCauldron2D.Client.Game's world describes them. Default: none:children— a function from%{id: id, world: world_name, humans: count}to child specs started under the world's supervisor beside its process: computer players, aCauldron2D.Ledger.Recorder. Called when the world 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 world id and forget it.
The players in world id who are not robots; [] while it is not running.
The ids of every registered world.
Every registered world, as a lobby lists them, with the humans in each — their count as players, their ids as humans — by name.
Register world id and start it at once.
Make world id known without starting it; see the module documentation for the options.
Start the children world id is missing, as its :children function gives them now.
The pid of world id while it runs, else nil.
Whether world id is running.
The ids of every world that is running.
Start registered world id; the running world's pid if it already is.
Stop world id and its children, keeping it registered.
The name world id runs under; using it starts the world when it is not running.
The name world id of node runs under, for a node this one is connected to; using
it starts the world there when it is not running. A node that cannot be reached names
no process.
Types
@type id() :: term()
Functions
@spec close(id()) :: :ok
Stop world id and forget it.
The players in world id who are not robots; [] while it is not running.
@spec ids() :: [id()]
The ids of every registered world.
@spec list() :: [map()]
Every registered world, as a lobby lists them, with the humans in each — their count as players, their ids as humans — by name.
Register world id and start it at once.
Make world id known without starting it; see the module documentation for the options.
@spec reseat(id()) :: :ok
Start the children world id is missing, as its :children function gives them now.
The pid of world id while it runs, else nil.
Whether world id is running.
@spec running_ids() :: [id()]
The ids of every world that is running.
Start registered world id; the running world's pid if it already is.
@spec stop(id()) :: :ok
Stop world id and its children, keeping it registered.
@spec world_name(id()) :: GenServer.name()
The name world id runs under; using it starts the world when it is not running.
@spec world_name(id(), node()) :: GenServer.name()
The name world id of node runs under, for a node this one is connected to; using
it starts the world there when it is not running. A node that cannot be reached names
no process.