From 09e500f0c1cacc8142bbaba0f801bfcfb082ec18 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 8 Feb 2024 18:55:25 -0500 Subject: logging + ack check --- racing/lobby.gd | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'racing/lobby.gd') diff --git a/racing/lobby.gd b/racing/lobby.gd index 94fe993..374fc07 100644 --- a/racing/lobby.gd +++ b/racing/lobby.gd @@ -15,7 +15,7 @@ const MAX_PLAYERS = 250 const PROTOCOL_VERSION = 2 const RECIPIENT_BROADCAST_ALL = -1 const LOBBY_MAP_NAME = "ll1_racing" -const VERSION = "0.0.3" +const VERSION = "0.0.4" const LL1_AREAS = [ ["Starting Room", 0, 0, 0], @@ -73,6 +73,7 @@ const LL1_AREAS = [ func _ready(): + global._print("Starting Lobby") installScriptExtension(ResourceLoader.load("user://maps/racing/load.gd")) # P2P solve messages should still be received while paused. @@ -128,6 +129,7 @@ func _process(_delta: float) -> void: func _exit_tree(): if active_lobby_id != 0 and !is_starting: + global._print("Lobby Exit Tree") Steam.leaveLobby(active_lobby_id) active_lobby_id = 0 @@ -145,6 +147,7 @@ func _resend_messages_needing_ack(): for message_id in messages_needing_ack: var message = messages_needing_ack[message_id] if message["recipient_id"] in active_lobby_members: + global._print("Resending Packet") _send_p2p_packet(message["data"], message["recipient_id"], message["mode"], true) else: messages_needing_ack.erase(message_id) @@ -177,8 +180,10 @@ func _on_lobby_match_list(lobbies: Array) -> void: best_lobby_id = lobby_id best_lobby_size = lobby_size if best_lobby_id == 0: + global._print("Creating Lobby") Steam.createLobby(Steam.LOBBY_TYPE_INVISIBLE, MAX_PLAYERS) elif best_lobby_id != active_lobby_id: + global._print("Joining Lobby %d" % best_lobby_id) Steam.joinLobby(best_lobby_id) elif best_lobby_size <= 1: _request_lobby_list() @@ -198,6 +203,7 @@ func _on_lobby_created(result: int, lobby_id: int) -> void: func _on_lobby_joined(lobby_id: int, _permissions: int, _locked: bool, result: int) -> void: if result != Steam.RESULT_OK: return + global._print("Joined Lobby %d" % lobby_id) if active_lobby_id != 0 && active_lobby_id != lobby_id: Steam.leaveLobby(active_lobby_id) active_lobby_id = lobby_id @@ -239,6 +245,8 @@ func _update_lobby_members(): itemlist.set_item_custom_fg_color(itemlist.get_item_count() - 1, Color.green) else: temp_everyone_ready = false + if !everyone_ready and everyone_ready: + global._print("Everyone Is Ready") everyone_ready = temp_everyone_ready var main_button = get_node("Panel/main_button") if everyone_ready and is_vip: @@ -271,6 +279,7 @@ func _read_p2p_packet() -> void: race_manager.held_messages.append(packet.duplicate(true)) var serialized: PoolByteArray = packet["data"] var data: Dictionary = bytes2var(serialized, false) + global._print("RECEIVED Packet %s" % JSON.print(data)) if "message_id" in data: _send_p2p_packet( { @@ -297,6 +306,9 @@ func _read_p2p_packet() -> void: messages_needing_ack.erase(data["ack"]) if is_starting: + global._print( + "Members Remaining Before Starting: %s" % JSON.print(members_to_join) + ) members_to_join.erase(remote_id) if members_to_join.empty(): @@ -304,6 +316,7 @@ func _read_p2p_packet() -> void: func _send_p2p_packet(data: Dictionary, recipient_id: int, mode: int, needs_ack: bool) -> void: + global._print("SENDING Packet %s" % JSON.print(data)) if recipient_id == RECIPIENT_BROADCAST_ALL: for member_id in active_lobby_members: _send_p2p_packet(data.duplicate(), member_id, mode, needs_ack) @@ -389,6 +402,8 @@ func _return_button_pressed(): func _start_game(): + global._print("Starting Game") + var race_manager = global.get_node("RaceManager") race_manager.lobby_id = active_lobby_id -- cgit 1.4.1