feat: Add player character scene, Nakama multiplayer manager, and a new arena scene.

This commit is contained in:
Yogi Wiguna
2026-03-16 11:59:11 +08:00
parent 71d688ed63
commit 855b05b017
4 changed files with 29 additions and 1048 deletions
+23 -2
View File
@@ -33,9 +33,30 @@ func _init_client():
func set_server(host: String, port: int = 7350):
nakama_host = host
nakama_port = port
# Auto-detect secure tunnels (Tailscale, ngrok, playit, cloudflare)
if host.ends_with(".ts.net") or host.ends_with(".gg") or host.begins_with("https://"):
if host.begins_with("https://"):
nakama_host = host.replace("https://", "")
if host.begins_with("http://"):
nakama_host = host.replace("http://", "")
if nakama_host.ends_with("/"):
nakama_host = nakama_host.substr(0, nakama_host.length() - 1)
nakama_port = 443
nakama_scheme = "https"
else:
# Extract port if they typed something like 192.168.1.1:7350
if ":" in host and not host.begins_with("http"):
var parts = host.split(":")
nakama_host = parts[0]
nakama_port = parts[1].to_int()
else:
nakama_port = port
nakama_scheme = "http"
_init_client()
print("[NakamaManager] Server updated to: ", nakama_host, ":", nakama_port)
print("[NakamaManager] Server updated to: ", nakama_scheme, "://", nakama_host, ":", nakama_port)
func _process(_delta):
# If using the standard socket adapter, it needs polling in some versions