Search Unity

Master Server Framework

Discussion in 'Assets and Asset Store' started by alvyxaz, Sep 11, 2016.

  1. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Yeah, I guess HTTP doesn't suit many games.

    However, instead of UDP, you should probably use TCP. If you use UDP to send reliable and ordered messages, it's better to use a protocol which was designed for it ;)
     
  2. KerfuffleMonkeyGames

    KerfuffleMonkeyGames

    Joined:
    Jun 27, 2016
    Posts:
    9
    Good point - it's been literally a couple decades since I've had to delve into low-level transport protocols; I'll need to do a bit of refreshing research.

    Edit: RTFM! "Spawner starts game executable with command line arguments"
    I've got a couple newb questions (I've only been using Unity for a year). I'm a bit unclear on the relationship between the spawner servers and the game servers. Are the game servers separate from the spawner servers, and if so, does at least one game server (Unity program) need to be running and registered with a spawner server? (And I assume the number of Max Spawns setting determines hoe many game servers can be spawned).

    Oh, another one: the number of ports limitation on a server. If 1024 - 65535 are available to the master server, isn't it possible for that to be a bottle neck if that many clients are connecting to it? Not that I'm in danger of reaching that number of players, I'm just curious.

    Oh, yet another one, sorry: I see mention of AES and RSA; are connections between client/server using SSL or another encryption protocol for secure communication by default?

    Thanks again for your time.

    KM
     
    Last edited: Jan 3, 2017
  3. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Ports are not assigned per connection. When you start a server on a specific port, you allow people to connect via that port. This means that when you start a server on, for example, port 5000, any number of people can connect to that port, and only that port will be used ;)

    By default, encryption is only used for login / registration, because other functionality of the framework does not need to send "secret" data :)
     
  4. KerfuffleMonkeyGames

    KerfuffleMonkeyGames

    Joined:
    Jun 27, 2016
    Posts:
    9
    Perfect, thanks for all the information!
     
  5. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
  6. September9

    September9

    Joined:
    Jan 20, 2016
    Posts:
    20
    Hi.
    I bought your asset. It works great in local network.
    However, when I tried to connect to your server(104.236.226.56), the player doesn't come out.
    Even I can find the game room in your webgl demo.
    I am not a professional coder. Could you let me know what I missed?
     
  7. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Hey, thanks for your purchase!

    That might be due to a number of reason, and it's hard to say without debugging it. Overall, you should not use the master server that I've hosted, and instead you should host one yourself. My server is using a slightly different version :)
     
  8. Ludopathic

    Ludopathic

    Joined:
    Dec 21, 2016
    Posts:
    12
    Hi there,

    I just purchased the master server framework and I am trying to get defined in my mind exactly what I need to do to get it to work for my purposes. I wanted to run a few things by you so you might help me set up my project development structure properly and I don't go chasing the wrong idea. First I'll explain what I'm trying to do and what I am assuming, then I'll explain the snags I hit.

    I am trying to create a MOBA Client that allows the user to login with custom authentication, then go to a menu screen where he is able to invite friends to join an automatically created lobby and search for a match or to search for a match by himself and be added to a game with other players. Chat should be integrated and I will work on also implementing a PM system. At the moment there is no game to spawn into aside from an empty map because I need to get this backend working before I can go into character select etc...

    My assumption is that to get this to work:

    1. I must create a client that connects to the server and passes the details from my custom login in order to set up that user's persistent profile on the server. I need to add to the scene an empty game object with the Master Server Connector script and (aside from user login details) it should connect to the server using the specified address and port.

    2. The server requires that I attach the Master Server prefab with the modules, the Game Server Starter prefab, the SpawnServer, connector and log controller into empty game objects in a seperate unity project in their own scene.

    3. The Game Server requires assets from Master Server Framework to be present in order for the Client and Master Server to communicate with it (which ones?)

    The snag I hit currently comes to building the demo - it runs fine in the editor but the "Master Server Running" in the HUD is not highlighted. I am able to run the demo as normal though which is strange.

    When I build or run the server as mentioned in 2 above, the HUD indicates that the server is running only in the editor, if I build the scene I get no indication anything is running. If I try to connect with my client, no connection seems to be made (the hud indicator saying the server is running does not change when I try to connect.)

    The other snag is that the connector with the asset for connecting clients to gameservers is based on unet and I am unsure how to create a connector that will work with Bolt.

    I do realise this post is basically asking you to hold my hand but as a newcomer to networking this would be greatly appreciated!
     
  9. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103

    Hey!

    Damn, apparently I've pushed the wrong build to the asset store :/

    I've updated the "Launching The Demo" wiki with a warning to change the IP address:


    I'll send you a PM with more info in a few hours, because I'd prefer this forum thread to be clean'ish, and I don't want people subscribed to it to get constant notifications ;)
     
    Last edited: Jan 8, 2017
  10. Ludopathic

    Ludopathic

    Joined:
    Dec 21, 2016
    Posts:
    12
    Sure no problems. I think I have to repeat the question from earlier in these forums - are you god?
     
  11. angusmf

    angusmf

    Joined:
    Jan 19, 2015
    Posts:
    261
    Hi, I read a good half of this thread and skimmed the rest and feel fairly confident my question wasn't already covered.

    With all your dire warnings about this being a framework, and requiring a dev behind the keyboard fully in mind, how "hard" would it be to extend the framework so that it could serve different games? That is, if I had a game where the player shoots the ball with a gun, and another game where the player shoots the gun with a ball, requiring at least some differences in player profile data and other interfaces, would I find that MSF is already well prepared for this, or would it require major new layers of interface to be added?
    Thanks!
     
  12. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    I wish I were, haha. The whole thing is actually not that difficult to make ;)

    Hey!

    I don't think you'd have any problems with this. The framework does not interfere with how you setup your game servers or what you use to run them, so from the gameplay perspective - anything is possible.

    If I understand correctly, you want to use single master server for multiple games? It's a bit hard to tell, but I don't think there should be any problems with that. Regarding the profiles, you can add as many values to them as you want. If you need something very "custom", it's not too difficult to write your modules for new functionality :)
     
  13. angusmf

    angusmf

    Joined:
    Jan 19, 2015
    Posts:
    261
    Thanks for your response! Sounds promising. I'd like to be able to use this on Android, extending as necessary. You specifically call out Windows and Linux as host environments, so I wondered if there are any hard limitations that would prevent it from working. The spawn server would come out pretty different...
     
  14. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    It depends on what you want to do with the Android. Do you want to host spawner and master server on Android? Or do you only want android users to be able to connect to master server and play games, hosted (spawned) on your machines (VPS'es and etc)?

    Hosting servers on Android might work in theory, but in practice - it would be highly inefficient, and would cause connectivity problems.

    There are a few people using the framework to host servers on Linux, and then they can access them to play on Android. Android devices can create game rooms (by requesting a server to be spawned on your VPS/Dedicated machine), and play in them. UI is not specifically designed for mobile devices, but I've tested it, and it works :)
     
  15. Ludopathic

    Ludopathic

    Joined:
    Dec 21, 2016
    Posts:
    12
    By the way, I sent you a reply to your PM. Hope all is well.
     
  16. angusmf

    angusmf

    Joined:
    Jan 19, 2015
    Posts:
    261

    Thanks again.The idea is to be able to use a raspberry pi as a game server, spawner and host. I have a few simple games I'd like to be able to host from small/cheap hardware in a public place. Clients would connect via android/ios or webgl. The pi would probably only host one game at a time. I suppose it's possible to use a small farm of them, but at that point, might as well have an x86 box sitting around.

    edit:
    Thinking a little further, the closest to what I want would be your game server server running in the cloud, and when the pi boots, it would "register" itself as a place where games can spawn. Clients would get routed to the local pi by the cloud server when they connect and authenticate.
     
    Last edited: Jan 9, 2017
  17. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Got it! I totally forgot about the existence of Raspberry pi'es, haha.

    I'll send you a PM to discuss further ;)
     
  18. September9

    September9

    Joined:
    Jan 20, 2016
    Posts:
    20
    Hi.
    After updating, game server window is showing up when I start game. (not running background)
    I checked player setting already. I just guess it is not a bug, you made this change for certain reason I guess. But I don't know how to change it. How can I run the game sever in the background just like before?
     
  19. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    I'm guessing you're referring to the game servers that are "Spawned"?

    In this case, Spawner Server has an property "Run In Batch Mode". Checking it will make sure that a new process will be running in background (batchmode) ;)

     
  20. September9

    September9

    Joined:
    Jan 20, 2016
    Posts:
    20
    Thank you.
    And I finally succeeded in hosting Linux server using Digital Ocean.
    It works great. Actually I spent a lot of time to figure out port configuration and linux Path.
     
  21. Ludopathic

    Ludopathic

    Joined:
    Dec 21, 2016
    Posts:
    12
    I did exactly the same thing - Rpi's are great for practicing networking and optimizing your server to run on minimal specs. I bought an Rpi3 for the same reason. You will however run into one major problem which is that when you come to migrate your database and master server you will run into issues with compatability between the software compiled for armx86 architecture and software compiled for x86. You may even run into difficulties trying to get servers running on the rpi (especially if you are trying to run webgl servers on a headless pi) unless you really know what you are doing. Even then it's not really worth it considering you have to recompile for x86/x64 when you decide to go back to vps.

    My personal advice is to find the cheapest vps you can (www.firstheberg.com has vps for 1.50 a month...) and get set up there for a fifth of the price of a new rpi.
     
  22. alex-mircea121

    alex-mircea121

    Joined:
    Jul 11, 2012
    Posts:
    15
    Hey!
    The plugin works great but I have a little problem regarding the properties of the server. When trying to get the properties of a room found by a room request I can't get all properties. I get just the "map" key but not my custom ones. Do Have to add them separately or..?:)
     
  23. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Hey! Sorry, I somehow missed your post :/

    Originally, I didn't want to send all properties in case developers put something "secret" there.

    Change your GamesModule.cs script with this: https://gist.github.com/alvyxaz/bc6ce125be3e88c2005d0f9ee99b8eb5

    This will add a "SendPlayersAllGameProperties" field, which will make sure all of the properties are added. This change will be available in next release of the framework ;)

    Thanks for sharing this! I'm adding this VPS to my bookmarks, haha
     
  24. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    Looks great, great start point in network programming, but why no Unity 5.4 support?
    Only for Unity 5.5? It is still buggy as hell o_O
     
  25. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Hey!

    To tell you the truth, I upgraded to 5.5 accidentally - wanted to quickly check out what's new, and didn't notice that I'm actually working on the 5.5 the whole time :/.

    If there are more people who want to use 5.4, I guess I should try to rebuild from V1.02 (which supported 5.4)
     
  26. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128

    So far I planned to start programming the same Master Server stuff, but your asset just saved me a lot of time :)
    Stay tuned for feedback after I get deep into it ;)

    Short stupid question - if I use a web server for players registration, do you have a module to make a shttp requests to it for login authorisation? Or it should be a local server?
     
    Last edited: Jan 25, 2017
  27. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Sorry, I didn't see that you've edited your post!

    Nah, there's no extra functionality for the http / https requests, though, unity has some internal stuff to work this out.

    It should be fairly simple to extend authentication module and add a new handler for a custom login request, which would call your web server
     
  28. erainero

    erainero

    Joined:
    Aug 21, 2013
    Posts:
    4
    Hi

    Just purchased the asset and ran through the From Scratch documentation. Everything worked perfectly.

    Small bug in the wiki documentation.

    From Scratch. Creating a basic Master Server
    Step 5
    Drag a prefab from Barebones/MasterFramework/Prefabs/Ui/LogController to the scene
    - it is not in the Ui folder. it is in the parent Prefabs folder.
     
  29. erainero

    erainero

    Joined:
    Aug 21, 2013
    Posts:
    4
    BTW

    I wanted to try out the "Game List" component. I dragged it to the scene but nothing was visible.
    Could you provide a basic description of how to wire it up please?

    (Optional) "Games List" component

    Framework contains a prefab that retrieves a list of available games. You can find it at Barebones/MasterModules/Games/Prefabs/GamesList. You can use it, extend it or create your own​
     
  30. erainero

    erainero

    Joined:
    Aug 21, 2013
    Posts:
    4
    I added it to the canvas.
    1st issue was that the prefab was not enabled. Fixed that.
    Now debugging why refresh doesn't populate even though there is a room list with a room.
    Missing black background as well. Still investigating.
     
  31. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Hey! First of all, thank you for the purchase, and thanks for reporting the error in documentation ;)

    Regarding your latest issue, if refreshing the list still doesn't populate data, it's either because you're not connected to master server, or because the game server has not marked itself as "open".

    Check out this guide, "the client side", and try to create a "Get Games" button as in the example, and see if it returns anything :
    https://github.com/alvyxaz/barebones-masterserver/wiki/From-Scratch.-Adding-Games-Module

    Also, It would be really great if you could report issues to the GitHub issues section:
    https://github.com/alvyxaz/barebones-masterserver/issues

    Many people like to read through the forum before purchasing, so I think it's best to have technical discussions in the GitHub to keep this forum shorter :)
     
  32. erainero

    erainero

    Joined:
    Aug 21, 2013
    Posts:
    4
    Thank you for the quick reply.

    Happy to report issues on github.

    Great support!

    PS I'll continue the issue discussion on github today. This is working with the client getting started project.
     
  33. Deleted User

    Deleted User

    Guest

    Totally want to leanr this....but , *gulps* no Mac version? This true??
     
  34. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    its work very well on mac since 1.03
     
  35. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Hey guys! I'm working on the v1.04 update, with which I'm aiming to make the framework easier to use, and I realized that I can't do too much without your input on the matter.

    Please, let me know your opinions. You can write a post in github, send me an e-mail, PM, or just write here. For more info:
    https://github.com/alvyxaz/barebones-masterserver/issues/41

    Had I known how active you'll be, I would have given you the framework for free, haha
     
    LostPanda likes this.
  36. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    Looks great ! Go on !
     
  37. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Copy from the announcement in the GitHub Wiki:

    EDIT: Now that I've started working on V2.0, I can see that it's going to be BEAUTIFUL.

    V2.0 announcement

    As you might have heard, I was recently working on v1.04 (which was supposed to make the framework easier to use, for both beginners and advanced developers). While working on it, I've tried to minimize the amount of breaking changes, but realized that to make meaningful changes, a large amount of breaking changes is unavoidable.

    Today, I know much more about how you use the framework than I did when I first started working on it. Now, I can use this knowledge to make it greater.

    How long will it take, and how much will it cost?
    My estimate is about 2 weeks - probably until the 27th of February. And it's a free update.

    I'll try to release testable versions earlier, so that those of you who are interested in the process can give me feedback, or just see what to expect from v2 early on.

    What will the new framework look like
    • Main focus on simple to use API
    • Multithreaded database accesses - accessing db is currently the most resource-intensive work
    • Single port for all connections
    • Core structure will remain the same - there will be master and spawner servers, and master server will remain to be modular, so most of your custom scripts and modules should still work, or work with minimal changes
    • Underlaying Networking API will remain the same
    • Scripts to ensure that servers, after crashing, can be started again automatically
    • Reduced interference with your game code
    What if I have a project in production with current version?
    There are two options:

    • Upgrade from v1.03 to v2 - most likely, it will not be too difficult to upgrade, unless you've got a huge amount of custom extensions
    • Keep using the v1.03 - it's stable, and if you don't want to upgrade - you don't have to.
    What about development until the V2 is released?

    If you're just starting and if you can wait a bit, I recommend to wait until the V2.0 is released.

    If you're already familiar with V1.03, you can keep working on your project with it, and upgrade later on. Don't think that it's a waste of time working with something that will be replaced soon - upgrading should not be too difficult, and most of your custom functionality will remain the same
     
    Last edited: Feb 11, 2017
    LostPanda, Sorn and Tiny-Tree like this.
  38. viktorgullmark

    viktorgullmark

    Joined:
    Feb 5, 2017
    Posts:
    2
    Neat announcement!

    Been following this framework, since I'm in the process of starting development of my own game. I've just started learning Unity as well.

    I saw you noted that it should probably be pretty straight-forward to upgrade. In my case though, since I just pressed "New Project" this afternoon, do you encourage me to buy it now and get started with V1.03, or wait for the full V2 release? You seem to be great at responding at questions and supporting people, which gets me curious about buying it now and get started with V1.03 :)
     
  39. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Hey!

    I'd say that if you can wait, it's better to wait until the release of V2, unless you're already familiar with V1.03.

    I'm recommending to wait, because it would take some time to learn V1.03, and by the time you learn it - you'll have to spend some time switching to and learning whats new in V2.

    By the way, I'm planning to upload the core/preview of V2 to private GitHub repository within a week or 4-5 days, so it will be possible to start working with it a bit earlier than the full release. ;)
     
    Tiny-Tree likes this.
  40. viktorgullmark

    viktorgullmark

    Joined:
    Feb 5, 2017
    Posts:
    2
    Awesome, thank you for your reply. I'll take your recommendation and wait. Got plenty to work on in the meantime.

    Can't wait for it. Would gladly take part of the preview if possible!

    Keep up the good work :)
     
  41. StaticGame

    StaticGame

    Joined:
    Feb 12, 2017
    Posts:
    5
    Hi,I want use Unet to do a game based on the room model (tower defense game) . I do not care about the full authority, just need it to connect the players in different places , like PUN (the price is too high for me)or Unity MultiPlayer(no server in my region, the delay is very bad). Is this asset for me ?Thanks:)
     
  42. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Hey!

    Yes, If I understood correctly, this asset is perfect for what you want to do ;).

    However, I would recommend you to wait a bit until the V2.0 before buying - I'm making some drastic changes, and it's going to be a lot easier to use.

    Or you can buy it earlier. I'll release a preview of V2.0 in a few days into our private GitHub repository, so you could start working with it a bit earlier ;)
     
  43. fieldrequired

    fieldrequired

    Joined:
    Feb 26, 2014
    Posts:
    108
    This is one of those assets where I buy without thinking twice because you can feel the passion coming from it just by looking at the store page. Opening it up and working through your wiki doesn't fail to impress either.

    I just couldn't wait so i'm going to start on implementing 1.03, hopefully the leap to 2.0 isn't too drastic but i'm having fun anyways so won't complain! Cheers for making this simple!!
     
  44. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Hey!

    I just got back to reply to your original post, and found it changed, haha. Thanks a lot for the purchase!

    Regarding the host migration, the biggest problem will be handling the migration of gameplay within uNet. Host migration is quite difficult to do, especially on more complex games, but if you can manage it, I think we can find a way to "overtake" a registered game. At the current release, when game server disconnects, game is removed from the list. I never thought about this use-case, but I think it would be worth implementing something into V2.0 that achieves that out of the box :)

    Well, V1.03 compared to V2.0 feels like a labyrinth. What I'm doing with V2.0 is actually what I wanted to do originally for my first release, but I kinda lost track in all of the "automation", and made a bit of a mess with it. On top of that, feedback and knowledge I gained by providing support helps me to make a lot better decisions, that I couldn't make when I first started.

    I would recommend you to wait for the V2.0, as I don't like how complicated the 1.03 is :)
     
    fieldrequired likes this.
  45. fieldrequired

    fieldrequired

    Joined:
    Feb 26, 2014
    Posts:
    108
    Yeah I did a little research into host migration and figured that actually it's better that I just optimise my pathfinding. Plus the authoritative server will do wonders for anti-cheat, combating lag and overall management so it's a no brainer!

    Even with the optimisations i'm looking at 150mb-350mb RAM per instance, probably enough for 200 CCU on a mid/high-tier VPS. The infrastructure manager in me likes to think ahead to high utilisation scenarios (if not load distribution across the continents,) how easily separated from the DB/Main Server are the Spawner/Game Server instances?

    Another thing I thought of is how are we handling password resets? I appreciate sending a reset e-mail is outside of the scope of the asset, but considering the users password is buried encrypted in SQL we're gonna need some way to do it.

    Meant what I said, i'm particularly impressed with the fact it just works over WebGL - well actually i'm very very impressed.

    How far off is a sneak peak at 2.0? I can tell by how excited you are it must be a substantial improvement. I fear it might take you a little while to catch up on documentation...
     
    Last edited: Feb 12, 2017
  46. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    for the password reset as i understand if its an sql file you can probably make a quick php file on the same server to deal with this
     
    fieldrequired likes this.
  47. StaticGame

    StaticGame

    Joined:
    Feb 12, 2017
    Posts:
    5
    Thank you for your reply,I already bought it.looking forward to your 2.0:)
     
  48. fieldrequired

    fieldrequired

    Joined:
    Feb 26, 2014
    Posts:
    108
    Thanks, actually it looks like it's using LiteDB as the backend by default (unless alvyxaz plans to change that in 2.0) I wonder if there's a similar mechanism...

    Really hard not to dive into 1.03 and start tinkering haha plenty to be getting on with in the meantime though for me :)
     
  49. jstoeffler

    jstoeffler

    Joined:
    Oct 22, 2016
    Posts:
    10
    Hello,

    Your solution seems exactly what I need for my next game.

    I saw another script that seems to do exactly much the same thing as Master Server Framework: https://www.assetstore.unity3d.com/en/#!/content/71604

    Could you explain the difference (if any) so that I can make an informed choice ?

    Thank you very much.
     
  50. alvyxaz

    alvyxaz

    Joined:
    Mar 21, 2013
    Posts:
    103
    Hey! That's a good question, haha

    I'm changing many things for the V2.0, but after taking a quick look at the documentation, it seems like my framework is aiming to be more extendable, allowing to build complicated servers, and the asset in the link - smaller, but probably easier to setup :). Again, I haven't used it, so it's hard to say anything.

    If you're not in a hurry, before buying anything, I'd recommend to wait until I release a preview of V2.0 (within a week). It's going to be magnificent, haha

    EDIT: I removed offensive implications :)
     
    Last edited: Feb 22, 2017
    Tiny-Tree likes this.