Godot Multiplayer Lobby : How to restrict use of buttons for one player only ?

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

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 !

:bust_in_silhouette: Reply From: Wakatta

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.

Something along the lines of

if $Button.is_network_master():

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)

Wakatta | 2021-09-19 23:39

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)

Rensae | 2021-09-20 15:07