0 votes

Hello,
My problem:
I create a server and then a client with gamestate.gb and lobby.gb as in the example multiplayer bomber.
After that, the client would have to retrieve a dictionary from the server and add an item to this dictionary and send it back to everyone (other potential clients and server). I can't get this dictionary from the server. There is a rset but no rget??? how to code the equivalent?

I'm beginning in multyplayers and I'm having a little difficulty... :)

Thank you.

asked Dec 12, 2019 in Engine by patlol (46 points)
edited Dec 12, 2019 by patlol

2 Answers

+1 vote
Best answer

I believe in this case you should let the server administer the dictionary and let the client send the value you want to add. That way the dictionary keeps synchronized, otherwise if 2 players add a value to the dictionary at the same time you might have a race condition and desync the state of the clients.

Use rpc_id to send a message to the server, the server is always id 1.

answered Dec 12, 2019 by tastyshrimp (556 points)
selected Dec 19, 2019 by patlol
0 votes

Okay, thank you.
I managed to circulate the updated dictionary, on the clients and server with an rpc_id to update the dictionary on the server and then an rpc to distribute it to everyone from the server.

answered Dec 13, 2019 by patlol (46 points)
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.