pub struct GodotGGRSSyncTestSession { /* private fields */ }
Expand description
A Godot implementation of SyncTestSession
Implementations
sourceimpl GodotGGRSSyncTestSession
impl GodotGGRSSyncTestSession
sourcepub fn create_new_session(
&mut self,
_owner: &Node,
num_players: u32,
check_distance: usize,
max_pred: usize
)
pub fn create_new_session(
&mut self,
_owner: &Node,
num_players: u32,
check_distance: usize,
max_pred: usize
)
Creates a SyncTestSession,
call this when you want to start setting up a SyncTestSession
takes the total number of players, the check distance and the max prediction frames as parameters
Notes
- Max prediction frames is the maximum number of frames GGRS will roll back. Every gamestate older than this is guaranteed to be correct if the players did not desync.
- This value used to default to
8 frames
, but this has been made adjustable withGGRS 0.7.0
sourcepub fn create_session(
&mut self,
_owner: &Node,
num_players: u32,
check_distance: usize
)
👎 Deprecated since 0.5.0: please use create_new_session()
instead
pub fn create_session(
&mut self,
_owner: &Node,
num_players: u32,
check_distance: usize
)
please use create_new_session()
instead
Deprecated method to create a SyncTestSession. Use Self::create_new_session() instead.
sourcepub fn set_frame_delay(
&mut self,
_owner: &Node,
frame_delay: u32,
player_handle: PlayerHandle
)
pub fn set_frame_delay(
&mut self,
_owner: &Node,
frame_delay: u32,
player_handle: PlayerHandle
)
Sets SyncTestSession::set_frame_delay() of specified handle.
Errors
- Will print a ERR_MESSAGE_NO_SESSION_MADE error if a session has not been made
sourcepub fn advance_frame(&mut self, _owner: &Node, all_inputs: Vec<u32>)
pub fn advance_frame(&mut self, _owner: &Node, all_inputs: Vec<u32>)
This function will advance the frame using an array of all the inputs given as a parameter (inputs are currently an int in Godot). Before using this function you have to set the callback node and make sure it has the following callback functions implemented
Errors
- Will print a ERR_MESSAGE_NO_SESSION_MADE error if a session has not been made
- Will print a ERR_MESSAGE_NO_CALLBACK_NODE error if a callback node has not been set
sourcepub fn get_max_prediction(&mut self, _owner: &Node) -> usize
pub fn get_max_prediction(&mut self, _owner: &Node) -> usize
Calls and returns SyncTestSession::max_prediction(). Will return a 0 if no session was made.
Errors
- Will print an ERR_MESSAGE_NO_SESSION_MADE error if a session has not been made
sourcepub fn set_callback_node(&mut self, _owner: &Node, callback: Ref<Node>)
pub fn set_callback_node(&mut self, _owner: &Node, callback: Ref<Node>)
Sets the callback node that will be called when using Self::advance_frame()
Trait Implementations
sourceimpl NativeClass for GodotGGRSSyncTestSession
impl NativeClass for GodotGGRSSyncTestSession
type UserData = DefaultUserData<GodotGGRSSyncTestSession>
type UserData = DefaultUserData<GodotGGRSSyncTestSession>
User-data wrapper type of the class. Read more
sourcefn class_name() -> &'static str
fn class_name() -> &'static str
The name of the class. Read more
sourcefn init(owner: TRef<'_, Self::Base>) -> Self
fn init(owner: TRef<'_, Self::Base>) -> Self
Function that creates a value of Self
, used for the script-instance. The default
implementation simply panics. Read more
sourcefn register_properties(builder: &ClassBuilder<Self>)
fn register_properties(builder: &ClassBuilder<Self>)
Register any exported properties to Godot.
fn new_instance() -> Instance<Self, Unique> where
Self::Base: Instanciable,
fn new_instance() -> Instance<Self, Unique> where
Self::Base: Instanciable,
Convenience method to create an Instance<Self, Unique>
. This is a new Self::Base
with the script attached. Read more
sourceimpl NativeClassMethods for GodotGGRSSyncTestSession
impl NativeClassMethods for GodotGGRSSyncTestSession
Auto Trait Implementations
impl !RefUnwindSafe for GodotGGRSSyncTestSession
impl Send for GodotGGRSSyncTestSession
impl Sync for GodotGGRSSyncTestSession
impl Unpin for GodotGGRSSyncTestSession
impl !UnwindSafe for GodotGGRSSyncTestSession
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more