Struct rusty_sword_arena::game::PlayerInput[][src]

pub struct PlayerInput {
    pub id: u8,
    pub attack: bool,
    pub move_amount: Vector2,
    pub direction: f32,
}

Clients should send PlayerInputs to the server ASAP. The quicker the server gets inputs, the more accurate the simulation will be. But of course, you also shouldn't overload the server with too much traffic, because that's bad too. Good rule of thumb: Coalesce 4 milliseconds worth of input together, and send that. That's about 4 times faster than frames are sent by the server (60fps = 16.7ms). The server should be able to handle ~250 pkts/sec per client. I hope.

Fields

The ID of your player

Whether you are attempting to attack (actual attack will occur if the server-side attack timer has reached 0)

How much your player is attempting to move horizontally (x) and vertically (y) [-1.0, 1.0]. Positive is right and up for x and y, respectively.

What direction your player is facing. You can turn instantly, you lucky dog.

Methods

impl PlayerInput
[src]

Trait Implementations

impl Clone for PlayerInput
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for PlayerInput
[src]

Formats the value using the given formatter. Read more

impl PartialEq for PlayerInput
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

impl Send for PlayerInput

impl Sync for PlayerInput