Multiplayer × User Log-in

Godot Version

Godot 4.7

Question

So i know theres a multiplayer “low” vs “high”. But the problem with it is that i need to make users in my game. So how can somebody create a user by just using the multiplayer thing? I saw tutorials on the log-in thing. They all use firebase. I tried it and its a no no for me. I dont how many options are there. I tought about the .json file but the problem is that my game is online and not offline. Also idk how to make those players searchable into a search bar. I know im bad in these things… im better in 1 person games instead of something like fortnite/ roblox online game.

Can somebody help me?? Im losing my mind LOL :grinning_face:

What do you want from a log in system? What data are you storing per-user?

Generally a login system uses a server to store this per-user information in addition to authenticating. If you don’t need authentication, and don’t need to retrieve arbitrary player data, then you probably don’t need a server and probably not a login system either, you could use local user:// data for multiplayer.

The act of “logging in” requires many steps, almost none of them are Godot related, so it would be difficult to get information from this forum specifically on setting up your server. It’s also very opinionated, no server is built the same. I’ve made a game server with Zig and linux syscalls on my own hardware, it communicates through secured Websockets, I don’t use logins; I designed this game to work on ip addresses per-player.

You will have to make similar decisions, what hardware are you running on? Do you have a spare computer or rent from the cloud? What operating system will you choose? (it will be linux but which distro?) Do you build your own server software or try to use an existing framework? What does the framework use, HTTP, Websockets, custom TCP packets? If using HTTP/Wesockets do you need or have a domain name certificate? We’re finally getting to meat of it: How do you store your user login info and their information?

You probably will lose your mind, I know I did :upside_down_face:

So it’s pretty much like Roblox. Very online game… Also I was thinking of HTTP. But I really don’t know. Also I’m on Android as like my PC is broken for the past year so I’m just using my tablet… I don’t really know it’s hardware so I need to look at that. At least for now I’m doing a option where like you click “play as guest” and it will “create” a guest account for anyone who wants to try the game. It has only the function to play and chat. Meanwhile the normal log-in is based about the same but it has features like money saving, changing avatar, buying items from the shop, limited things and events.

Creating what you’re describing is quite advanced. You would need to understand networking, network architecture, full-stack website creation, and web architecture. For now, I suggest storing any player data (name, level) on the player’s device and just sending it to the server when they connect. I’ll try to explain what creating something like this would involve.

The easiest way of describing networking is that it’s a lot like sending packets with information about the simulation (what buttons were pressed, that Nodes were created/deleted, name of the player etc.) over the post. The person that receives the packet is then responsible for interpreting it and applying it. This is low level networking.

Godot provides a standardised “form” that it fills out, puts it in the post. On the other player’s end, Godot also provides a way of receiving the packet, then interpreting the form inside, and applying any information to the simulation. This is high level multiplayer.

The way the host and player ‘establish’ this connection/postal route is not like logging in. It’s like sending a packet to the other player’s address with a note “hey i want to start sending you data, do you accept?”. The other player then replies “yes”. Only then do you start posting them the forms related to the simulation. There is no postal identity validation, and if you got the address wrong, you won’t know because you won’t get a response (this postal service does not return undelivered post - at best tells you the address does not exist).

Creating a player login via establishing a connection is the completely wrong approach. This connection is just a way to send packets between two people on the internet. It cannot validate identity, even half-reliably. To make it seem otherwise, you would need to do a lot more, like by creating your own identity management service/API/website.

Perhaps, it would help to understand some high-level architecture of existing services.

Roblox

In this analogy, networking in Roblox would be like having a warehouse in the middle. All players send packets to only this warehouse. A clerk (in the identity management service department) makes ensures they are who they say they are, and then also host the game.

First, the identity management clerk confirms they are who they are (e.g. via email + password + one-time passcode), then the player is sent a unique number (session token) to attach to all the parcels they send to the warehouse.

The warehouse also hosts the game (the authoritative simulation). This ensures players’ are who they say they are, the warehouse can receive these parcels more reliably, and the simulation cannot be manipulated by a malicious host (in theory). It also means that the more people want to play e.g. lumber tycoon, the more game hosts can be created and their parcels can be directed accordingly.

Importantly, making it difficult for the host to manipulate the simulation to e.g. give themselves free cash lets the warehouse sell in-game currency for real $$$.

Needless to say, you would need the time and money for a warehouse and its operations.

Minecraft

Minecraft, on the other hand, just has a an identity management clerk the players and server (optionally) check in with. When a player starts the game (not a realms instance - realms work like Roblox), they first check in with the clerk, and get this token. The clerk keeps track of where the player sent the information from.

When a player attempts to connect to the server, the server first checks the player’ address and token with the clerk, before letting them in (as long as the clerk confirms both are valid). Then, all the players start sending the data to the sever directly.

Now, the player’s level, inventory etc. are still provided by the server (allowing the host to change it) as it is extremely difficult and cumbersome (for both the host and the identity clerk) to ensure the simulation cannot be changed.


Creating an identity management service/website is a whole project within itself. You would need to know how to make it, and maintain it. This could be done (like you said) via Firebase or a HTTP API.

I don’t recommend learning how to do this if you want to make a good game. If you want to, a good starting point may be tutorials (for absolute beginners) about making a basic social media (e.g. twitter, blogging) website using a XAMP stack (PHP), ASP.NET (C#), Django (Python), or Node.js (JavaScript/TypeScript).

After this, if you wanted to make centralised game hosting… I’m not sure where to start to be honest. You’d need to know about virtual machines and/or containerisation (Docker/Kubernetes), and probably cloud hosting using e.g. Amazon Web Services (AWS) or their game tech. Then create a separate build of the game just for the server, and create the logic for creating new servers as/when players need them. Maybe running a ‘home-lab’ could be a good (and tedious) starting point?

Running something like Roblox/Fortnite is a genuine software engineering challenge that is worked on by teams of people. Most smaller games do not do this as it doesn’t necessarily add to the player experience.


I appreciate this may sound discouraging. I think it’s more important to focus making things that you can make and enjoying the process.

In my experience, in game/software development you try to create a prototype that barely works some of the time. As long as you have some sort of multiplayer, like the one provided by Godot’s high-level multiplayer, I think this is sufficient for now. Later, whether it be due to curiosity or necessity, you can add player identity validation by creating a basic HTTP API.

In the meantime, try to store any data (level, player) locally. Send it using an RPC (remote procedure call) after the player connects to the server.

Hope this helps! Remember to enjoy the game development process and keep an open mind in the directions it takes you.

Let me know if you have any questions.