QuakeServer.Outbox (quake_server v0.1.0)

Copy Markdown View Source

What the server holds for each player until the player's next packet, as FTE keeps it for a client: the reliable messages (MSG_ONE, reliable multicasts, prints), the datagram (unreliable multicasts), and the last centerprint, which goes out with the next packet after the reliable messages queued before it.

server = QuakeServer.Outbox.print(server, 1, 2, "You got the shotgun\n")
{%{reliable: [_], datagram: []}, server} = QuakeServer.Outbox.take(server, 1)

Each message is a binary of whole server messages, opening with its svc byte. The players are the entities 1 to the server's slots once a player has connected.

Summary

Types

A player's messages, oldest first.

Functions

Make text the centerprint player gets with the next packet, replacing one waiting.

The connected players.

Queue text reliably for player as a print of level (svc_print).

Queue bytes reliably for player.

Take player's packet: the reliable messages, then the waiting centerprint, and the datagram.

Add bytes to player's datagram.

Types

packet()

@type packet() :: %{reliable: [binary()], datagram: [binary()]}

A player's messages, oldest first.

Functions

centerprint(server, player, text)

Make text the centerprint player gets with the next packet, replacing one waiting.

players(server)

@spec players(QuakeServer.Server.t()) :: [pos_integer()]

The connected players.

print(server, player, level, text)

Queue text reliably for player as a print of level (svc_print).

reliable(server, player, bytes)

Queue bytes reliably for player.

take(server, player)

Take player's packet: the reliable messages, then the waiting centerprint, and the datagram.

unreliable(server, player, bytes)

Add bytes to player's datagram.