Is Multiplayer On kicked really triggered?

0 favourites
  • 11 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • I am experimenting with the Multiplayer plugin but as far as I can tell, the On kicked event never triggers on the peer side when the peer is manually kicked by the host using Multiplayer Kick peer (it does trigger if the host leaves though).

    The background is that I allow an unlimited number of peers to connect to the room. The host is able to lock and unlock the room dynamically, and admission of new peers is controlled using this code on the host side:

    On the peer side, I want to detect if the peer was kicked. This is done using this code:

    On the host side, the code works as intended and the peer isn't allowed to join, but on the peer side, the On kicked event apparently isn't triggered. As a workaround, I am sending a message (tagged as Game Locked) from the host, but I would have guessed that this should have been unnecessary.

    Just in case, I have also tried waiting for up to several seconds before kicking the peer, but the event is still not triggered on the peer side.

    Am I doing something wrong or is this a bug?

    (Edited to more clearly explain that the On kicked event does trigger when the host leaves, but not when the peer is kicked manually)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm also trying to trigger the 'On Kicked' event, can confirm this currently does not work for some reason.

    The actual 'kicking' of the peer does work though. Using the Chat Room example I found out it just triggers the 'On signalling room left' event instead (peer-side), but the 'On Kicked' event never triggers.

    Can this be fixed?

  • This explains a lot. Just a beginner here, trying since weeks to kick peers from room. Server kicked the peer but can confirm that "On kicked" is never triggered. Looked in the manual but seemed i did nothing wrong. Then i found this thread here. Will try a workaround but would still be great fixing this.

  • Thanks Eindbaas and Krapfenmann for confirming that there is something wrong with the On kicked event. I suppose that this is a bug and will file a report.

    During additional testing I have also found that Multiplayer.PeerCount doesn't update properly when a peer is kicked. The PeerCount is reduced by one on the host, but on the other peers, the number stays the same. It seems that the peers aren't notified that another peer has been kicked. Perhaps this is related to the On kicked event not being triggered?

  • Well the weird thing is guys that I added in a On Kicked event that would update a text and never seen it happen but then a couple guys I sent a preview link to say they can see their characters for one second then they get a Kicked message. No reason, nothing says to kick anyone in the code.

    Other people though join no problem.

  • No problem MikaelS, I also did some further testing.

    Just wanted to make sure the 'On Kicked' problem was not browser dependant so I tried using Firefox. Sadly I get the same results.

    I modified the Chat Room example a bit to see what is triggered and from which group it came from. Also, when a peer is logged in with the username "TEST" (all caps), the host will attempt to kick that player.

    Maybe it's useful for your bug report?

    Try it here: https://drive.google.com/file/d/1VDwm2KOxRRFj4Y_-3atc4CU6sD-5nwgf/view?usp=sharing

    I was able to get the 'On Kicked' event to trigger sometimes, but it just never happened when I asked it to.

    First scenario:

    My PC connected to the Chat Room example as the host, my phone (using 4G network) then joined as a peer.

    The host couldn't see that a peer had joined. Peer-side, when then sending a chat message to the host results in the 'On Kicked' event (from the Peer group) being triggered. Seems like in this case it's got something to do with my phone not being able to connect properly? Switching over to my WiFi connection fixed that problem and everything seems to work normally.

    Second scenario:

    Suddenly disconnect the Host by closing it's browser tab. Peer-side it will sometimes disconnect and sometimes trigger the 'On Kicked' event (from the Peer group). How or why it does this is a mistery to me...

    As for the PeerCount issue, I can also confirm that the peer-side counter does not update when someone is kicked. This has to be related to the kicking problem in my opinion. I've added a counter to monitor this in my example. To recreate the problem, enable Remote Preview and open 3 browser tabs. Log into the first two tabs, on the third you log in using the name "TEST" (this user will be kicked when logged in). Then check the PeerCount in the top-right corner on each tab.

    I tested this using C3 version r111 stable, Chrome version 67.0.3396.99.

  • I don't know if this is related to this problem at all, but yes, i also can confirm strange behavior with the Multiplayer.PeerCount.

    I made a room lobby and show the Peercount in a text field. It shows 1 when only the host is connected. Which makes sense and also is described in the manual, that the host counts to the peerCount. When a peer joins my room the text shows 2 peercount. The problem now is that if i created a room with a max peercount of 1 a peer still could join and so, there are 2 peers in room.

    -A second and different problem occours later when i start the game and the layout changes to ingame (Also don't know if it is related, but maybe it can help).

    The host show a 'Assertion Error' which seems to be related to the 'Multiplayer.PeerState(PeerID,"")'. It always pops up for the host and when i disable all Peer states no error accours.

    The error was: Assertion Error: Calling expvalue.set_float without number type (Function asset2)

    Seems the variable 'val' is undefinded but the parameter with the peerID of Multiplayer.PeerState was set to 'Self.Peer_ID' in which i store a peers id on start of the layout.

    But maybe im missing something there.

  • if you find bugs then submit bug reports instead of wishfully thinking they go away

    github.com/Scirra/Construct-3-bugs

  • I have been away for a couple of days, and haven't had the time to make a small test project until now. And when I finally did, I ran into another bug which I have just submitted a report for here:

    https://github.com/Scirra/Construct-3-bugs/issues/1901

    This new bug prevents me from testing the original On kicked bug on the Construct 2 runtime, but hopefully I can still test it on the new Construct 3 runtime and post a bug report later tonight.

  • I have now posted a bug report for the original problem here:

    https://github.com/Scirra/Construct-3-bugs/issues/1902

    Thanks for the help!

  • Thank you for your hard work !!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)