How do I lock the multiplayer room once the game has started?

0 favourites
  • 9 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • I would like to be able to trigger an event (from the host) that changes the rooms 'locking' state from 'unlocked' to 'locked'.

    There is an option when creating the room, to trigger a lock room when the room hits the max number of peers, but this wouldn't work for me since the host of my game should be able to start the game with any number of peers connected.

    • I could think of one possible way... Is it possible for the host to change the 'max peer' to a lower number at some point AFTER the game has already been created?
    • Is there a way for the host to just 'lock' the room?

    Thanks friends

  • Just gonna give this one little bump, in the hopes that someone smart might have missed it. :)

  • The only thing I can think of is to use an intermediary "matchmaking" room. Then create a new private non-autojoining room when the number of peers are determined.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The only thing I can think of is to use an intermediary "matchmaking" room. Then create a new private non-autojoining room when the number of peers are determined.

    Hi oosyrag! Yes, I saw this in some other posts. It would work, but it seems inefficient. All my players would need to join a room, then all leave, and join a new room. I feel like adding a [Host > 'lock room'] would make waaaaay more sense.

    I appreciate the help though. If I cant find a better way, then I guess ill have to do this.

  • Alternatively you could just have new peers joining get kicked immediately, and forward them to the next room.

    You say inefficient but it's virtually instantaneous and imperceptible to users.

  • The first solution I tried was to auto kick any people trying to join the room. The issue I have with this is that, when the peer requests a 'room list', the room list is pulled based on its state.

    The current room will be locked in practice, but there is no way for the C3 multiplayer system to know this. So I will have many people trying to join games and they have no way of knowing if it is open or closed.

    The idea of forwarding them to the next open game is good, but it doesn't really work for me, since each active game is highly customized. So there is no such thing as 'the next room' for me.

    I wish I could just have the host lock the room.

  • Forwarding to next room would be the same as if autojoin tried to join a room that was full or locked, on peer connected (after game started) host can kick with the message current room name + 1, which the peer can use to retry joining again after getting kicked.

    If you're not utilizing autojoin, that wouldn't work. In that case, I'm guessing you already have a lobby system where people can browse and pick rooms to join. Then the method of moving to a new room upon starting a game would be the most suitable, as you can then display only rooms that have space as options to join.

  • Then the method of moving to a new room upon starting a game would be the most suitable, as you can then display only rooms that have space as options to join

    Yeah, I think you're right. It seems to be the only way. I do feel like Mr. Ashley could potentially consider adding more control over the room state at some point in the future. I'm not the only one who has asked this question.

    But until then...

    I'll have the host broadcast the new room name, have the peer save the new name in a global variable, and on the game start all peers leave the room and join the correct room.

    Thanks oosyrag for the help!

  • Just an additional note:

    This guy wrote about this a long time ago. He came to the same conclusion that I have; There should be another way, but making two rooms works pretty well also.

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