Variable value recovery by a client on the server - multiplayer

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By patlol

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… :slight_smile:

Thank you.

:bust_in_silhouette: Reply From: tastyshrimp

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.

:bust_in_silhouette: Reply From: patlol

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.