Function ggrs::start_synctest_session [−][src]
pub fn start_synctest_session(
num_players: u32,
input_size: usize,
check_distance: u32
) -> Result<SyncTestSession, GGRSError>
Expand description
Used to create a new SyncTestSession
. During a sync test, GGRS will simulate a rollback every frame and resimulate the last n states, where n is the given check_distance
.
During a SyncTestSession
, GGRS will simulate a rollback every frame and resimulate the last n states, where n is the given check distance.
The resimulated checksums will be compared with the original checksums and report if there was a mismatch.
Due to the decentralized nature of saving and loading gamestates, checksum comparisons can only be made if check_distance
is 2 or higher.
This is a great way to test if your system runs deterministically. After creating the session, add a local player, set input delay for them and then start the session.
Example
let check_distance : u32 = 7; let num_players : u32 = 2; let input_size : usize = std::mem::size_of::<u32>(); let mut sess = ggrs::start_synctest_session(num_players, input_size, check_distance)?;
Errors
- Will return a
InvalidRequestError
if the number of players is higher than the allowed maximum (seeMAX_PLAYERS
). - Will return a
InvalidRequestError
ifinput_size
is higher than the allowed maximum (seeMAX_INPUT_BYTES
). - Will return a
InvalidRequestError
if thecheck_distance is
higher than or equal toMAX_PREDICTION_FRAMES
.