2 Commits

Author SHA1 Message Date
shawn 597d6dde2d Fix server clock reset in NetworkTimeSynchronizer and client-side peer 1 avatar duplicate
- Move _clock.set_time(0.) inside the 'if not server' block in
  NetworkTimeSynchronizer.start() so the server's SystemClock isn't
  reset to zero — fixes -1.78 billion second offset panic on client
- Skip spawning peer 1's avatar on clients (the server replicates
  all avatars; spawning peer 1 locally creates a duplicate that
  the dedicated server doesn't have)
2026-07-03 16:21:35 -04:00
shawn aad186552c Bake dev server IP (192.168.0.127:34197) as default in network popup 2026-07-03 16:11:23 -04:00
3 changed files with 11 additions and 5 deletions
+1 -2
View File
@@ -142,10 +142,9 @@ signal on_panic(offset: float)
func start() -> void:
if _active:
return
_clock.set_time(0.)
if not multiplayer.is_server():
_clock.set_time(0.)
_active = true
_sample_idx = 0
_sample_buffer = _RingBuffer.new(sync_samples)
@@ -73,8 +73,15 @@ func _handle_host():
round_manager.start_match()
func _handle_new_peer(id: int):
# On a dedicated server, peer 1 (the server process) has no avatar.
# When a client connects, it receives on_peer_join for peer 1, but
# should skip spawning because the server doesn't have that avatar.
# This also applies to listen-server: the server replicates peer 1's
# avatar to clients; spawning a local copy would duplicate it.
if id == 1 and not multiplayer.is_server():
print("[PlayerSpawner] Client skipping spawn for peer 1 (server has no dedicated avatar)")
return
if _dedicated_server and id == 1:
# Peer 1 is the server itself — no avatar needed
return
if id == 1 and not spawn_host_avatar:
print("[PlayerSpawner] Skipping spawn for peer 1 (spawn_host_avatar=false)")
+2 -2
View File
@@ -34,7 +34,7 @@ text = "Address:"
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
text = "localhost"
text = "192.168.0.127"
[node name="Port Label" type="Label" parent="LAN/Address Row"]
layout_mode = 2
@@ -44,7 +44,7 @@ text = "Port:"
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
text = "16384"
text = "34197"
[node name="Actions Row" type="HBoxContainer" parent="LAN"]
layout_mode = 2