donate

Clientside Predictor for Godot

https://github.com/decipher2k/Clientside-Predictor-for-Godot


Character synchronization using clientside prediction for Godot 3D network games.


This asset allows you to implement clientside prediction with just a few lines of code per entity.




=================================




Usage (all functions have to be called from the server):
playerId has to be the string representation of the unique network id.


var target:Vector3=Vector3(100.0,0.0,100.0)
var lockRotation:Vector3=Vector3(0.0,1.0,1.0)
get_parent().find_node(“DummySpawner”,true,false).remote_spawn_dummy(0.4,str(playerId),Vector3(0,0,0),Quat(0.0,0.0,0.0,0.0),"",“DummyCollection”,lockRotation)
get_parent().get_root().get_node(“ClientsidePredictionSpawner”).initBegin(“Player”,“DummyCollection”, 30.0,target,“Camera”,5.0,false,false)
get_parent().find_node(“ClientsidePrediction”,true,false).initBegin(“Player”,“DummyCollection”, 30.0,target,“Camera”,5.0,false,false)

Each entity (for example each player entity, each bullet entity etc - not their instances!) has to have its own ClientsidePrediction node (you will have to rename it in order to use more than one entity.)
To modify the avatar the user sees, the corresponding node should be attached to the node called “Dummy”.
That node should be positioned outside the walkable terrain, as it could cause unwanted collissions.


2024-07-06