# Cauldron2D.Net v0.1.2 - Table of Contents

> A Cauldron2D world over the network: served to browsers, desktops and terminals over a WebSocket or from node to node, and the links a client joins it by.

## Pages

- [Cauldron2D.Net](readme.md)
- [Changelog](changelog.md)

## Modules

- [Cauldron2D.Net](Cauldron2D.Net.md): A `cauldron_2d` world in a browser, and the links an Elixir client uses to join a
served world.
- [Cauldron2D.Net.Api](Cauldron2D.Net.Api.md): What a client on another machine asks a server over plain HTTP, as a plug a game
forwards a path to: a token for a name and password (`POST /token`, with `register:
true` to make the account first), the arenas (`GET /arenas`) as a lobby lists them,
how the server is keeping up (`GET /stats`), and the boards (`GET /leaders?period=day|
week|all&metric=<name>&arena=<name>`) when the game keeps a ledger.
- [Cauldron2D.Net.Audio](Cauldron2D.Net.Audio.md): The server's sound policy: what every session's sound costs it.
- [Cauldron2D.Net.Audio.Governor](Cauldron2D.Net.Audio.Governor.md): Sets the sessions' rate from the node's load under `:dynamic` music: every five
seconds it reads how busy the schedulers were, drops the rate to 22 050 Hz once they
pass 60%, and brings it back to the policy's once they fall under 30%, holding each
for thirty seconds at least. Under any other music policy it leaves the rate alone.

- [Cauldron2D.Net.Audio.Shared](Cauldron2D.Net.Audio.Shared.md): One world's music, synthesised once for every session in it: a `Cauldron2D.Audio`
cued from the world's own state, its PCM sent to every subscriber as
`{:cauldron_shared_pcm, chunk}`.
- [Cauldron2D.Net.Channel](Cauldron2D.Net.Channel.md): The Phoenix channel a game's browser players join, one per player, driven by
`Cauldron2D.Net.Session`.
- [Cauldron2D.Net.Frame](Cauldron2D.Net.Frame.md): What goes over the wire to a browser: the static map once, and a frame per tick, with
arts as sheet indices.
- [Cauldron2D.Net.Keys](Cauldron2D.Net.Keys.md): A game's keymap as a browser reads it: `Cauldron2D.Input` key specs become
`KeyboardEvent.code` names, and mouse buttons the button numbers `cauldron.js` takes.
- [Cauldron2D.Net.Link.Local](Cauldron2D.Net.Link.Local.md): A player's connection to a world reachable as a process — on this node, or
on a node this one is connected to — through `Cauldron2D.Net.Session`, so the frames
arrive in the same shape a `Cauldron2D.Net.Link.Socket` delivers.
- [Cauldron2D.Net.Link.Socket](Cauldron2D.Net.Link.Socket.md): A player's connection to a game server anywhere: the same Phoenix channel a
browser uses, over a WebSocket, speaking `Cauldron2D.Net.Wire`.
- [Cauldron2D.Net.Link.World](Cauldron2D.Net.Link.World.md): A server's arena spoken for in this VM: a process a client joins, sends input to and
leaves exactly as it would a `Cauldron2D.World` (`Cauldron2D.Player`), which opens a
WebSocket to the server for each player (`Cauldron2D.Net.Link.Socket`) and turns what
comes back into frames, and plays the sound that comes with them through this
machine's speaker.
- [Cauldron2D.Net.Load](Cauldron2D.Net.Load.md): A load test against a running server: players and watchers joining its arenas over
the wire, the frames they get measured against the steps the server runs, and the
server's own numbers (`Cauldron2D.Net.Api`'s `/stats`) alongside.
- [Cauldron2D.Net.Load.Session](Cauldron2D.Net.Load.Session.md): One session of a load test: a player or a watcher on a server's arena over the same
WebSocket a browser or the desktop uses (`Cauldron2D.Net.Link.Socket`), counting the
frames it gets. A player changes what it holds five times a second, at random from
the actions it was given.
- [Cauldron2D.Net.Pages](Cauldron2D.Net.Pages.md): The pages around a game's worlds in a browser: a title, a lobby of arenas, the
arena, settings and the guide, from a `Cauldron2D.Client.Game`, as a plug a game
forwards a path to.
- [Cauldron2D.Net.Remote](Cauldron2D.Net.Remote.md): What a client asks a server it does not run in: a token for a name and password over
HTTP (`Cauldron2D.Net.Api`), the arenas, the server's stats and boards; and the same
from a node it is connected to.
- [Cauldron2D.Net.Remote.Worlds](Cauldron2D.Net.Remote.Worlds.md): Names for worlds that are not in this VM, so a client joins them as it joins any
`Cauldron2D.World`: `{:via, Cauldron2D.Net.Remote.Worlds, name}`.
- [Cauldron2D.Net.Session](Cauldron2D.Net.Session.md): A browser player's life in a world, as functions over a struct, for a channel process
to drive: the process calling `join/4` becomes the world's player and gets its frames
and its audio's PCM as messages.
- [Cauldron2D.Net.Sheet](Cauldron2D.Net.Sheet.md): A `Cauldron2D.Atlas` as one PNG sprite sheet and an index a browser draws from,
packed by `Cauldron2D.Sheet`.
- [Cauldron2D.Net.Socket](Cauldron2D.Net.Socket.md): The player socket a game's browser players connect through, with the channel
`Cauldron2D.Net.Channel` defines.
- [Cauldron2D.Net.Sound](Cauldron2D.Net.Sound.md): Plays the PCM a `Cauldron2D.Net.Link.Socket` delivers through this machine's speaker,
in a process of its own so the writes never hold up whoever draws.
- [Cauldron2D.Net.Wire](Cauldron2D.Net.Wire.md): The Phoenix channel protocol (serializer 2.0.0) as an Elixir client speaks it, and
the `cauldron_2d_net` messages read into plain shapes: a frame's focus, movers as
`{index, x, y}`, hud rows of `{text, colour}` runs and the outcome; a map's rows of
indices; a sheet's tile, frames, URL and void colour. What a desktop view, a terminal
or any other program joining a served world over its WebSocket draws from.

