PredictiveSynchronizer

Inherits: Node

Similar to RollbackSynchronizer, this class manages local variables in a rollback context for predictive simulation without networking.

Description

This is a simplified version that focuses on local state management.

Like RollbackSynchronizer, it automatically discovers nodes with a _rollback_tick(delta: float, tick: int) method and calls them during the prediction phase.

Properties

Type Name Default
Node root get_parent()
String[] state_properties

Methods

Return Type Name
void process_settings()
void spawn(int p_tick)
void despawn(int p_tick)
bool is_alive(int p_tick)
void add_state(Variant node, String property)

Property Descriptions

Node root = get_parent()

The root node for resolving node paths in properties. Defaults to the parent node.


String[] state_properties

Properties that define the game state.

State properties are recorded for each tick and restored during rollback. State is restored before every rollback tick, and recorded after simulating the tick.


Method Descriptions

void process_settings ( )

Process settings.

Call this after any change to configuration.


void spawn ( int p_tick )

Mark the spawn tick for all nodes managed by this synchronizer.

When rewinding to a tick earlier than the spawn tick, every managed node will be deactivated.


void despawn ( int p_tick )

Mark the despawn tick for all nodes managed by this synchronizer.

When rewinding to a tick later than the despawn tick, every managed node will be deactivated.


bool is_alive ( int p_tick )

Return true if nodes managed by this synchronizer are alive.

Note that this method assumes that all node liveness is managed by the synchronizer. If some node livenesses are handled separately, this method may return the wrong liveness. In that case, use _RollbackLivenessServer.is_alive() and check for individual nodes.


void add_state ( Variant node, String property )

Add a state property.

Settings will be automatically updated. The node may be a string or NodePath pointing to a node, or an actual Node instance. If the given property is already tracked, this method does nothing.