Badmiracle's Forum Posts

  • For anyone interested, I guess one way to be sure is to use custom tags with the identifier attached. Its messy and I'm not even sure if it's necessary but it's a workaround:

    Call getUsername(player.account)

    + function: On "getUsername"

    -> ajax: Send AJAX request with tag "getUsername_" & function.Param(0))

    + ajax: On any completed

    -> json: Load content from ajax.LastData

    //tokenize the tag to get the tag name

    ----+ System: tokenat(ajax.Tag,0,"_") = "getUsername"

    //tokenize the tag again to get the account name

    --------+ player: account = tokenat(ajax.Tag,1,"_")

    ---------> player: Set account to json.At("data.username")

  • Hey R0J0hound, thanks for the reply. It hasn't happened in tests - it's just something I thought about.

    It definitely seems like it could be an issue down the road if the game ever achieves 100+ players or so, where they're all talking to the server at the same time, and the servers making the requests for them.

    In my example, if the AJAX request uses the tag "getUsername", the corresponding condition "AJAX on "getUsername" completed" may not actually be tied to the initial request, but rather the first incoming response with the tag "getUsername".

    I'm worried that because the time it takes to send and receive a response varies for every request that goes out, it might mix things up (eventually).

    I noticed something called an "X-Request ID" in the response headers, I'm wondering if the AJAX plugin takes this x-request ID into account in order to validate the request is a match once "on getUsername completed" fires.

  • Queue them, then no problem !

    Sounds great in theory. Do you have any recommendations for how I could I go about doing that?

    Is there a potential that this could cause a bottleneck?

  • I'm working on a multiplayer game. When a player logs in the server gets a message and sends an AJAX request to my webserver. When the request is completed, the server loads ajax.lastData and return the username to the player.

    I'm wondering if two players were to login at roughly the same time, might it be possible that the server ends up swapping the players usernames?

    Scenario:

    1. Player A and B login and send message to server
    2. Server sends AJAX request for Player A's username
    3. Server sends AJAX request for Player B's username
    4. AJAX request for Player B's username ends up getting received first
    5. Server sets Player A's username to "Player B" (mistaking Player A for Player B)
    6. AJAX request for Player A's username is received second
    7. Server sets Player B's username to "Player A" (mistaking Player B for Player A)

    Thanks,

    bad

  • Kyatric

    I enjoyed the video tutorials on your website. Have you ever made any step by step tutorials for online Multiplayer? If not, do you know of anyone who has? Videos make a bigger impact for me vs reading.

    For now, I would recommend playing around with the templates. It can be overwhelming at first but Construct 2/3 does a lot of the heavy lifting for you - try to focus on figuring out how syncing objects and sending/receiving messages works. It becomes quite simple the more you progress. I'd be happy to answer any questions that you might have.

    All that said - don't bother using Construct 3 for Multiplayer unless local preview gets added: https://construct3.ideas.aha.io/ideas/C3-I-314

    Construct 2 is your best bet for now.

  • Thanks for the info Ashley. I'm going to continue testing (on a different network with a VPS) and see if something has changed since the last time you hosted the game running the multiplayer plugin and I'll let you guys know.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Good point. I'll see if it happens again.

    I remember paying for a cheap VPS at some point, and I would get Chrome crashing on that server quite often, I always assumed it was a mem issue or something else (not MP plugin related) anyway.

    Hopefully some others (if not Ashley himself) can test this and see if they get disconnected as well.

  • I'll give that a shot, but I came across the same issue w/ Firefox. Will keep you guys posted!

    TheRealDannyyy would you mind running a test as well and letting me know if it disconnects by morning?

    I've also been experimenting with running just 1 tab (the host) w/ no peers. Once chrome crashed, and the second time I made it past the 24 hour mark which was promising, then I closed it manually.

  • Ashley I wish I had more info then what I provided. I could keep running tests but I don't see how that will help, I've done it about 6-7 times. Could you possibly try this overnight tomorrow, and just see what happens? Could you try running the ghost shooter multiplayer demo and seeing if it can last longer than a day? (has it ever in the past?)

    Let me know if there's anything specific that you want me to provide, but like I said nothing shows up in the web console - the host just simply disconnects some random time after 12 hours or so.

    We discussed this issue here:

  • TheRealDannyyy no good news (yet).

    I posted this same topic as a Bug Report:

    In hindsight I should have started with that.

  • Problem Description

    Multiplayer plugin - host and any peers disconnect after ~24 hours.

    Attach a Capx

    (Use original Multiplayer - realtime capx found in Construct 2 templates)

    Description of Capx

    Exact same as template.

    Steps to Reproduce Bug

    • Run the capx, and join game as host.
    • Run a second tab, and join game as a peer.
    • Wait 12-24 hours or so (you can leave both tabs open OR minimize one, OR minimize both)

    Observed Result

    Host and Peer both disconnect from the server after an arbitrary amount of time (usually somewhere in the 12-24 hour range).

    I get a "Signalling disconnected" message in the chat log. Nothing out of the ordinary appears in the web console.

    Expected Result

    Should be able to run the "server" continuously. I am trying to have one peer serve as the host/dedicated server, this won't work if the host disconnects everybody for some unknown reason after several hours.

    To my knowledge, my internet connection was maintained throughout the duration of the test.

    Affected Browsers

    • Chrome: Yes
    • FireFox: Yes
    • Internet Explorer: Did not test

    Operating System and Service Pack

    Windows 10

    Construct 2 Version ID

    r248

  • There is a Multiplayer.ErrorMessage expression, but that will display "on Signalling error"

    What's occurring for me is "on Signalling disconnected" - it thinks the host has left the server.

  • Badmiracle

    you can initiate reconnect by your self... turn off/on router

    I think if I were to do that, then the server would d/c because the router is off.

    [quote:2z5esn2c]Thanks for the quick response and information.

    If I had to take a guess on the cause of this issue, my best guess would be that there is some sort of "multiplayer session-length limitation" of the web that automatically kicks in after a while (~12h) and shuts down the session for reasons unknown.

    I just got the disconnection message and it had nothing to do with IP. My IP is still the same as it was.

    I'm curious as to how we can diagnose what's happening. I didn't see any errors in the Chrome console (peer), but I assume the Host had some. Will have to run the test again with the host running the game from an actual browser (not NW.js) to see the results in the console.

    Are you guessing that this is a Chrome/Web Browser issue, or an issue with the Multiplayer Plugin?

  • Badmiracle Can you run the same test and check if the web-console gives out any error messages please?

    Also could you please provide more information like the browser you've used and hardware specs.

    CPU: Intel Core i7-5820K CPU 3.3 GHZ

    Ram: 16 GB

    64-bit OS, Windows 10

    I'm using Chrome for the peer and NW.js for host. I'll report back what shows up in the console after I d/c.

    Still waiting for the disconnect to occur again to see if what irina said is true. It makes a lot of sense that an IP change would cause this problem, but I don't think my IP changes that frequently. That said it hasn't changed yet, and I haven't been disconnected after about 18 hours so far.

  • Is anyone else aware of this?

    RIP Construct Game Dev dreams.