The further players a client plays on the same machine, from the game's
local_seats/1: each a player of the world with its own keys and its own controller.
A seat is %{id, input, pad, last_input}. Seats join the world with frames: false,
so the client receives frames only as its own player; each key event reaches every
seat's input and counts where that seat's keymap binds it; a controller event reaches
the one seat it is routed to. send_input/3 sends a seat's input only when it changed.
Summary
Functions
Seat index (counting from 0) after a controller event.
Every seat's input with its timed holds expired at now.
The seats keymaps describe, joined to world as "<username> 2" and on. A seat
the world refuses is left out. props are the player's own join props, given to each
seat with its own :username and with :seat_of, the player's own username, so the
world can tell whose seat it is; input_options are those of the player's own input.
Every seat's input after a key or pointer event at now.
Every seat out of world.
Every seat holding nothing, its keys read by the keymap it had.
Every seat whose input changed sent to world, its read input passed through steer
first, as the client steers its own player's.
Types
@type seat() :: %{ id: String.t(), input: Cauldron2D.Input.t(), pad: Cauldron2D.Input.Pad.t(), last_input: map() | nil }
Functions
@spec controller([seat()], non_neg_integer(), map()) :: [seat()]
Seat index (counting from 0) after a controller event.
Every seat's input with its timed holds expired at now.
@spec join( GenServer.server(), String.t(), map(), [Cauldron2D.Input.keymap()], Cauldron2D.Input.Pad.padmap(), keyword() ) :: [seat()]
The seats keymaps describe, joined to world as "<username> 2" and on. A seat
the world refuses is left out. props are the player's own join props, given to each
seat with its own :username and with :seat_of, the player's own username, so the
world can tell whose seat it is; input_options are those of the player's own input.
Every seat's input after a key or pointer event at now.
@spec leave([seat()], GenServer.server()) :: :ok
Every seat out of world.
@spec release([seat()], [Cauldron2D.Input.keymap()], keyword()) :: [seat()]
Every seat holding nothing, its keys read by the keymap it had.
@spec send_input([seat()], GenServer.server(), (map() -> map())) :: [seat()]
Every seat whose input changed sent to world, its read input passed through steer
first, as the client steers its own player's.