Fix rejoin opponent GUID + CDN skybox null/logging

- GameReadyResponse: add OpponentDisplayName? (populated only on AlreadyStarted)
- GameReadyHandler: inject SorIdentityDbContext; fetch opponent display name when
  session is already Active so rejoining clients get the name immediately
- Game.gd: on AlreadyStarted ack, read opponentDisplayName and set Game.opponent_name
  before calling _fetch_state() — fixes opponent showing as GUID on rejoin
- game_screen.gd: replace typed-Dictionary null assignment with safe Variant check
  to avoid silent GDScript coercion when no skybox is configured; strip query-string
  from URL before extension check (_fetch_skybox); add print logging throughout CDN
  skybox flow to surface download/decode failures

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-25 15:03:35 -04:00
co-authored by Claude Happy
parent 85e9b63579
commit 453f008620
4 changed files with 38 additions and 10 deletions
@@ -520,16 +520,21 @@ func _clear_stars() -> void:
func _fetch_skybox() -> void:
Network.request("content.get_skybox_config", {},
func(_type: String, resp: Variant) -> void:
var d := resp as Dictionary
var skybox : Dictionary = d.get("skybox", null)
if skybox == null:
return # no active skybox — keep procedural sky
var d := resp as Dictionary
# Use a Variant to safely detect null before treating as Dictionary.
var skybox_raw : Variant = d.get("skybox", null)
if skybox_raw == null or not skybox_raw is Dictionary:
print("[GameScreen] No active skybox configured — keeping procedural sky.")
return
var skybox := skybox_raw as Dictionary
var cdn_path : String = str(skybox.get("cdnPath", ""))
var is_animated : bool = bool(skybox.get("isAnimated", false))
var frame_count : int = int(skybox.get("frameCount", 1))
var fps : float = float(skybox.get("fps", 24.0))
if cdn_path.is_empty():
push_warning("[GameScreen] Skybox has empty cdnPath — skipping.")
return
print("[GameScreen] Loading CDN skybox: animated=%s url=%s" % [is_animated, cdn_path])
if is_animated:
_load_animated_skybox(cdn_path, frame_count, fps)
else:
@@ -547,7 +552,9 @@ func _load_static_skybox(url: String) -> void:
push_warning("[GameScreen] Failed to download skybox: HTTP %d" % code)
return
var img := Image.new()
var ext := url.get_extension().to_lower()
# Strip query string before checking extension (CDN URLs may include ?v=… etc.)
var clean_url := url.split("?")[0]
var ext := clean_url.get_extension().to_lower()
var err : int
if ext in ["jpg", "jpeg"]:
err = img.load_jpg_from_buffer(data)
@@ -556,13 +563,14 @@ func _load_static_skybox(url: String) -> void:
else:
err = img.load_png_from_buffer(data)
if err != OK:
push_warning("[GameScreen] Failed to decode skybox image")
push_warning("[GameScreen] Failed to decode skybox image (ext=%s)" % ext)
return
var tex := ImageTexture.create_from_image(img)
var mat := PanoramaSkyMaterial.new()
mat.panorama = tex
if is_instance_valid(_skybox_sky):
_skybox_sky.sky_material = mat)
_skybox_sky.sky_material = mat
print("[GameScreen] CDN skybox applied."))
http.request(url)
func _load_animated_skybox(base_url: String, frame_count: int, fps: float) -> void: