#Networking lobby system calls events before events get called?

1 messages · Page 1 of 1 (latest)

low wave
#

I am trying to set up a multiplayer lobby.
I am following this, and modifying it very slightly.

A server starts, and another instance can join as a client.
When a client connects, it very simply sets info in my players variable. (Image 1)

It then emits a signal to all clients, telling them to update their stuff, with the new client info. (Image 2)

Somehow, the signal gets emitted before the emission actually happens? (image 3) How does that work?

#

Tag me in any reply

short fable
#

@low wave you can't rely on the order of print statements to understand the order of when certain RPC calls are sent/received. They are concurrent so there's many valid print statement interleavings, not 1 like in sequential code

#

Although in this case, I think it'd be useful in the print statements to print who is the sender of the RPC and who is the receiver

Once you do that, it'll be clearer why something is happening

I assume that the very first "UI" call is the server calling player connected on itself but that's just a guess

main jackal
#

Yes the peer_connected signal will fire for the host. Try see if id == 1: return gives you the behaviour you're wanting. As long as your project is setup that the host doesn't need to be initialized through these means that is.

low wave
#

Sorry for late reply. I tried to check if it is the server in on_player_connected, and return if it is the server, thus it should not reach the emit.

However, once the server joins, the update_lists() function gets called regardless. I am really curious as to how that happens

Tagging you @main jackal