What goes over the wire to a browser: the static map once, and a frame per tick, with arts as sheet indices.
Cauldron2D.Net.Frame.map(%{width: w, height: h, cell: fun}, sheet)
Cauldron2D.Net.Frame.frame(%{focus: {x, y}, movers: [{art, {x, y}}], labels: [{"alice", {x, y}, {255, 255, 0}}]}, hud_rows, outcome, sheet)sheet is what Cauldron2D.Net.Sheet.build/1 returned, or any map with :arts and
:tile. A mover whose art the sheet lacks is left out. Hud rows are as
Cauldron2D.Client.Hud describes them and go out as [text, "#rrggbb" | nil] runs;
a row's tag goes in tags at the same position (nil for a row without one) —
tags is there only when some row has a tag. Labels go out as
[text, x, y, "#rrggbb", scale].
Summary
Functions
One tick: the focus, the movers, the labels, the hud rows (with their tags when any row has one), the subject when the scene names one, and the outcome when the round is over for this player.
The static layer: width by height rows of art indices, 0 where cell returns nil, and whether the world wraps at its edges (:wrap?, default false).
Types
@type row() :: Cauldron2D.Client.Hud.row()
@type sheet() :: %{arts: %{required(atom()) => pos_integer()}, tile: pos_integer()}
Functions
@spec frame( %{ :focus => {number(), number()}, :movers => [{atom(), {number(), number()}}], optional(:labels) => list(), optional(:subject) => term() }, [row()], map() | nil, sheet() ) :: map()
One tick: the focus, the movers, the labels, the hud rows (with their tags when any row has one), the subject when the scene names one, and the outcome when the round is over for this player.
@spec map( %{ :width => pos_integer(), :height => pos_integer(), :cell => ({integer(), integer()} -> atom() | nil), optional(:wrap?) => boolean() }, sheet() ) :: map()
The static layer: width by height rows of art indices, 0 where cell returns nil, and whether the world wraps at its edges (:wrap?, default false).