Are there any examples of using Unity for client and Realtime Multiplayer (preferably Lua) for things like abilities, movement, etc?
In my use case, I’m planning to use a dynamic navmesh. User passes inputs for ‘forward’ direction, as well as some ability IDs. The desire is to have Nakama Realtime validate movement (server side position + forward direction * server side velocity) and broadcast this to all users (including the one sending the input). This data should be synced using buffers (the typical udp schema). Abilities would only send the button used, where the server would have a mapping button = ability. The server would determine if the user has that ability, and determine area of effect, etc via maths, and pass this information to the other users.
I want it all to be driven by the back end, client only sends inputs. Server maintains states.
Is this overkill? Should I go for a relay client-based approach (similar to the fish example)?
Hey @bunzaga, that doesn’t sound overkill to me.
Keep in mind that typically movement data syncing happens over our WebSockets which are TCP-based, not UDP.
As for examples, I can’t think of any public examples for authoritative multiplayer but Pirate Panic is our example of relay multiplayer with movement and abilities: GitHub - heroiclabs/unity-sampleproject: A sample game called Pirate Panic for Unity engine built with Nakama server..
Ok awesome. I think for now, I’ll get a relay approach working. Once that is done, I’ll move some things to Lua back end modules. After that, I’ll try implementing buffers and syncing based on ticks, etc.
Note that Nakama doesn’t support Protobuf (or other buffers) natively using Lua. See forum thread and Github issue.
You’d have to import a third party Lua library to be able to use buffers server side. If that’s your plan, I’d love to hear how you get on!
I was looking at FlatBuffers (FlatBuffers: FlatBuffers), but reading that post… I think I’ll follow the advice from here: Beginner's Guide to Making a Multiplayer Game
Get something basic working, then adding complexity. Maybe by the time I get to needing buffers, there’ll be a solution for them.
This is a great approach. Hope to see your game at some point!
I found this: Using FlatBuffers with Lua Haven’t looked into it though.