0 votes

I'm working on a turn based card game. I've been reading through most of the documentation but I can't seem to get a grasp on how exactly the multiplayer functionality works and how it is expected to be used.

What I want to achieve is an authoritative server which is hosted by me which can accept new 'matches' between two clients. The documentation makes the multiplayer functionality of godot seem like it is peer-to-peer where one of the players is also the server - which is not what I want.

Perhaps I am misunderstanding or am I correct and therefore need to write my own netcode as a c++ module.

asked Jun 22, 2018 in Engine by TomShar (23 points)

1 Answer

0 votes

Godot multiplayer basically makes one client the server while everyone else a normal client.

You can basically create two code path within the godot api.

https://godot.readthedocs.io/en/3.0/classes/class_networkedmultiplayerpeer.html#class-networkedmultiplayerpeer

The server will always have an unique id of one. Clients have a target greater than 1.

When the target is 0, the network sends data to the server peer than to everyone else.

You can create a client that test whether or not its the server with getuniqueid().

Edit: i am not sure about the details of your goals.

answered Jul 19, 2018 by hungrymonkey (419 points)
edited Jul 19, 2018 by hungrymonkey
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.