Struct rusty_sword_arena::net::ServerConnection[][src]

pub struct ServerConnection { /* fields omitted */ }

Represents a client's connection to a server, and methods to abstract away all the actual network communication. Hooray for encapsulation!

Methods

impl ServerConnection
[src]

Create a new connection to a server. host is the IP address or domain name of the server.

Join a game. If successful, you'll get a non-zero player id back. If not successful, there was probably a name collision, so change your name and try again. If changing the name still doesn't work, then the server is probably full.

Get the current GameSetting. The most important thing about the GameSetting is checking that you are connecting to a version of the server you expect.

Leave the game.

Gets all available unprocessed game states. You should call this often enough that you usually don't receive more than one.

Send player input to the server. The server processes input as it comes in, but that doesn't mean you should send 10,000 input packets/second. Keep track of the input and only send new input about every 15ms.

Auto Trait Implementations