mirror of
https://github.com/godotengine/godot-website.git
synced 2025-12-31 09:48:43 +03:00
blog: Add client prediction to "Multiplayer in Godot 4.0: Scene Replication" (#576)
This commit is contained in:
committed by
GitHub
parent
a0d12db986
commit
80659ee387
@@ -226,7 +226,8 @@ func _ready():
|
||||
if player == multiplayer.get_unique_id():
|
||||
$Camera3D.current = true
|
||||
# Only process on server.
|
||||
set_physics_process(multiplayer.is_server())
|
||||
# EDIT: Let the client simulate player movement too to compesate network input latency.
|
||||
# set_physics_process(multiplayer.is_server())
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
@@ -253,7 +254,7 @@ func _physics_process(delta):
|
||||
move_and_slide()
|
||||
```
|
||||
|
||||
We will then use the server synchronizer to keep the position in sync and to set the player id on spawn (which will in turn configure the appropriate input authority).
|
||||
We will then use the server synchronizer to keep the position and velocity in sync and to set the player id on spawn (which will in turn configure the appropriate input authority).
|
||||
|
||||

|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 169 KiB After Width: | Height: | Size: 176 KiB |
Binary file not shown.
Reference in New Issue
Block a user