From e28b8521d17dac08c9d53e41991935f09fc50c20 Mon Sep 17 00:00:00 2001 From: Thorben Date: Tue, 12 May 2020 18:50:23 +0200 Subject: [PATCH] started with queue --- .../Matchmaking/Networking/Networking_sync.gd | 46 +++++++++++++++++++ Server/export_presets.cfg | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/Server/Scenes/Matchmaking/Networking/Networking_sync.gd b/Server/Scenes/Matchmaking/Networking/Networking_sync.gd index 3fbe61d..02f1f82 100644 --- a/Server/Scenes/Matchmaking/Networking/Networking_sync.gd +++ b/Server/Scenes/Matchmaking/Networking/Networking_sync.gd @@ -24,3 +24,49 @@ remote func remove_player_from_open_game(game_id, player_id): remote func remove_game_from_game_list(game_id): _open_games.erase(game_id) + + +var _queue = [] +var _hidden_games = {} + +func _process(delta): + if _queue.empty(): + print("Nothing to do.") + else: + var player_id = dequeue() + + if _hidden_games.empty(): + create_game(player_id) + else: + join_next_hidden_game(player_id) + + +func create_game(player_id): + pass + +func join_next_hidden_game(player_id): + pass + +remote func search_for_game(player_id): + enqueue(player_id) + +func enqueue(player): + _queue.append(player) + +func dequeue(): + return _queue.pop_front() + + +# 1. player clicks matchmaking +# 2. is there a hidden game? +# 3. a) yes -> join the hidden game. -> the it should be full, and the game should start +# 3. b) no +# 4. b) player creates the game that will go to the server-hidden-games +# 5. b) waiting for player to join. if full, game will start + +# Player side needs: + # Searching-Button -> Server will create the games + +# Server side needs: + # queue for the searching players + # diff --git a/Server/export_presets.cfg b/Server/export_presets.cfg index b242810..565cb9b 100644 --- a/Server/export_presets.cfg +++ b/Server/export_presets.cfg @@ -7,7 +7,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../Godot_Executables/Server.x86_64" +export_path="../Executables/Server.x86_64" patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key=""