Plays a Cauldron2D.Replay back on a clock, sending a watcher the frames one
recorded player saw.
{:ok, viewer} = Cauldron2D.Replay.Viewer.start_link(replay: replay, game: MyGame, game_opts: [seed: 7], hz: 50, as: "alice", watcher: self())The watcher receives {:cauldron_frame, %{tick: n, view: view, events: events}} for
every tick after the player :as has joined, exactly as a Cauldron2D.World sends
them, and {:cauldron_replay, viewer, :done, state} with the final state when the
record runs out; the viewer then stops. pause/1, resume/1 and step/1 drive it.
Options
:replay,:game— the record and the game it was made with. Required:game_opts— the game's options, as recorded. Default[]:hz— the rate the world ran at, so thedtof a step. Default50:speed— how many times faster than that to play. Default1:as— the recorded player whose view is sent. Required:watcher— the process the frames go to. Default the caller:paused?— start paused. Defaultfalse
Summary
Functions
Returns a specification to start this module under a supervisor.
Stop the clock.
Start the clock again.
Start a viewer; see the module documentation for the options.
Run one tick while paused.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec pause(GenServer.server()) :: :ok
Stop the clock.
@spec resume(GenServer.server()) :: :ok
Start the clock again.
@spec start_link(keyword()) :: GenServer.on_start()
Start a viewer; see the module documentation for the options.
@spec step(GenServer.server()) :: :ok
Run one tick while paused.