Import std.net.game.peer
std.net.game.peer
std.net.game's peers: the other side of a connection, as a GameHost has it. A peer sends its messages on its channels, which go at the host's next Update, and keeps what the connection knows: its state, the round-trip time it measures from acks, and the packets it's sent, received, and lost. Every packet acks the 33 latest of the other side's it received, and a reliable part not acked once its round-trip time and a margin have passed goes again, each time waiting twice as long, up to 8 times. A Flush sends 16 packets at most, and a peer that takes 16 acks them at once, so the acks of a packet lost cover what was before it.
std/net/game/peer.fb
Types
PeerState
enum
Public Enum PeerState
Where a connection is.
-
Asking for it.
-
Open.
-
Sending what's left before it ends.
-
Ended.
GamePeer
class
Public Class GamePeer Implements Printable
The other side of a connection, which a GameHost makes when it connects or is connected to. Its Send queues a message on one of the host's channels, which goes at the host's next Update, along with what it sends again and its acks.
-
Where the other side is.
-
Whether it's connecting, connected, or disconnected, and how.
-
Why it disconnected, once it has, or NONE.
-
The round-trip time, smoothed as TCP smooths it, from the acks of what it sent, and how much it varies. Before the first ack, 100 and 50 milliseconds.
-
How much its round-trip time varies.
-
About how much of what it sends is lost, from 0 to 1: of its packets acked or counted lost, the recent ones counting most.
-
The packets it's sent, received, and counted lost, the reliable parts it sent again, and the bytes of its packets each way.
-
How many packets it's received.
-
How many of its packets it's counted lost.
-
How many reliable parts it's sent again.
-
How many bytes of packets it's sent.
-
How many bytes of packets it's received.
-
How many reliable messages it has that the other side hasn't acked yet, sent or not.
-
Sends
byteson the host'schannel, from 0, as thechannel's kind says; it goes at the host's next Update, once it's connected. A peer that's disconnecting or disconnected sends nothing more. Panics for a channel the host doesn't have, or a message past its MaxMessageSize. -
Sends
text's UTF-8 on the host'schannel. -
Ends the connection once the other side has acked every reliable message sent so far, or at the host's Timeout: the host's Update then tells the other side, and gives a DISCONNECT event of LOCAL. A peer that's still connecting stops at once.
-
Ends the connection at the host's next Update, dropping what hasn't gone.
-
Its address, as "127.0.0.1:5000".
Report an issue with this page or with FutureBlitz on GitHub.