Yet-another Multiplayer Demo

0 favourites
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • xoros

    I'm not sure why "Login to lobby failed". I always login the lobby successfully.

    There is a limit in game-room only, when the game started, the game-room will close so that new users could not join into this game-room.

    The lobby does not have this limit. Could you give more information?

    BTW, you could get the server code in first post of this thread.

  • Hey rexrainbow,

    the plugin and server are working just fine and very easy to use. But right now I'm trying to solve the following problem:

    The user should automatically connect to the next available game room or create a new one with the higher index. So I'm trying to do something like this:

    "On room unavailable" > set RoomID to str(int(RoomID)+1)

    Bottleneck "User MyUserName" join to room "RoomID"

    But it doesn't work like this. It seems that after "onRoomUnavailable" there's no other "connectivity" actions possible. Ideally it should work recursively.

    Or do I have to save room data somewhere on the server and parse the data with something like php?

  • xoros

    The RoomID is not a series number, it created by user.

    In Lobby.capx, I use a hash table to save the valid room name and room id. (On function "UpdateVaildGameList") So you might need to maintain a data structure to store these room info.

    Sorry, it might not be convenient.

  • Yes, I know, that RoomID is a string, but the thing I want to achieve is just automatical RoomID generation (instead of using that from the input field).

    Example flow:

    • Default RoomID is "0" (which is a string set in an event)
    • the first player(0) automatically joins the roomID "0" and is waiting for an opponent
    • the next player(1) automatically joins the roomID "0"
    • the client checks if number of players =>2, closes the roomID "0", goto Game
    • the next player(2) joins the default roomID "0", but can't because it's closed

    (until this point everything works fine)

    • Condition "onRoomUnavailable" should try to change the roomID variable to something else (e.g. convert str to int iterate it +1 and than convert back to str). This could also be just another string like "FreeRoom". It means that the next room is automatically created by the client.
    • Try to join to the newly created roomID (this step doesn't work).

    The problem is, that "onRoomUnavailable" doesn't allow to retry joining another room

  • xoros

    Thanks, I understand that the "onRoomUnavailable" is a condition in bottleneck, not in bottleneck_lobby. (I make a mistake previous post)

    In my original design, the room id is an identify to tell friends to join my game, like "xoros's game".

    The available room list is maintained in game lobby (bottleneck_lobby, not in bottleneck). So player could choice the game which he/she want to join.

    I need to check the server code and bottleneck plugin if you wish to get a available room id in bottleneck plugin. (when I have time. I'm making a new sprite bank recently, sorry.)

  • Ok, i'll take a look at the bottleneck_lobby plugin.

  • One more question about "lobby" plugin:

    there's a condition "forEachAvailableGameRoom", which cycles through all opened rooms. Is there any way to cycle through all the rooms, even those which are not available?

    Something like "forEachGameRoom" and then a condition if "GameRoom" available -> do something, else do something else.

  • xoros

    You could store "previous" available room, then compare to "current" available to get the unavailable room. Official dictionary object might be suitable in this case.

    I thought designer only want to display available room in most of case, sorry for the inconvenience.

    Edit:

    I might add this feature in my TODO list.

  • No problem, man - the plugin is still very cool.

    In my project the "room joining" process should happen automatically. The user just inputs his name and presses start button. Than he is automatically trasfered to the next available room. If room member limit is reached (in my case it's 2-4 players), the room is automatically closed and the game starts.

    But I think I've found the way how to do this without storing anything in hash-tables, just by combing "Lobby" plug for iterating through available rooms with "Bottleneck" for joining the available room.

  • So I managed to implement rooms auto-joining without storing any data. But one thing is not clear to me - it is onUserLeft event:

    I'm testing with several browsers opened, so if I close a window in one browser there's certain delay (ca. 1-2 Minutes) until onUserLeft in the BottleNeck plugin fires. Is it possible to change this delay to zero or some very small value? or is it "socket.io" specific value? Or may be this delay is due to all the users comming from the same IP?

    The same thing is with KickUser: when this method is called onUserLeft does not respond.

  • xoros

    Uh, yes. My server has "left delay" problem indeed. (But only on my server. The demo of socket.io is no delay when user left.)

    I had checked this problem before, but fail. I'm not sure why, sorry. I might check it again later.

  • OK, I'will look into the problem.

    Found this:

    stackoverflow.com/questions/6280569/socket-io-xhr-polling-delay-on-disconnection

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • xoros

    Thanks a lot.

  • i got this error:"Unable to load

  • I changed this in you server.js file:

    io.set("transports", ["flashsocket"])

    and there's no delay, but it works only in firefox :(

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