QuakeServer.Multicast (quake_server v0.1.0)

Copy Markdown View Source

FTE's multicast (SV_MulticastProtExt): the message a program built with MSG_MULTICAST goes to the players to names, each choosing as the player is when it is sent, into the player's reliable messages or datagram (QuakeServer.Outbox).

server = QuakeServer.Multicast.send(server, origin, 1, bytes)

to is 0 every player (MULTICAST_ALL), 1 those that may hear origin (MULTICAST_PHS), 2 those that may see it (MULTICAST_PVS), 3 to 5 the same sent reliably, 6 and 9 the player msg_entity names (MULTICAST_ONE), 7 and 10 the same sent reliably, and 8 every player reliably (MULTICAST_INIT). Another to is printed and the message dropped.

A player hears origin when within 1024 units of it, or when the leaf of its eye (origin plus view_ofs) is in the PHS of origin's leaf; with no PHS built (phs?/1) every player hears it. A player sees origin when its eye's leaf is in the PVS of origin's leaf. A player whose eye is in leaf 0, or with origin in leaf 0, gets the message. Except for msg_entity's player, a player whose dimension_see shares no bit with the program's dimension_send is left out.

Summary

Functions

Whether the server built a PHS for its map, as FTE decides under sv_calcphs.

Send bytes from origin to the players to names, those left out by dimension tested against dimension (the program's dimension_send when nil).

Functions

phs?(server)

@spec phs?(QuakeServer.Server.t()) :: boolean()

Whether the server built a PHS for its map, as FTE decides under sv_calcphs.

send(server, origin, to, bytes, dimension \\ nil)

Send bytes from origin to the players to names, those left out by dimension tested against dimension (the program's dimension_send when nil).