The animation of the entities a program sends itself, carried to each watching player
as GoldSrc's engine carries entity_state_t's sequence, frame, animtime and
framerate for every entity it sends (delta.lst).
server = QuakeServer.Animation.sample(server)
{states, server} = QuakeServer.Animation.take(server, 1)
states #=> %{374 => %{sequence: 0.0, time: 3.0, framerate: 1.0, animtime: 3.97}}sample/1 runs once a server frame, at the server's time. For each live entity with
a SendEntity, its state is sequence, the program's frame (the studio sequence);
time, the program's frame1time (seconds into the sequence); animtime, the
server's time; and framerate, how many seconds frame1time moved for each second
the server's time moved since the entity's last sample in the same sequence. When the
sequence changes or frame1time goes back, the framerate stays the last one
measured; an entity sampled the first time has framerate 0. A program without a
frame1time field has no animation.
take/2 gives the states of the entities the player holds
(QuakeServer.Network.held/2) that the player was not sent yet, or whose state is not
the one the player can work out from the state last sent: its sequence or framerate
differs, or its time differs by more than a thousandth of a second from the last
time moved on at the last framerate to the new animtime. GoldSrc's client shows
the sequence at time + (now - animtime) * framerate seconds, and with no time passed
since animtime at time.
Summary
Functions
Sample the animation of every live entity with a SendEntity at the server's time.
The states player viewer lacks of the entities it holds, kept as sent.
Types
Functions
@spec sample(QuakeServer.Server.t()) :: QuakeServer.Server.t()
Sample the animation of every live entity with a SendEntity at the server's time.
@spec take(QuakeServer.Server.t(), non_neg_integer()) :: {%{required(pos_integer()) => state()}, QuakeServer.Server.t()}
The states player viewer lacks of the entities it holds, kept as sent.