Debug delta diffing: add diagnostics + empty-delta fallback
- All game action handlers: move ToDto() call to after SaveStateAsync() so the ACK's StateVersion matches the pushed delta (stale-version fix) - GameHandlerBase.PushStateToPlayersAsync: add empty-delta safety fallback — when ComputeDelta() returns all-null content fields, fall back to a full game.state_update push so clients always see the correct state - Add Console.WriteLine diagnostics to PushStateToPlayersAsync to expose prev/next phase, turn, active player, and whether prevStateJson matches the post-mutation session.StateJson (root cause investigation) - Game.gd: wire game.activity push to game_activity signal 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:
@@ -315,7 +315,7 @@ func _player_by_id(account_id: String) -> Dictionary:
|
||||
func _apply_delta(delta: Dictionary) -> void:
|
||||
# Helper: dict.get(key, default) returns null (not default) when the key exists with value null.
|
||||
# Use 'is Array' / 'is Dictionary' guards so typed assignment never receives null.
|
||||
|
||||
print("DELTA: ", delta)
|
||||
# 1. Changed tiles
|
||||
var changed_tiles = delta.get("changedTiles")
|
||||
if changed_tiles is Array:
|
||||
@@ -489,7 +489,7 @@ func _merge_unit_delta(unit: Dictionary, ud: Dictionary) -> void:
|
||||
|
||||
func _on_server_push(type: String, payload: Variant) -> void:
|
||||
if type.begins_with("game.") or type.begins_with("matchmaking."):
|
||||
print("[Game] PUSH ", type, " ", JSON.stringify(payload).substr(0, 200))
|
||||
print("[Game] PUSH ", type, " ", JSON.stringify(payload).substr(0, 800))
|
||||
match type:
|
||||
"matchmaking.match_found":
|
||||
var d := payload as Dictionary
|
||||
|
||||
Reference in New Issue
Block a user