0 votes

Hi ! I'm actually trying to develop a 2D games with networking, but I'm lacking some knowledge to fully finish it right now

I actually have a title screen, which Change Scene to go on a scene which will ask between Create a Server, or Join a Server (I did the network code using ENet as peer to peer since I don't know how to do otherwise)

After that, (for now), players can connect using LAN, and are redirected via a scene change on a lobby

This lobby will be used to select a character, but everyone will be able to see every characters selected by the others.

I have 4 box, each with 2 arrows (previous / next), but everyone can smash any buttons they like. Is there any way of restricting the use of objects to only the network master ?

If there's a better way to do this, I'm open minded to anyone who'd like to share their knowledge with me !

Godot version 3.3.3 stable
in Engine by (82 points)

1 Answer

+2 votes
Best answer

Have all Buttons set to disabled by default then on scene change set them to enabled based on network ID since network master defines the controller of the node.

by (4,308 points)
selected by

Something along the lines of

if $Button.is_network_master():
    $Button.set_enabled(true)

Also forgot to mention it's best to use rset_config along with rset so when you make a change on one peer you update the properties for the other peers (like making a previously selected character unselectable by other peers)

Thanks you ! I couldn't find it even though it was this simple..

I'll try to make that work this evening when I'm home and I'll let you know if I success in making this
I didn't really understand that rset, but I did see that it will be removed in Godot 4.0, so I didn't take a really good look on it (though I used it one time to try syncing players movement)

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.