started with queue

This commit is contained in:
Thorben 2020-05-12 18:50:23 +02:00
parent a3549d357b
commit e28b8521d1
2 changed files with 47 additions and 1 deletions

View File

@ -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
#

View File

@ -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=""