feat: support configurable game server address and port

* Launch game servers in headless mode
* Add configurable game address and port to GameData
* Pass dynamically assigned server ports to clients
* Update lobby defaults for `0.0.0.0:8080`
* Refactor server command-line argument handling
This commit is contained in:
2026-08-10 00:28:23 -05:00
parent 1eb057fefd
commit 7897462309
5 changed files with 30 additions and 7 deletions

View File

@@ -1,6 +1,10 @@
class_name GameData extends Node
var game_address: String = "0.0.0.0"
var game_port: int = 8080
func _init() -> void:
Globals.game_data = self

View File

@@ -45,11 +45,15 @@ func _launch_game_server(
var port: String = InstanceLauncher.launch_game_server(match_entry.data.type)
if port == "-1":
# TODO: Alert clients that the game wont be created due to
# server reaching number of allowed instances
# server reaching number of allowed instances.
return
Globals.game_data.rpc_id(client1.id, "set_game_address", "127.0.0.1")
Globals.game_data.rpc_id(client2.id, "set_game_address", "127.0.0.1")
# TODO: Set address dynamically; I.E. if game on different server than lobby.
# As is, clients use the lobby address since games launch on new ports.
# Will have to change how we watch game server death if on diff server.
#Globals.game_data.rpc_id(client1.id, "set_game_address", "51.222.85.126")
#Globals.game_data.rpc_id(client2.id, "set_game_address", "51.222.85.126")
Globals.game_data.rpc_id(client1.id, "set_game_port", port)
Globals.game_data.rpc_id(client2.id, "set_game_port", port)