A question before I get started with Nakama (Making a realtime game)

Hello.

Previously, I’ve made some multiplayer games with Unreal and Godot, but maaan, after suffering all the client-server replication thingies and finishing my multiplayer games, then I had to manually make matchmaking stuff, user registration, etc.

Then, I found Nakama: Yay, realtime multiplayer, database storage, user login, google play purchase handling and all of that for free (except servers, you know). So, I got interested on making an Unity game with it.

I went a bit deep into the documentation and, if I understood correctly, there are no RPC events and data is shared with JSON files via webpackets with no udp or something.

Well, then, there’s the question. I want to make an online third person game, like Fall Guys, but simplified. So, I thought on making something like this:

Every player shares to the server their data every 0.1 seconds - So, they’re sharing their location, Z rotation (I only need the yaw rotation, not roll nor pitch) and finally, the player state = 0 is idle/walking , 1 is jumping, 2 is double jumping, 3 is dead… etc) Things like Idle/walking calculation are done on client side after gathering the data by comparing the current location with the last one.

Example:
“x”: 345.34,
“y”: 502.20,
“z”: 302.01,
“rz”: 359,
“s”: 0

That data gets sent to the server, and shared across the clients on a specificmatch.

And that’s it!
I don’t want a server authoritative game, having stuff calculated on the server side seems expensive and probably not worth the effort - hack the game as much as you want if you’re happy winning that way, just eat my ads and I’ll be fine.

So, can I do that? Or are there better ways? Should I even use Nakama?
Also, if sharing that kind of JSON data is the way is the way to go, does it get optimized? I mean,

this:

“x”: 345.34,
“y”: 502.20,
“z”: 302.01,
“rz”: 359,
“s”: 0

seems like a waste of data when we compare it to this:

[345.34,502.20,302.01,359,0]

1 Like

Hey @uwu your approach is mostly sound to me. Your use case is exactly what Nakama was built for. I wouldn’t worry about prematurely optimizing your payloads for data usage – use a structure that makes logical sense to you and any other programmers.

Keep in mind that it may make more sense to send player inputs as payloads (e.g., move up, move left) rather than positional data since those can be validated and then applied on the host client.

1 Like

Thank you a lot for your reply.

I’ve tried out nakama and got the basic “connect to the server with your device ID” and matchmaking things done.

But unfortunately, I’m stuck there. I don’t know how to spawn a character and then broadcast that spawn along all the clients on a match.
I’ve checked out the Pirate game and it’s a great resource for understanding RPCs, how and where the data is stored in the server and how the social system works, but it’s pretty much authoritative and I didn’t understand how most of the code works.

In a nutshell, I’m blindfolded. Are there docs or tutorials I’m missing out? I’ve checked out all of the 6 YouTube tutorials, the Unity client guide and the pirate game, but I’m not yet ready to make something that isn’t just a simple connection to my server.

Nevermind, a lot of Unity tutorials have just spawned in the Heroic Labs channel, teaching exactly what I needed. Thanks!!!

5 Likes