Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Released] Master Server Kit: create your own UNET-based dedicated server

Discussion in 'Assets and Asset Store' started by gamevanilla, Oct 14, 2016.

Thread Status:
Not open for further replies.
  1. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for the additional information, FuTou. :)

    I understand how that kind of functionality may be useful and I plan to continue extending the capabilities provided by the lobby in future updates (please note that being able to "select 5 different roles and starting positions" is something very game-specific, though, and the focus is on generally useful features that can be applied to a wide variety of games). I will do more research on the Network Lobby Manager component to see if it makes sense to provide an integration with it; as mentioned there is a lot of overlapping functionality with the kit's lobby.
     
    Last edited: Dec 18, 2016
  2. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    The latest update of Master Server Kit (1.05) is live on the store now! :)

    These are the release notes:
    • Several improvements in the matchmaking API to simplify its usage.
    • Replaced authenticationEnabled flag with authenticationRequired in the configuration.
    • Added maxPlayers property to the configuration.
    • The database does not store the “is logged in” status of a player anymore; the master server does now.
     
  3. FuTou

    FuTou

    Joined:
    May 2, 2015
    Posts:
    52
    Hi, in my opinion, the 2 "lobby"s share the same name, but act quite differently. Or, we could even say they do nothing in common.
    The unity network lobby manager basically handles things after players are matched up.
     
  4. msantore22

    msantore22

    Joined:
    Nov 19, 2015
    Posts:
    24
    Hello, I have a question reguarding a specfic use for this asset, before i buy? Does the asset use the network lobby manager? or just the regular network manager? my game is built specifically for network lobby manager, i tried the nat traversal relay way of doing things but that asset only works for network manager and not the network lobby manager.


    I really need an asset with matchmaking to work around the UNET matchmaking prices, The place i rent my dedicated server has Unlimited bandwidth, the vps costs $5, and a full dedicated server with 8 cores xeon processor is like $89, you can't beat that price with unity's UNET like seriously.


    Thanks in advance. :)
     
  5. FuTou

    FuTou

    Joined:
    May 2, 2015
    Posts:
    52
    Msantore22, I was just preparing to buy NAT traversal ... luckily I saw your post. Don't having the ability to use network lobby manager is a disaster.
    By the way, where did you buy the vps? I think the deal was very attractive.
     
  6. FuTou

    FuTou

    Joined:
    May 2, 2015
    Posts:
    52
    Although I'm not the author, this kit is easy to have the ability to use network lobby manager, in my opinion. I went through the code, and I think with some effort it's going to have that ability.
     
  7. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for your interest! Currently, the kit provides an integration with the Network Manager component if you want to use it. It can also be used without any of the high-level components in UNET.

    I still do not know how feasible it is to integrate the Network Lobby Manager, but I plan to research it. As far as my understanding goes, this component provides additional functionality like ready states before starting the actual game, which am interested in for the kit in general (independently of whether you are using the high-level components in UNET). So, depending on the implementation details, I may also provide equivalent functionality in the core kit without using Network Lobby Manager itself.
     
  8. msantore22

    msantore22

    Joined:
    Nov 19, 2015
    Posts:
    24
    Thanks for your reply. I did purchase your kit last night. Because network lobby manager derives/extends from network manager I'm gonna try copying parts of your code into my own to see if I can implement it. If that fails I'm gonna try making my own custom unity networking dll. Unity themselves provide access to the source that contains network manager and network lobby manager. I tried it with nat traversal but their dll wouldn't import into visual studio. I kept getting an error. For access to the unity networking source code just Google "BitBucket" with the words "unity technologies" they had also made a blog post about it. Anyways I'll report back if I get something working.


    To the guy above about the VPS google: "ovh.com" they don't provide any support for their vps and dedicated server. You have to know how to manage one on your own. But they are the biggest company in servers. A lot of other companies essentially just resell their hosting as their own because they can provide the support people need but then they charge you for bandwidth when it's unlimited lol. Best of luck.
     
    gamevanilla likes this.
  9. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    335
    Hello,

    i m interessted by your asset and could you please introduce the persistent world view with mob respawn system (timer after kill by player) for example?

    happy Christmas.

    +++
     
  10. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for your purchase! :)
     
  11. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Happy Christmas and thank you for your interest! :)

    I see such a feature outside the scope of the kit, as it is very game-specific and the kit is intended to provide more generally useful features that can be applied to a wide variety of games.
     
  12. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    335
    ok :(

    thanks.
     
  13. FuTou

    FuTou

    Joined:
    May 2, 2015
    Posts:
    52
    Hi, has your game succeeded in hosting using this kit?

    Mine now has an issue, so I wonder whether it's my own issue.
     
  14. msantore22

    msantore22

    Joined:
    Nov 19, 2015
    Posts:
    24
    Hey just wanted to report back about my findings. So this kit is its own unet lobby. It let's you completely replace the network lobby manager. I successfully used authentication and launched a game server containing my game in a local environment on my desktop. I'm using this in combination with the umoba asset. I still have to figure out my character selection process. But I just wanted to say: Excellent kit spelltwine!! Thanks a ton


    Edit: @FuTou if you're using the demo scenes you have to open each scene and enable each component. Mine were all disabled so I couldn't test properly till I enabled them. Good luck
     
    Last edited: Jan 2, 2017
  15. FuTou

    FuTou

    Joined:
    May 2, 2015
    Posts:
    52
    Thank you Msantore22!
     
  16. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for your kind words! I am happy to know the kit is helping you. :)

    And I agree with you; that is exactly what I meant a couple of messages above about the Network Lobby Manager being somewhat redundant with the features provided by the kit. Still, this component has interesting functionality (like ready states) that is worth exploring for future updates.
     
  17. FuTou

    FuTou

    Joined:
    May 2, 2015
    Posts:
    52
    I just succeeded in integrating network lobby manager into this kit, and did color & class selection using it.

    How are you doing with the character selection? Are you using something else to do the character selection instead of the lobby manager? I'm also interested in alternative ways of doing that :)
     
  18. angusmf

    angusmf

    Joined:
    Jan 19, 2015
    Posts:
    261
    Hi, hope I'm not asking a question that's already been asked. Didn't see it. Is it currently possible (or at least relatively easy without rewriting everything in your asset) to integrate different unet games to the master server? The goal would be to be able to share a single player account among different games and be able to spawn instances of those games on a single machine. Multiplayer asteroids, multiplayer pac-man, etc.
     
  19. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    That is an interesting use case! The kit currently assumes a single type of game server to be spawned when a new game is created, but it should not be terribly hard to extend this to support different types of game servers if you feel comfortable with programming (and assuming having a single database for all the games works for you). Also, as I plan to add more features related to custom attributes for games in future updates of the kit, I will definitely take your use case into consideration.
     
  20. angusmf

    angusmf

    Joined:
    Jan 19, 2015
    Posts:
    261
    Thanks for your response! If I purchase your kit, I'd be happy to contribute whatever I developed towards this end.

    Another feature I would like is the ability to require oauth for authorization through something like facebook. I'd use it as an extra layer of confirmation that the owner of the account is a person.
     
  21. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    That sounds great!

    I currently do not have plans for third-party integrations (they are a potential support "nightmare" because their development is beyond my control); the focus is more on improving and extending the core features of the kit. Custom mechanisms for authentication should be easy to implement on top of it.
     
  22. sabri2c

    sabri2c

    Joined:
    Nov 25, 2014
    Posts:
    5
    this is very good and useful especially separated Master server Game server and Auth server helps to understand how its works.
    i have an error message in AuthServer when click on Demo with authentication button in client.

    Unknown message ID 302 connId:1UnityEngine.Networking.NetworkServerSimple:Update()
    MasterServerKit.AuthServerRunner:Update() (at Assets/Network/Core/Scripts/AuthServer/AuthServerRunner.cs:43)

    btw server keep working after that error.

    also im trying to make my own mysql db provider can u pls explain to intproperty and strinproperty tables. i have no idea what they are.
     
    gamevanilla likes this.
  23. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for your kind words! :)

    And thank you for the report! I can confirm the error happens in the latest version available on the Asset Store. Fortunately, it is harmless and everything will continue working just fine. It will be fixed in the next update.

    The IntProperty and StringProperty tables are used for storing miscellaneous player data in the database. Each player can have properties linked to him that can be useful for storing game data that you want to persist across different sessions (e.g., coins, achievements, etc.). The database service class provides you with an easy-to-use API for reading from and writing to these properties.

    It is awesome to know that you are working on a MySQL database provider. Please feel free to get in touch with me if you think it could be useful to add it officially to the kit and I will be happy to help.
     
  24. sabri2c

    sabri2c

    Joined:
    Nov 25, 2014
    Posts:
    5
    ty for your clear answer. now i can complete my provider.
    my mysql db provider using php so i dont know if its good idea to add official. btw i can send u to codes if u want to take a look and decision is yours.
     
    gamevanilla likes this.
  25. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    You are welcome, and thank you!

    I certainly agree with you in that officially introducing a PHP web service may be a bit too much.
     
  26. carsenk

    carsenk

    Joined:
    Jan 13, 2016
    Posts:
    85
    Does the Node.JS/MongoDB PersistentDataServer/PersistentDataServer.zip include the previous Rankings, Currency, etc. that was previously developed in earlier versions of CCG Kit?
     
  27. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    No, it does not. Some of these features may be added to the kit in the future in a game-agnostic way though.
     
    carsenk likes this.
  28. carsenk

    carsenk

    Joined:
    Jan 13, 2016
    Posts:
    85
    So is it currently possible to use the old code and modify it? Or would it need the client changes as well?
     
  29. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    It should be doable with some tinkering or, alternatively, using the player properties system in Master Server Kit.
     
    carsenk likes this.
  30. carsenk

    carsenk

    Joined:
    Jan 13, 2016
    Posts:
    85
    Awesome, I havent looked into the player properties or anything much yet but I will be sure to. I'll try bringing over the old code to potentionally, thanks again, keep up the hard work!
     
    gamevanilla likes this.
  31. carsenk

    carsenk

    Joined:
    Jan 13, 2016
    Posts:
    85
    Yea you should really add Rankings and Card Packs/Currency back into the script, unless you could send me the changes to reintegrate it, but so much has changed....and those are some of the most important features

    Currently I mainly need an updated GameUtilsWindow.cs

    Would this be correct for the openpackdialog window?
    Code (CSharp):
    1.     public static void OpenCardPackDialog(List<int> cardIds)
    2.     {
    3.         WindowManager.Instance.OpenWindow("CardPackDialog",
    4.             () =>
    5.             {
    6.                 var cardPackDialog = GameObject.Find("CardPackDialog").GetComponent<OpenCardPackDialog>();
    7.                 cardPackDialog.SetCardData(cardIds);
    8.             });
    9.     }
     
    Last edited: Jan 16, 2017
  32. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Master Server Kit is intended to be used with different types of games, so I do not plan to add CCG-specific functionality like card packs to it.

    I explained the reasoning behind the decision to remove the optional Node.js server from CCG Kit here and here. It basically made the setup more confusing to a majority of the users, so it made more sense to move the functionality to the Master Server Kit integration (specifically, the generally useful functionality like player registration and authentication). CCG-specific functionality like card packs will also come back, but will probably do so in a server-agnostic way that is more accessible. You can always keep the old version if you want to, or try to reintegrate the changes into the new one (but you will need to do that yourself, as I do not have a complete list of the changes that were made between both versions). Thank you for your understanding and your kind words!
     
  33. LostPanda

    LostPanda

    Joined:
    Apr 5, 2013
    Posts:
    173
    @Spelltwine-Games Support NAT punch-through?
    I have another question? A few of players in China and some in other countries, how should I do?
     
  34. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    NAT punch-through is used when you want to connect players directly to each other (player-hosted games), and Master Server Kit is all about connecting players through a dedicated server (server-authoritative games). This is the reason why there is no support for NAT punch-through: it is a completely different use case than the one intended for the kit. If you are interested in that kind of functionality, there is an excellent asset created by @thegreatzebadiah that you can leverage called NAT Traversal.

    Regarding your second question, I am not completely sure I understand what you mean. You can play with players all over the world already, as they are all connecting to the same master server. If you mean having different servers per region and region-based matchmaking, stay tuned for the next update. :)
     
  35. NFMynster

    NFMynster

    Joined:
    Jul 1, 2013
    Posts:
    69
    Hello, a couple of questions if you don't mind!
    What is required to host the master server myself? Don't I just have to open the ports used and are there any security issues with hosting it yourself?
    You keep mentioning that this is not for player hosted games, so let me get this straight, if I want my players to create games and find eachother via a masterserver, this is not the asset for me?
    I don't want my players to port forward themselves, and at first glance it seems like this does all the work for them, by using the master server, is that not correct?
     
  36. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    You will need a server machine with a public IP address (and the ports used by the kit open). I use a $5/month Digital Ocean VPS with Linux myself for the demo and for development purposes. For production, you probably want a dedicated server. You will generally not be able to use your own development computer for this purpose because it will not have a public IP address, but you can still use it for testing things locally during development (I do this all the time).

    When I say player-hosted games, I specifically mean games where the logic of the game happens on the side of the player hosting the game (this is what you have with Unity Services), so they are bound to cheating. With Master Server Kit, the logic of the game happens on an independent game server. Of course you can use the kit to create new games and find existing ones, that is the entire purpose of it. :)

    You can think of Master Server Kit as providing similar functionality to the matchmaking available by default in UNET, but happening on a dedicated server you are in control of. Players are not connected to each other directly (via a relay server or NAT punch-through) but indirectly through an independent game server with a public IP address that they can simply connect to.

    I hope this helps! Please do not hesitate to let me know if you have any further questions and I will be happy to help.
     
  37. Red_Baron_

    Red_Baron_

    Joined:
    Jul 19, 2015
    Posts:
    8
    Hello! I bought this package and it's amazing! Now i integrate it to my game and i have a question: now player connects to master-server, after that connects to gameserver instance. But when player have connected to gameserver - he disconnected from masterserver. Is possible connect to master-server and gameserver simultaneously? Thanks!
     
    gamevanilla likes this.
  38. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for your purchase and your kind words! :)

    The player is actually not disconnected from the master server upon connecting to a game server; the connection to the master server is kept alive. You can see this in the Matchmaker class: the lobbyClient property stores the connection to the master server.

    I hope this helps!
     
  39. Red_Baron_

    Red_Baron_

    Joined:
    Jul 19, 2015
    Posts:
    8
    Thanks, i will research this. So, can Unity hold two NetworkClient connected simultaneosly?
     
  40. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Yes, no problem at all.
     
  41. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Hello! I have just submitted a new update to the Asset Store (version 1.06). This is the biggest update to the kit so far and is the result of the excellent user feedback I have received during the past few weeks. Thank you!

    These are the release notes:
    • Upgraded project to Unity 5.5.1.
    • Removed the authentication server and integrated its functionality into the master server.
    • Added the concept of zone servers, which allow you to distribute the game server load across different machines (useful for load balancing or region-based matchmaking).
    • Removed the configuration file. All the server settings can now be modified visually via the inspector.
    Whereas we previously had a single master server in charge of spawning new game server instances as appropriate, this update introduces the concept of zone servers. Zone servers register themselves automatically into the master server and are a useful abstraction that allow you to distribute the game server load across different machines, meaning you can have several zone servers running different subsets of all the available game servers. This is a more flexible approach that will enable more advanced networking mechanisms on your games.

    The update should be available on the Asset Store in a few days, but if you would like to have it earlier just contact me privately with your invoice number and I will send it to you.
     
    LostPanda, carsenk and SwiftIllusion like this.
  42. SwiftIllusion

    SwiftIllusion

    Joined:
    Jan 22, 2012
    Posts:
    66
    @Spelltwine-Games with this update, I'm not sure if I'm understanding it correctly, but will it still be able to dynamically create room instances for games that require them? Are the instances now created within zone servers, that can be loaded onto other machines in addition to the singular running master server?
    So for example rather than having to separate player accounts across multiple master servers in the potential case of a significant amount of players, now you can just separately host additional zone servers, and everyone will still be able to matchmake across this with room instances in for example a card game?

    Also would it be possible with Master Server to have a new player join a closed instance later as an observer with some specifically different aspects for them, e.g. in the case you wanted to have a player be able to observer both sides of a card game/from a different angle for the purpose of commentary after being given a password by the players in the instance?
     
  43. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    That is exactly right. You can still create rooms dynamically just as you could before; nothing has changed in that regard. What has been introduced is the concept of zone servers, which allow you to distribute the game servers across different machines. You are free to use only one zone server, and everything will work just as it did before. But, in addition to that, now you also have the possibility of using multiple zone servers, which is very useful if your game load requires it (while still having a single master server). The basic workflow goes as this:

    - You launch the master server.
    - You launch as many zone servers as you need to. They will automatically register themselves in the master server.
    - When a player requests the creation of a new game, the master server will choose between all the registered zone servers and request the creation of the game to the chosen one (and the selection process is an operation that you can override as appropriate). When the game server instance is spawned, it is automatically registered in the master server so that it is eligible for matchmaking.

    As you can see, zone servers are a new level of indirection which help implement new networking scenarios. They are very useful for room-based games, but you are not forced to use them; you can also spawn independent, persistent game server instances that will automatically register themselves in the master server for world-based games.

    Another interesting new feature are server properties. Your zone server can have properties (a pair consisting of a name and a value), and these properties will be inherited by all the game server instances spawned by that zone server. For example, you could have the following configuration:

    Zone server US
    Properties: "Region" = "US"

    Zone server EU
    Properties: "Region" = "EU"

    And implement load balancing and region-based matchmaking.

    Or maybe:

    Zone server A
    Properties: "GameType" = "A"

    Zone server B
    Properties: "GameType" = "B"

    And have different zone servers running different types of games (each zone server can launch a different game server binary).

    Stay tuned for the upcoming updates to the official documentation, where I will explain how everything works in more detail and how some common use cases can be implemented.

    Regarding spectators, there is currently no direct support for them in the kit. It could be interesting to add it though; I will think more about it. Thank you!
     
    LostPanda and SwiftIllusion like this.
  44. SwiftIllusion

    SwiftIllusion

    Joined:
    Jan 22, 2012
    Posts:
    66
    @Spelltwine-Games That's a seriously incredible addition, awesome work!!
    And thanks so much for the more detailed breakdown of how it works :).

    Thanks for also at least considering the option for spectators too :).
    As just an idea of implementation that could help it reach broad/basic usage, maybe being able to set a matchmaking observer limit in addition to the player limit. Then when the players join they could access their instance ID (e.g. I could use get.instanceID to set a UI element to show that), then a player could press a button to install call 'joinmatchobserver(ID)' and when the scene loads you could check their an observer via something simple like (playerid>room limit) or something.
    Anyways that's just a broad idea and I can certainly understand there may be more important thinks so thanks again for at least not dismissing the idea immediately :).
     
    gamevanilla likes this.
  45. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for your feedback! And definitely noted. :)
     
    SwiftIllusion likes this.
  46. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Version 1.06 is now available on the Asset Store!

    These are the release notes:
    • Upgraded project to Unity 5.5.1.
    • Removed the authentication server and integrated its functionality into the master server.
    • Added the concept of zone servers, which allow you to distribute the game server load across different machines (useful for load balancing or region-based matchmaking).
    • Removed the configuration file. All the server settings can now be modified visually via the inspector.
     
    LostPanda likes this.
  47. fieldrequired

    fieldrequired

    Joined:
    Feb 26, 2014
    Posts:
    108
    Hey so, I bought the framework - great asset very well structured.

    Regarding the storing of user information, characters and the like. I envisage doing it by serialising the data class (using JSON) and storing it in the database as a string. I've spent a good few hours tapping through the various classes and interfaces and before I start butchering this thing into submission - have you added any way to handle custom fields and the passage of data in the SQLlite DB? Is there anything inherently wrong with my suggestion if not?

    I would have thought this would have been accounted for, hopefully it has but not been documented. Because I mean, the whole reason for having a user authentication system is to store persistent player data between sessions is it not? :)

    Anyways, thanks again for a great asset!
     
    Last edited: Feb 11, 2017
    gamevanilla likes this.
  48. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for your purchase and your kind words! :)

    You can store custom user data indeed. More specifically, you want to look at the DatabaseService class and the GetStringProperty/SetStringProperty methods. There is some general information here in the official documentation, but I also plan to add usage examples to the newly created Guides section.

    Please do not hesitate to let me know if this is useful or if you have any further questions and I will be happy to help.
     
  49. LostPanda

    LostPanda

    Joined:
    Apr 5, 2013
    Posts:
    173
    thanks very much and wait update!
     
    gamevanilla likes this.
  50. LostPanda

    LostPanda

    Joined:
    Apr 5, 2013
    Posts:
    173
    @Spelltwine-Games run demo connect error (in beijing china)

    Log: cannot connect after 10 attempt address {::ffff:104.131.5.7:8000}
     
Thread Status:
Not open for further replies.