0 votes

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.

in Engine by (72 points)
edited by

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.

by (572 points)
selected by
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.

by (72 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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.