Function ggrs::start_p2p_session[][src]

pub fn start_p2p_session(
    num_players: u32,
    input_size: usize,
    local_port: u16
) -> Result<P2PSession, GGRSError>
Expand description

Used to create a new P2PSession for players who participate on the game input. After creating the session, add local and remote players, set input delay for local players and then start the session.

Example

let local_port: u16 = 7777;
let num_players : u32 = 2;
let input_size : usize = std::mem::size_of::<u32>();
let mut sess = ggrs::start_p2p_session(num_players, input_size, local_port)?;

Errors

  • Will return a InvalidRequest if the number of players is higher than the allowed maximum (see MAX_PLAYERS).
  • Will return a InvalidRequest if input_size is higher than the allowed maximum (see MAX_INPUT_BYTES).
  • Will return a InvalidRequest if the check_distance is higher than the allowed maximum (see MAX_PREDICTION_FRAMES).
  • Will return SocketCreationFailed if the UPD socket could not be created.