Tips for multiplayer ?
-
Hi, I am looking for more complete examples for multiplayer integrations.
Before I ask, I tried the new godot4 ENetMultiplayerPeer solution, it really sucks, and dont work for me.
I found the solution of TCPServer + WebSocketPeer more relaible and interesting, but I could not find good examples, anyone have something to share about it ? -
Multiplayer has always been the hardest part of games, except local multiplayer. Mainly because we have dozens if not hundreds of different processing units and yet they have to talk as one. It's like Threading but on whole different caliber. With that said, it's hard to know what your needs. There are many forms of multiplayers and each have their own difficulty. Realtime, turn based, heck there's even email based multiplayer. And it's hard to know without knowing the exact needs.
While I don't have prior experience in Godot 4 built in multiplayers, I do recommend using Nakama by HeroicLabs
Nakama
Nakama is an open-source, real-time multiplayer server that provides backend infrastructure for games. It's designed to help game developers build and manage multiplayer features such as real-time chat, leaderboards, matchmaking, and more. Nakama supports a wide range of platforms and programming languages, making it versatile and suitable for various game engines, including Godot.
It comes with its own full of
baggageI mean, package. To implement multiplayer in your Godot game using Nakama, you would generally follow these steps:-
Set Up Nakama Server:
- First, you need to set up the Nakama server on your PC environment or somewhere else. You can download the Nakama server from the Heroic Labs website and follow their installation guide.
-
Integrate Nakama Client SDK:
- Nakama provides client SDKs for various game engine, including Unity, Unreal Engine, and Godot, you need to grab the SDK. They should be in Asset Library for you to download.
-
Initialize Nakama Client:
- In your Godot game, you'll need to initialize the Nakama client by connecting to the Nakama server using the provided SDK. This involves setting up authentication, such as using username/password or tokens.
-
Implement Multiplayer Features:
- Nakama provides features like real-time chat, matchmaking, leaderboards, and more. You'll need to use the appropriate functions from the client SDK to implement these features in your game. For example, you can use Nakama's matchmaking to find players for multiplayer matches, or you can use the real-time features for game synchronization.
-
Handle Server Responses:
- When you interact with Nakama's services, you'll receive responses from the server. You'll need to handle these responses in your game to update the UI, manage player data, and ensure the multiplayer experience is smooth.
There isn't much networking out there solutions for Godot sadly, meanwhile they are all piling up in Unity asset store. Hope it can changes in the future.
-
-
Thanks for the reply. But I am not looking for a external server solution...
Thats insane that godot has nothing to provide in the network area, that itself explains why its not growing... -
@altria thanks for sharing about this ! I was thinking about creating my game server in Godot, and run it on my phone. Probably not the greatest idea...