0 votes

Hello everyone,

I think I didn't understand the documentation correctly, so I would like to know more about how to use and how the RSET works.

In my project, a multiplayer 3D topdown game, I have the following situation;

Both the Client and Host use the same interface to select a color. Once they press the "Start" button this color value is sent to a "NetworkMaster".

The information seems to reach the NetworkMaster correctly. But only the peer manages to receive both colors correctly.

I tried using RSET (converting the Colors to string), in order to clear any incoherence between Host and Client data but it didn't seem to work.

So how can I guarantee that both client and host have the same information stored on that playersColor variable?

Maybe this bit of code would help:

var playersColor["",""]
func set_player_info(color):
    rpc("setPlayerColor", 0, color);    
    rpc("setPlayerColor", 1, color);

sync func setPlayerColor(index, color):
    playersColor.insert(index, color)
    if( typeof(playersColor[0]) == TYPE_COLOR && 
        typeof(playersColor[1]) == TYPE_COLOR): 

PS: When I try the RSET function it complains about not been able to convert String to Color. I thought it uses a Variant type exactly to avoid such problem. I wonder if that's a bug or something.

in Engine by (12 points)

Please log in or register to answer this question.

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.
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 webmaster@godotengine.org with your username.