From 088bcfed9b3c29dd706c3939878b7e3d36b43518 Mon Sep 17 00:00:00 2001 From: GustavoLR548 Date: Sun, 15 Feb 2026 13:46:06 -0300 Subject: [PATCH] Added NakamaMultiplayerBridge, add Readme, removed old socket connection handling --- CharacterController.cs | 50 ++- CharacterController.cs.uid | 1 + ChatChannel.cs | 10 + ChatChannel.cs.uid | 1 + ChatMessage.cs | 18 + ChatMessage.cs.uid | 1 + GameManager.cs | 6 + GameManager.cs.uid | 1 + Nakama cSharp Tutorial.csproj | 8 +- Nakama cSharp Tutorial.csproj.old | 13 + Nakama/NakamaMultiplayerBridge.cs | 536 ++++++++++++++++++++++++++ Nakama/NakamaMultiplayerBridge.cs.uid | 1 + Nakama/NakamaMultiplayerPeer.cs | 189 +++++++++ Nakama/NakamaMultiplayerPeer.cs.uid | 1 + NakamaClient.cs | 298 ++++++++------ NakamaClient.cs.uid | 1 + PlayerInfo.cs | 22 ++ PlayerInfo.cs.uid | 1 + PlayerSyncData.cs | 11 - README.md | 150 +++++++ SceneManager.cs | 71 +++- SceneManager.cs.uid | 1 + TestScene.tscn | 123 +++--- Texture/TX Chest Animation.png.import | 6 + Texture/TX FX Flame.png.import | 6 + Texture/TX FX Torch Flame.png.import | 6 + Texture/TX Tileset Ground.png.import | 6 + Texture/TX Village Props.png.import | 6 + game_manager.tscn | 13 +- icon.svg.import | 6 + player.tscn | 20 +- project.godot | 6 +- 32 files changed, 1361 insertions(+), 228 deletions(-) create mode 100644 CharacterController.cs.uid create mode 100644 ChatChannel.cs.uid create mode 100644 ChatMessage.cs.uid create mode 100644 GameManager.cs.uid create mode 100644 Nakama cSharp Tutorial.csproj.old create mode 100644 Nakama/NakamaMultiplayerBridge.cs create mode 100644 Nakama/NakamaMultiplayerBridge.cs.uid create mode 100644 Nakama/NakamaMultiplayerPeer.cs create mode 100644 Nakama/NakamaMultiplayerPeer.cs.uid create mode 100644 NakamaClient.cs.uid create mode 100644 PlayerInfo.cs.uid delete mode 100644 PlayerSyncData.cs create mode 100644 README.md create mode 100644 SceneManager.cs.uid diff --git a/CharacterController.cs b/CharacterController.cs index 3e3fdeb..5c624c6 100644 --- a/CharacterController.cs +++ b/CharacterController.cs @@ -4,9 +4,20 @@ using System; using System.Text.Json.Serialization; +/// +/// Handles local player movement and basic player node initialization. +/// Movement is applied only when this node is the multiplayer authority. +/// public partial class CharacterController : CharacterBody2D { + /// + /// Horizontal movement speed. + /// public const float Speed = 300.0f; + + /// + /// Upward impulse used for jump. + /// public const float JumpVelocity = -400.0f; public PlayerInfo Info; @@ -14,31 +25,24 @@ public partial class CharacterController : CharacterBody2D // Get the gravity from the project settings to be synced with RigidBody nodes. public float gravity = ProjectSettings.GetSetting("physics/2d/default_gravity").AsSingle(); - public override void _Ready() - { - base._Ready(); - NakamaClient.Client.PlayerDataSync += onPlayerDataSync; - } + public override void _Ready() + { + base._Ready(); + } + /// + /// Sets the player's visible name and initial spawn position. + /// + /// Player display identifier. + /// Spawn world position. public void SetupPlayer(string name, Vector2 position){ GlobalPosition = position; GetNode