Module rusty_sword_arena::game [−][src]
Everything in the game module is shared by the server and the client
Structs
Color |
A color with 32-bit float parts from |
GameSetting |
Server returns a GameSetting in response to receiving a PlayerSync Game settings and player names and colors (including your own) are all in there. You will need to re-parse this every time someone joins or leaves the game. |
GameState |
Once per frame, the server will broadcast a GameState to all clients. IMPORTANT: If you don't receive a GameState for 2 full seconds, the client MUST DROP its ServerConnection (or just exit entirely). The underlying networking that we're currently using hides network disconnects, which can leave the networking in a funky state if one end drops. So we need to rely on detecting this heartbeat and shutting down the clients to ensure networking is clean when the server restarts. (In the future, lets switch to a protocol that can detect disconnects...) |
PlayerInput |
Clients should send |
PlayerState |
The state of a player on the server. The server broadcasts these to all clients every frame as
part of a FrameState. Note that you can receive |
Vector2 |
2D Vector (x, y) that can represent coordinates in OpenGL space that fill your window, or velocity, or whatever other two f32 values you need. The OpenGL window is (-1.0, -1.0) in the bottom left to (1.0, 1.0) in the top right. |
Weapon |
A weapon a player may hold |
Enums
ButtonState |
Whether a button was pressed or released |
ButtonValue |
Abstracted button values you may receive (arrow keys and WASD keys combined into directions, for example) |
Event |
Client Events that may occur |
GameControlMsg |
Various game control actions. Join a game, leave a game, just fetch updated game settings. |
PlayerEvent |
An event that has happened to your player this frame! Note that it's possible to receive a whole bunch of events in the same frame. |
Traits
Floatable |
Convenience trait that adds an |