Search Unity

[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
    Not familiar with Forge myself, but it sounds like it should be something doable with a bit of tinkering.
     
  2. aemxdp

    aemxdp

    Joined:
    Oct 13, 2015
    Posts:
    5
    Hi there, I'm considering buying Master Server Kit, but I don't have Unity Pro and after some searching still confused whether I can build dedicated server with it and deploy it in headless/batchmode/nographics mode on linux server without GPU. Is this all possible using Unity Personal only?
     
  3. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    It definitely is! There is absolutely no difference in terms of engine functionality between Personal and Pro nowadays.
     
  4. aemxdp

    aemxdp

    Joined:
    Oct 13, 2015
    Posts:
    5
    "Headless mode" checkbox in build menu is disabled for me, not sure if it's because not Pro, or some other reason. Yesterday in some discussion I saw something like "if you run non-headless linux build with batchmode and nographics it will still have graphic system initialization and some calls".
     
  5. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Is your target platform set to Linux (headless mode only works on Linux)? If it is, I cannot really think of a reason why the checkbox would be disabled. It should not be related to not having a Pro license, though.
     
  6. aemxdp

    aemxdp

    Joined:
    Oct 13, 2015
    Posts:
    5
    Yes, it is. When target platform is not Linux it's not displayed at all. Here is a screenshot.

    PS: It seems I seen somewhere that not only target platform should be linux, but also the platform where the build is happening, though there's no even official Unity for linux, only some experimental alphas. Maybe it also works on mac because it's kinda linux too.

     
    Last edited: Apr 3, 2018
  7. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    I actually generate all my Linux, headless builds from Windows most of the time. I just realized what the issue is: you just need to disable the Development Build option in order to be able to enable Headless Mode.
     
    aemxdp likes this.
  8. aemxdp

    aemxdp

    Joined:
    Oct 13, 2015
    Posts:
    5
    Wow, why didn't I try this... Thanks!
     
    gamevanilla likes this.
  9. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Hello! Version 1.15 of the kit is now available on the Asset Store. These are the release notes:
    • Upgraded project to Unity 2017.4.0 LTS (you can find more information about Unity LTS releases here).
    • Moved User class to its own file.
    • Breaking change: ClientAPI is not a static class anymore.
    Please note we have also moved the official documentation, which is now available here.
     
  10. farid13

    farid13

    Joined:
    Aug 25, 2016
    Posts:
    3
    Hello!
    I got this error trying to start on Ubuntu 16.04, seems like some libs are not installed:


    Stacktrace:

    at (wrapper managed-to-native) UnityEngine.Networking.NetworkTransport.AddWsHostWrapper (UnityEngine.Networking.HostTopologyInternal,string,int) <0x0006e>
    at (wrapper managed-to-native) UnityEngine.Networking.NetworkTransport.AddWsHostWrapper (UnityEngine.Networking.HostTopologyInternal,string,int) <0x0006e>
    at UnityEngine.Networking.NetworkTransport.AddWebsocketHost (UnityEngine.Networking.HostTopology,int,string) <0x000ca>
    at UnityEngine.Networking.NetworkServerSimple.Listen (string,int) <0x00050>
    at MasterServerKit.MasterServer.Start () <0x00146>
    at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <0x0005e>

    Native stacktrace:

    /home/far/tankist/Builds/servers/MasterServer_Data/Mono/x86_64/libmono.so(+0x98652) [0x7fd364bbf652]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x1138f) [0x7fd367fcb38f]
    /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7fd36717c428]
    /lib/x86_64-linux-gnu/libc.so.6(abort+0x169) [0x7fd36717e029]
    ./MasterServer.x86_64() [0x9b765b]
    /home/far/tankist/Builds/servers/MasterServer_Data/Mono/x86_64/libmono.so(+0xd8e88) [0x7fd364bffe88]
    /home/far/tankist/Builds/servers/MasterServer_Data/Mono/x86_64/libmono.so(+0x371fe) [0x7fd364b5e1fe]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x1138f) [0x7fd367fcb38f]
    ./MasterServer.x86_64() [0x14ac179]
    ./MasterServer.x86_64() [0xddb4c9]
    ./MasterServer.x86_64() [0xdc985f]
    ./MasterServer.x86_64() [0xde0f03]
    [0x403df24d]
    /home/far/tankist/Builds/servers/MasterServer_Data/Mono/x86_64/libmono.so(+0x3b356) [0x7fd364b62356]
    /home/far/tankist/Builds/servers/MasterServer_Data/Mono/x86_64/libmono.so(mono_runtime_invoke+0x67) [0x7fd364c64d20]
    ./MasterServer.x86_64() [0x977553]
    ./MasterServer.x86_64() [0x9dd874]
    ./MasterServer.x86_64() [0x9b313c]
    ./MasterServer.x86_64() [0x9b3355]
    ./MasterServer.x86_64() [0x9b3ae5]
    ./MasterServer.x86_64() [0x5efb74]
    ./MasterServer.x86_64() [0x7deff1]
    ./MasterServer.x86_64() [0x7df097]
    ./MasterServer.x86_64() [0x7df31f]
    ./MasterServer.x86_64() [0x457520]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xef) [0x7fd36716782f]
    ./MasterServer.x86_64() [0x45f988]

    Debug info from gdb:


    =================================================================
    Got a SIGABRT while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================


    $ uname -a
    Linux farid 4.4.0-119-generic #143-Ubuntu SMP Mon Apr 2 16:08:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
     
    Last edited: Apr 20, 2018
  11. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Please reach me here for technical support; this forum thread is exclusively for announcements and pre-purchase questions.

    Thank you!
     
  12. neounix

    neounix

    Joined:
    Jan 9, 2017
    Posts:
    28
    Hey gamevanilla,

    I'm currently working on a cybersecurity application where we create and manage game objects on a LAMP server, storing all the objects in MySQL via PHP. Then, we use cron to dump the objects in MySQL our MySQL table to a JSON file and bulk import this into Unity with a C# web call to the PHP script on the server. This works OK, but if it far from ideal, as we don't want to import the entire huge JSON file with 100 of thousands of objects each time a new object appears in the LAMP MySQL DB.

    We prefer to push the objects from the LAMP server to our Unity clients as they are created or modified on the LAMP server, without initiating the update from the Unity clients (the games). Does have the Master Server Kit have built in code to push server updates to the client (the Unity game). We were looking at using sockets and writing all of this code, but then I did an Asset store search and found your Master Server Kit.

    Is this "push from the server to the game-client" a built-in service provided in the Master Server Kit?

    Just in-case it helps, some details on our Unity cybersecurity app we are building are available here on ResearchGate.
     
  13. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    The kit is more focused on the player authentication, player data storage and matchmaking functionality that you typically encounter in room-based multiplayer games. In that regard, sending custom data from the server to the clients is definitely doable, but you would do that via UNET (e.g., network messages) rather than via some kit-specific protocol.
     
  14. neounix

    neounix

    Joined:
    Jan 9, 2017
    Posts:
    28
    Thanks gamevanilla,

    Yeah, I hear what you are saying. I'm thinking it may be best just to add a simple TCP server and client Mono code at this time using basic Mono and just avoid UNET NetworkBehavior altogether, since I don't need all that overhead, and I can simply accomplish what I need at this time sending JSON formatted position data to control a single game object and the following camera using a more simple TCP sockets approach.

    Thanks for your speedy reply!
     
  15. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    You are welcome! That sounds like a reasonable approach indeed.
     
  16. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    Hey there. I currently use Master Server Framework for my game, but I don't like the fact that the original dev just sort of took off once it went open source, so really there could be no more updates of any kind, there is no support, etc. Do you happen to know what kind of fundamental differences there might be between the two systems? From the outside and descriptions they seem nearly identical, but I am sure that is not the case.

    My game is an online RPG, I mostly just use it for the authentication and like that there is a connector within the game scene that automatically connects people up to the game once authed and all that fun stuff. I currently only use a single large world server that needs to remain persistent. Is that something your system can fairly easily do?
     
  17. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Having not used the asset you mention myself, I cannot personally speak about the differences between the two. As far as I can tell, they are two completely independent implementations of the more general master server approach to networking architecture.

    The game server component has a Is standalone flag that you can check if you want to manually spawn the server, which would be useful for world-based games. You can also uncheck the Close when empty flag to make sure the server is persistent and not automatically closed when no players are connected to it.
     
  18. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
  19. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    I have been considering removing Unity entirely from my server side and using a standalone console application as my server to increate compatibility with other 3rd party applications I wish to use that take advantage of things that Mono does not have implemented. Does your kit have the ability to run outside of Unity and with a 3rd party networking system such as DarkRift2 in that type of environment?

    My client side will remain in Unity of course and then connect via DarkRift (still deciding it that is the one I will use, but it is high on the list since I know it works in console applications) to the server, but am hoping to find something that can handle the client authentication and then send that over to the server to allow entrance to the game as it normally would if the server were running within a Unity instance.
     
  20. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    No; all the servers in the kit are Unity binaries that you run in headless mode.
     
  21. HobieKenobi

    HobieKenobi

    Joined:
    Sep 12, 2014
    Posts:
    10
    So this won;t work with Unity 5.6.4? I've been looking at this a while but now only 2017?
     
  22. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    That is right; the minimum version was recently bumped up.
     
  23. HobieKenobi

    HobieKenobi

    Joined:
    Sep 12, 2014
    Posts:
    10
    lol...no sale!
    so is this a Unity decision or your own?
     
    Last edited: May 2, 2018
  24. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Our own. With Unity 2018.1 coming soon, the recent announcement of LTS releases and the majority of the user base already on the 2017 family, it just made sense for us (particularly in terms of support).
     
  25. Skribble

    Skribble

    Joined:
    Oct 29, 2012
    Posts:
    16
    Hello there,

    I've been using the Master Server Framework solution for some time, unfortunately as mention above, the Dev is no longer active in the project. Now i'm looking for something similar and i've been watching this project for some time.

    I do have a question, do you have some sort of servers administration ? like for example, i have the Master server and the Spawner running in headless mode, and they keep spawning rooms or instances as the players need, but for me as a owner, there's a way i can see all those spawned instances, how many players each one has, map name, play time, scores, etc and the posibility to turn an instance off ?

    Great asset, i wish you guys don't let this one die.

    Best Regards !
     
  26. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for your interest!

    A server administration panel is not something provided by default in the kit, but it should be pretty doable to implement considering the master server has all the information needed. It is definitely a good idea.
     
    Skribble likes this.
  27. Skribble

    Skribble

    Joined:
    Oct 29, 2012
    Posts:
    16
    awesome thanks! also as far as i understand, you're Spanish right ?

    Lo cual haria las cosas mucho mas simples, soy de Costa Rica !

    Saludos !
     
    Last edited: May 11, 2018
  28. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    ¡Así es! :)
     
    IEdge and Skribble like this.
  29. jtesler

    jtesler

    Joined:
    Jul 19, 2017
    Posts:
    6
    I am trying to build a project using the network manager. For testing, I am trying to port the Unity networking demo at https://unity3d.com/learn/tutorials/s/multiplayer-networking to use Master Server Kit. In your demo example, you change scenes when the user connects by setting the Online Scene in Master Server Network Manager on GameServer. This also changes the scene on the client. In our project I would like to avoid changing scenes when connecting to the server, by leaving the Online and Offline scenes as null. This is how the Unity demo works, so it is not a problem with the Network Manager itself. When I leave the online scene null, the server does start, and OnStartServer does get called. However, the player never gets created, and the server objects never get copied to the client. Our actual goal is to run different scenes on the client and the server; I've confirmed that this works fine with the original Unity demo. (I know this sounds strange, but we just need the players and other dynamic objects synced without replicating the static environment at the server.) So is there a way to get Master Server Kit to work with Network Manager while setting Online Scene and Offline Scene to null?
     
  30. memorycode

    memorycode

    Joined:
    Nov 26, 2013
    Posts:
    1
    Hi,

    I purchased the MSK not that long ago and so far it has been hard to learn, but very intuitive once you get the basic concepts down - this is mainly due to my lack of experience with Unity's UNET api so nothing that I can really fault you for. My question currently is this: why would I need to use the NetworkManager? My game is fairly simple; each player has a character which they click to move around. I see that the NetworkManager provides useful functionality like autoCreatePlayer and I think that's exactly what I want - but wouldn't everybody? What is the reason for using & not using the NetworkManager?

    Thank you!

    Edit (a large one): after going through the Unity network tutorial found here, I also have a few more questions. As it shows player movement & syncing player movement using only UNet objects, I was just wondering if I was thinking about this in the right way. Since the NetworkBehavior easily controls the NetworkTransform and such, I wouldn't need to send a MSK "packet" handler to the server to sanity check their inputs, correct? Since this is built into UNet and is auto-synced between all clients and the server, I can just grab said object and perform sanity checks on it. But, for things that don't involve Unity objects but instead involve like getting a player's inventory, I would use a custom network protocol from MSK to be able to send and receive the information and change whatever on the client.

    Also, since I'm chock-full of novice questions, why not throw another one at you:

    My game involves many "rooms" while in a game server. Different players can be in different rooms and players need to see other players in the rooms, like an RPG (2D). My idea was to have each room as a sprite somewhere on the map and instead of loading seperate scenes for each room, just move the player across to the different room teleports. Would that make sense?


    Sorry for all the questions and confusions. I've never really delved into this sort of thing before but I'm enjoying it so far. I appreciate you for taking the time to read this & answer. Great work on MSK.
     
    Last edited: May 11, 2018
  31. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    I am not personally familiar with such a setup, but it is definitely possible that there are some differences in how the Network Manager behaves when running on the kit (e.g., this post). When running on Unity Services, the host player acts like the server and a client at the same time; when running on the kit, the server is a completely independent entity.
     
  32. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Maybe your game has a different concept of a player, or you have more complex scene management than the one provided by the Network Manager, at which point you may want to handle things manually yourself rather than forcing it into a use case it was not designed for.

    That sounds reasonable. Please note that custom network protocols are nothing more than UNET network messages; choosing them over HLAPI constructs is mostly a matter of personal preference.

    It could definitely make sense. The kit is game-agnostic; how you decide to structure the logic of your game is really up to you.

    No worries at all and thank you!
     
  33. Sphelps

    Sphelps

    Joined:
    Jun 9, 2013
    Posts:
    243
    The Database login info, were is it stored? On the Master Server?
     
    Last edited: May 12, 2018
  34. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Yes.
     
    Sphelps likes this.
  35. Sphelps

    Sphelps

    Joined:
    Jun 9, 2013
    Posts:
    243
    Dang wish I knew about the sale yesterday lol would have bought it :)
     
  36. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Sorry to hear that! Just so you know and in case a sale happens again in the future, we always announce them in our Twitter and in this forum thread.
     
    Sphelps likes this.
  37. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    is it possible to use -nographics -batchmode on windows :(
     
    Last edited: May 27, 2018
  38. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    As far as I know, yes. What is not available on Windows (only on Linux) is headless mode.
     
  39. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Okay.
    Thanks
     
  40. aranthel09

    aranthel09

    Joined:
    Jul 17, 2015
    Posts:
    66
    Can you please tell me if the asset comes with a out-of-the-box solution for matchmaking through queue and MMR? Like nearly most of the pvp games nowadays, hence League of Legends, DotA, CS:GO, Paladins, Overwatch, etc.
     
  41. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    It does not; the built-in matchmaking works very similarly to the one provided by Unity Services.
     
  42. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
  43. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Because you want to be able to connect to the server instances from the outside.
     
    twobob likes this.
  44. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    9000 is the zone server, the only connection to the zone server is the master server, so the connection goes from the linux to linux right ?
    then, why 9100, 8100 ?
     
  45. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    8000 to be able to connect to the master server. 9001 to 9100 to be able to connect to each spawned game server instance (as per the demo settings, where the zone server can spawn up to 100 game servers); each game server instance uses a unique port number.
     
  46. loslight1994

    loslight1994

    Joined:
    Jun 2, 2018
    Posts:
    3
    Hello, everyone. I purchased the asset recently.
    I follow the official tutorial and work perfectly on my computer with local ip 127.0.0.1
    but when i use public ip {118.xxx.xxx.xxx} (WAN ip) to listen the server in MasterServer Scene, it show errors below.

    1.libwebsocket init failed
    2.Cannot initialize web socket server
    3.Cannot open socket on ip {118.xxx.xxx.xxx} and port {8000}; check please your network, most probably port has been already occupied

    I'm sure that i'm not occupied the port 8000
    I already set port-forwarding, close firewall....everything i can do.

    It still show the errors.

    But when i change ip back to 127.0.0.1, everything works fine.

    Could anyone help?
     
  47. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    You want to use your personal computer only for testing purposes and always pointing to localhost (127.0.0.1). When the time comes to deploy, you will need a dedicated server or VPS with a public IP address.
     
  48. loslight1994

    loslight1994

    Joined:
    Jun 2, 2018
    Posts:
    3
    I also tested on my Google Cloud Plaform Ubuntu Server 16.04

    I also follow the step below

    • Configure your server settings in the appropriate components located in the MasterServer, ZoneServer, GameServer and GameClient_Start scenes. Change the IP address fields to point to the public IP address of your server. You will also need to change the value of the Path to binary field in the Zone Server component so that it contains the path on your server where the game server binary is located. In our server, that would be game_server.x86_64.

    When i run the master Server by input
    sudo ./MasterServer.x86_64 &
    It showed same errors on start.


    It seems that it cannot listen the public ip, why?
    p.s. port-forwarding already set.
     
    Last edited: Jun 2, 2018
  49. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    I cannot possibly be more specific than the error message: "Cannot open socket on ip {118.xxx.xxx.xxx} and port {8000}; check please your network, most probably port has been already occupied". Having said that, please use the official contact form for technical support requests; this forum thread is exclusively for announcements and pre-purchase questions. Thank you!
     
  50. loslight1994

    loslight1994

    Joined:
    Jun 2, 2018
    Posts:
    3
    Thank you for your reply.

    I finally solved my problem by myself.
    Now, demo scene running on my Google Cloud Platform Ubuntu Server 16.04 with public ip perfectly.
    Also, running on my personal computer with public ip perfectly.

    The asset is Great.
     
    gamevanilla likes this.
Thread Status:
Not open for further replies.