P2P: Adress specific client (Solved)

I can only see GetID(), not GetID2,3,other etc.
So i try to get the IP of the other connected player to use later for triggering events on specific clients.
My approach:


But as soon as this event is triggered the game freezes.
@arthuro555 what to do?

E: when i use “Trigger event on all connected clients” (without variables)
and use “P2P::GetID()” as extra data, the game does not crash, but i also do not receive the IP.

E2: NVM i did find the reason and a solution.
A Billion BIG DANKESCHÖÖÖNS!! to you arthur to make this possible <3

For everyone who wants to know how:
(in lobby scene)
The Player, who connects to the other one is stored in a global variable, i call Init.

Then the initiator sends his IP
(in Game scene)

1 Like

I see two issues:

  1. You didn’t connect to a broker server. This step is required in order to let your client discover the IPs of the other clients.
  2. To trigger events on other clients, you need to have connected to them before. To get the ID on other cliens you need to find another way, like hosting a separate backend to let clients discover each other’s IDs or let the user enter the UID.

the clients where connected. the first case where the freeze occurs was in the synchronizedcheckbox scene, after connection.

But for now all is fine and dandy :smiley:

Hm. Such a freeze is an issue. If it happens again, could you try opening on thre frozen game the Javascript console (Ctrl-Shift-I and then on console tab), screenshot and send me any errors?

This is the result of my initial approach, see events in first screenshot)


I found the bug! This is so stupid I can’t believe I didn’t notice. I accidentally used the function to send text for the variable instead of the one to send a variable.

1 Like