Search Unity

Masterserver forgetting about active gameservers? Timeouts?

Discussion in 'Multiplayer' started by EducaSoft, Apr 21, 2008.

  1. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    Hi there.

    I managed to write a little bit of code which lets my program register itself as a gameserver to the masterserver.

    Then , when I run the same program on another computer, it can poll the hostlist and my registered server appears in the list of servers.

    I have set the application to also run in background, but actually it shouldn't be an issue because the programs always run in foreground on each pc.
    I also disabled all screensavers and power management.


    NOW LOOK WHAT HAPPENS !!!

    Well, If I let my first pc register itself as a gameserver, then it works perfectly to start other instances of the program on other PCs and let them poll the hostlist.
    The server is nicely shown.

    But..... If I let my gameserver on for a longer time (like you would expect from a waiting gameserver) then after a certain time the gameserver just dissapears from the hostlist. I did not change anything on the pc which hosts the server.


    So what could be happening?

    Can a registerserver timeout ?

    Does the masterserver at UT maybe have this limitation ?

    Do I have to regularly make a certain call tonot expire the host registration?



    For the moment I didn't time it, but the servername lasted certainly half an hour (maybe a full hour even), but then just dissapeared.



    Any help on this subject is highly appreciated.


    Kind regards,

    Bart
     
  2. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I've had a bug filed for this quite a while ago. Larus had set up a beta-masterserver for a while, on which this problem did not occur for me. Since that beta-masterserver seems to no longer exist, I would assume (anybody correct me, if I'm wrong), that this has now gone online.

    Unfortunately, this issue seems to be worse than before now on the official masterserver. At least, I'm not getting my list of servers about half the time. A workaround is simply re-registering every few minutes (or even seconds). That does fix it for me, but I don't know if the master server will like it a lot if everyone does that.

    Since this never happened to me on the beta-masterserver, and it does happen to me all the time on the official masterserver, my guess would be that this has to do with many people using the same masterserver. That would also explain why this problem has become worse. I don't think that has anything to do with another master server version - I guess it might just gradually become worse the more people use the official master server.

    That's just an assumption, of course. What I might be trying is simply setting up my own master server. If it never happens there (since I'll be the only one using my own master server), my assumptions can be considered "q.e.d." ;-)

    Sunny regards,
    Jashan
     
  3. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    Jashan,

    Tnx for fast reply.

    I would allready be happy if it isn't my code which does this.

    Maybe I should indeed try to run my own masterserver too.

    Any idea if you still have that beta masterserver code ?

    Regards,

    Bart
     
  4. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    No (I don't know if that code ever went outside of UT), but if my assumption is correct that this problem is "load-related", I guess the version really doesn't matter...

    On http://unity3d.com/master-server/index.html it still says 0.1.0, so I think that's still the most current version available...

    Sunny regards,
    Jashan
     
  5. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    Lars, could you please tell us what could cause this ?

    Is masterserver @ unity under too heavy load ?

    How much load can this thing handle ?



    Would be quite important to know, because if we host our own masterserver, then it sure will have to be at least a little stable.

    At this moment its a crucial part of networking in unity, so its important for us to know how stable it is.


    Kind regards,

    Bart
     
  6. larus

    larus

    Unity Technologies

    Joined:
    Oct 12, 2007
    Posts:
    279
    There is some logic in the master server which removes unresponsive servers. This way the list will not contains servers which are no longer running but didn't disconnect from the master server cleanly. I think this is failing so that active servers are incorrectly being removed.

    If this is an issue for you at the moment you could force send regular host updates like Jashan suggested as a temporary workaround.

    There was a beta version of the server running with some changes which addresses this and improves the handling of server registrations but it will not be published until it has undergone proper beta testing, this will happen along with the next release of Unity. We need to confirm the new version is rock stable (there are also some other changes) and solves the issue.

    I don't think this is load related or at least the master server hasn't been under any particular heavy load lately, compared to past few months. The current version should be able to handle some thousands of concurrent users. The current usage hasn't been anywhere near approaching the limit but. There is room for optimizations if needed and you could always run your own server if you except some humongous amount of traffic.
     
  7. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    So what to do now ?

    It is not a huge problem for me now, but If I make a game which uses it, we would expect it to be stable.

    I don't know if its a good idea to register the host every time again and again. What will happen if my gameserver has allready 2 atached clients who are playing, but because players can join an existing game, he re-registers himself to the masterserver every 2 minutes ?
    Would the clients which were connected still be connected? Would that affect anything ?


    If I read your explanation correcty, then running our own masterserver will most probably not fix this problem?

    If I recall well, then a next release of unity is not skeduled in the nearby future, so how long would we still have to work with this bug (if it is a bug) ?


    I just want to try to know how serious it is for people who want to release a game for example next month.


    Kind regards,

    Bart


    PS. That PING class that got added in 2.0.2 is SUPERB !
     
  8. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hi Larus,

    thanks for clearing this up! So do you think it's ok to re-register every few seconds (let's say every 10 seconds or so)? In my latest testing, I noticed that when I do it every few seconds, I can connect pretty much all the time. If I set it in the minute range, I can't connect quite often (this is in a testing environment where I start the server, wait til it's connected, start the clients, test, shut everything down, maybe change some code - next iteration).

    I guess it sometimes might be a problem when the server is restarted too quickly after it has been shutdown.

    Sunny regards,
    Jashan
     
  9. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    Jashan,

    I suppose your game doesn't allow other people to log in while they game is running ?
    That way you could maybe implement it, but actually, this is not a nice solution to the problem.

    If a gameserver registers itself as a gameserver to the masterserver, then the masterserver simply should not remove it, point ...

    I didn't yet look at the code of the masterserver itself lately (did it once some months ago) but I remember that it is not THAT big.

    I really hope that somebody will simply try to fix this. Looking for workarounds is maybe nice, but certainly not the solution.


    So, Larus, is anything possible to check for this wrong behaviour? Networking is very important factor in online games (at least its something where unity should be very good at), but I don't think that players who host a game on their clientmachine would be happy to see that they don't appear or dissapear from the hosts list. And at the current rate it just happens too much not to get noticed.


    Kind regards,

    Bart
     
  10. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    Another question I really would like to ask is the following.

    The masterserver source code is provided with makefiles for VC, Xcode and Linux stuff.

    But the problem is I would like to test out with my own masterserver on a windows machine (to test with).

    Could it be possible to also put a compiled .exe masterserver on the download page please ?

    I can guess a lot of coders in here don't have VC.
    I am a delphi programmer and I make quite a lot of .exe files, but I have no VC to compile the masterserver .Exe.

    If you could put it online somewhere, then other people could benefit from it too and you save the hassle to have to find a VC to compile it.


    I hope that this could be done ?


    Kind regards,

    Bart
     
  11. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    People can log in at any time as the server is designed for massive amounts of players. And so far, I never had problems with re-registering. I guess all it does is overwrite the entry in the internal database with the same values that already were in there, so it shouldn't break anything, even when people are logging in or off at the same time (or when people stay logged in).
     
  12. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    If I can compile this under my Visual Studio 2008, I could probably send you the exe. I haven't tried that, yet, and may not get to do it before next weekend, but that would be an option... I'm not sure I installed the C++ stuff and I'm not even sure VS2008 is compatible at all with VS2003 when it comes to C++ stuff, since I'm using this only for C# / .NET stuff.

    A downloadable exe would be appreciated in any case ;-)
     
  13. larus

    larus

    Unity Technologies

    Joined:
    Oct 12, 2007
    Posts:
    279
    Reregistering only updates the server registration if the server is already registered. This happens automatically every time some field has changed, like the current player count of the server. It's perfectly safe to manually re-register frequently. The only reason it isn't done every 10 seconds or at regular intervals by default is to conserve bandwidth. It won't affect the current connected clients at all.

    As I said before, just set up a regular registration interval when you want your server to be visible to clients. Then unregister when its not supposed to be visible. Then there will be no problem, its just a bit more traffic for the master server to handle but at the moment it is OK, and this is only temporary until the new version is put into production. As I have understood the problem, then this only occurs when a server registers and is inactive for a long while (some hours or at least more than 10 minutes). Therefore this should only be a problem for dedicated servers which might run with no players connected for long periods of time.

    You should be able to compile the project with an express edition of VS C++, probably better to use the 2005 edition. They are free to download. Maybe we could provide an installer/binary file on the source code download page, I'll look into it.
     
  14. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    Okay,

    I'll try to implement interval re-registering.

    As to what concerns the .exe version of the masterserver. I really hope that you (Jashan) could compile it and it would be even better if Larus would put it online on the same page as the masterserver source download. Its just an added service for the customers...


    Kind regards,

    Bart
     
  15. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    Jashan,

    At what rate should I then best do my registerhosts ?

    You seem to have experience with this .
     
  16. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Well, at the moment, I'm going at a rate of 10 seconds (or maybe even 5), but less frequent may do, too. I just had some serious trouble last weekend and thus put it to a high frequency without checking if that's really needed. Best is to simply try different settings... All I know for now is that after I increased the frequency to this level, I never had problems again. Sometimes connection is immediately there, sometimes it feels like it takes 1/2 second, but I could connect each time with no exceptions (as far as I remember).

    Of course, keep in mind: There might still be some other reason why this may not work. For instance, a few times I simply was too quick so that the server hadn't really registered with the MasterServer, yet, when I tried to connect with the client. The server or your network might also behave "oddly" causing the MasterServer to drop the connection (not sure what this might be, but it could be a possible cause). Finally, I had a few cases when a client couldn't connect, but once I had restarted the client, it suddenly worked (without re-registering the server).
     
  17. Valendhar

    Valendhar

    Joined:
    Sep 30, 2007
    Posts:
    41
    Hi Jashan,

    I am currently developing a multiplayer game aswell, and i had similar problems.
    Sometimes i started a server on one machine, and refreshed the list on my second machine which showed the created game. But after a few seconds the server disappeared from the List.

    Another thing was, which is more frequent, i tested the game with a collegue of mine through the internet, and the web player files are hosted on my dedicated server.

    When i start a server he can join the game without a problem, but when he creates a server and i want to join, i can click on the join button all the time but it just doesn't connect. I have based the program on the networking example. I Just don't know what this problem could be.

    So can this be related to this problem aswell. I am still trying to figure it out.
    Reading through the forum , i figured you seem to have a lot of experience with the unity networking, so maybe you have had some similar problems.

    Any ideas or help would be appreciated.

    Mike
     
  18. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    As far as I know, the webplayer starts the server automatically connects itself to itself.

    So it makes no sense to connect to yourself if you are allready connected automatically I think
     
  19. Valendhar

    Valendhar

    Joined:
    Sep 30, 2007
    Posts:
    41
    Hi,

    I use the web player for easy testing purposes for multiplayer games.
    Here is the a simple test i did.

    http://www.valendhar.de/valendhardw.html

    It just a simple testing application, to test some features and the GUI still has some problems with the text fields i still need to figure out, so don't mind it.

    You can create a game with a name and description. Then it changes to a test scene , with just a simple chatting feature. Another player can then join the game through the available game list.

    Testing it with a friend i could start a game and he could join. But i couldn't join his created game.

    And sometimes it happened that a create game vanished from the list. So i thought that it may have something to do with the master server problems discussed in this thread.

    Any help would be appreciated.

    Mike
     
  20. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    just tried with 2 PCs and they can nicely connect and chat here
     
  21. Valendhar

    Valendhar

    Joined:
    Sep 30, 2007
    Posts:
    41
    Hi EducaSoft,

    thanks for your help. That is really funny. I tried it at home, using my iMac and MacBook yesterday and i could connect from both sides, but not all the time. And then when i tried it with a friend through the internet, we had those problems that i could not connect to his game.

    That's really weird. Well, thanks anyways. I probably will see in further development stages if this will occur again.

    I just thought that maybe the MasterServer could be the reason in some way.

    thanks
    Mike
     
  22. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hi Mike,

    Just one quick answer, because I'm on the way to my bed ;-)

    That might be because NAT-punchthrough fails for your friend. A lot can be done with NAT-punchthrough, but sometimes it fails. You can still connect to a server when NAT-punchthrough would fail for you - but you can't host a server in that case (actually, it has to do with both, I think).

    Your friend being able to join on your server, but you not being able to join on his server looks like a case of that. I think there's a couple of variables and possibilities, which are nicely documented in the networking manuals (don't have that stuff at the top of my head, though, so please excuse it I'm not being very accurate here ;-) ).

    The other problems you mentioned sound a lot like the master-server issue we had talked about, so I think there's two problems: One with NAT-punchthrough (it simply isn't possible in certain cases - one case being you not being able to connect to your friend's server), and the other with the master server. The former is probably something that you should handle from your game (I think there are checks to prevent people who can't create a server accessible to all from creating one, or there might be checks to hide those "servers" from the host list), the latter, you can workaround with re-registering frequently.

    Sunny regards,
    Jashan
     
  23. Valendhar

    Valendhar

    Joined:
    Sep 30, 2007
    Posts:
    41
    Hi Jashan,

    thanks for your answer. But it seems that my friend had NAT punchthrough capabilities as well. That's why it seems weird. I can check again tomorrow.

    The thing with the bed is actually what i need to do aswell now (getting up early for work)

    But at least there are some good hints i can look into. But if that is the case with the NAT , then the whole idea of my game can be in danger.

    Thanks again
    Mike
     
  24. Aubrey-Falconer

    Aubrey-Falconer

    Joined:
    Feb 13, 2008
    Posts:
    438
    I have been suffering from what appears to be this exact same problem in Mars Explorer, and it looks like it is getting worse by the day.

    I just published the latest version of my game with a coroutine to reregister game servers every 4 seconds, and I am still experiencing "list server flickering" so bad that it is a pain trying to connect to a specific server in my game.

    This is a major issue. The list server is dying! Unity: should I reregister my game every second - (or maybe even more frequently) - or is there some better way?

    I was really hoping for this issue to resolve itself with the release of "the next version of Unity", but it looks like it didn't. What should I do?
     
  25. larus

    larus

    Unity Technologies

    Joined:
    Oct 12, 2007
    Posts:
    279
    Yes, the disappearing host problem wasn't solved when the new Unity version was released. It appears the problems gets more apparent when as the server gets more traffic. At first, during testing, it appeared it was fixed, but it wasn't.

    We are looking into this problem again, I'll keep you posted.
     
  26. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hi Larus,

    thanks for the update on this one! So it might be a good idea to host one's own Masterserver? Since it seems to be a problem related to traffic, this should not happen if one just uses a dedicated Masterserver for a single game.

    Sunny regards,
    Jashan
     
  27. larus

    larus

    Unity Technologies

    Joined:
    Oct 12, 2007
    Posts:
    279
    Yes, definitely. Hosting your own master server would probably eliminate or at least minimize this problem, until this is fixed for real.

    It might be best to run it externally, especially if it would run with a private IP (NAT) and have machines using it locally as well as externally (with port forwarding of course). Access to a virtual server isn't that expensive these days I think.
     
  28. Aubrey-Falconer

    Aubrey-Falconer

    Joined:
    Feb 13, 2008
    Posts:
    438
    Thanks Laurus!

    I am glad to hear that the problem is being worked on, and wish you a speedy resolution to it!

    I will see if I can get my own master server running in the mean time.

    -Aubrey