How do I make a Room List in Construct 2?

0 favourites
  • 8 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • How do I make a list that list all the current rooms and instances that people are hosting on my game?

    They make a room at the log in screen but I want to know how to display all online/available rooms in the game on the login screen as well, like a server list for example and I want to know how to do this on something like the real-time multiplayer example.

    I just can't figure out how to do this with the "Request room list" action.

  • The manual is pretty clear... Which part don't you get?

    You'll need an ”on room list" event, then you can get all the room information by expressions.

    [quote:3qv3qd8b]ListRoomCount

    After On room list, the number of rooms in the received list.

    ListRoomName(index)

    ListRoomPeerCount(index)

    ListRoomMaxPeerCount(index)

    ListRoomState(index)

    After On room list, retrieve information for a room at an index in the received list. The state can be one of "available", "locked" or "full".

    You can use a loop for loopindex from 0 to multiplayer.listroomcount to go through each room by index.

  • The manual is pretty clear... Which part don't you get?

    You'll need an ”on room list" event, then you can get all the room information by expressions.

    [quote:2ep8u8iu]ListRoomCount

    After On room list, the number of rooms in the received list.

    ListRoomName(index)

    ListRoomPeerCount(index)

    ListRoomMaxPeerCount(index)

    ListRoomState(index)

    After On room list, retrieve information for a room at an index in the received list. The state can be one of "available", "locked" or "full".

    You can use a loop for loopindex from 0 to multiplayer.listroomcount to go through each room by index.

    I really have no idea of what to do, I've tried this and it still is not working, here's an image of what I'm doing.

    I don't know what I'm doing wrong I'm requesting the list and everything.

  • So event number 9 is not running at all. Multiplayer.ListRoomCount cannot return a value until the room list has been received, but you call the request in that event. The second event will also never run because the request is never sent in the first place.

    Try using another trigger to first request the room list.

    Then, on room list received, repeat Multiplayer.ListroomCount times

    RoomList Append text Multiplayer.ListRoomName(loopindex) & " - "Multiplayer.ListRoomPeerCount(loopindex) & newline

  • So event number 9 is not running at all. Multiplayer.ListRoomCount cannot return a value until the room list has been received, but you call the request in that event. The second event will also never run because the request is never sent in the first place.

    Try using another trigger to first request the room list.

    Then, on room list received, repeat Multiplayer.ListroomCount times

    RoomList Append text Multiplayer.ListRoomName(loopindex) & " - "Multiplayer.ListRoomPeerCount(loopindex) & newline

    I tried that but it seems to not work. For some reason after it requests the rooms the list never gets received. Hope this image explains allot.

    EDIT:

    this is the event sheet now and it has the same result.

  • Have you read the manual/multiplayer tutorials? It's not easy.

    You're already missing about 4 steps. If you haven't done your homework, it's only going to get worse.. I figured this out with just a quick peek at the manual:

    Connect

    Connect to a signalling server. Upon successful connection, On connected will trigger.

    On connected

    Triggered after successfully connecting to the signalling server. In order to join rooms, it is necessary to next log in to the server.

    Log in

    Once connected, log in to the signalling server. Players must log in before they can join rooms. Upon a successful login, On logged in triggers.

    On logged in

    Triggered after the Log in action if the login is successful. Once logged in it is possible to join rooms. (yes, it literally mentions that on every single one of those manual entries)

    NOW you can request the room list...

  • Plus I see some weird events starting from your "on room list received".

    Should be :

    On room list received

    If roomlistcount > 0

    repeat roomlistcount times ? Do stuff

    And I think you don't even need to check roomlistcount value as if you request the room list, it means you are yourself in a room. So it will always be at least 1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I got it working thanks for the help everyone

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