Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Dedicated Server Kit: Online matchmaking for Mirror (and more!)

Discussion in 'Assets and Asset Store' started by gamevanilla, Jul 1, 2020.

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

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    Hey so here's a prior to purchase question from me. I'm a PUN veteran but recently switched over to Mirror for obvious cost optimization reasons. And I'm also well versed with server administration. Maybe not a systems engineer but still, I can find my way around.

    From your documentation, I gather that you need a user table for handling rooms. I also use another asset called Combü (Combu) for handling my server backend. It basically is an ORM for a DB. I know you answered this earlier but I'm just trying to clarify something;

    Here goes the question: Can I remove the authentication without changin anything on your code or do I still have to use my user table, replacing yours? In other words, does the room system depend on user data on the sql table?
     
  2. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    The only part in the game room management handlers that is related to the user is the check that verifies if the request is valid (by checking the passed JSON token that was generated after authentication). The room management logic itself does not depend on any user information.
     
  3. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    Call me dense but I still don't get it :D Let me ask it more directly; Do I need to supply a user table or not for your asset to work?
     
  4. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    Also, your documentation doesn't state anything on this but I'm on a windows server. Can I configure your asset to launch windows server builds instead of linux? Thanks for the answers btw.
     
  5. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Yes, by default the kit expects a database with a User table. You can strip that functionality out if you want, but it will obviously require changes on your end. As mentioned earlier, the only part in the game room management logic that is related to the users is the check of the JSON web token generated after the user logs in.
     
  6. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Yes, you can. It is mentioned in the F.A.Q.

    By the way, I just read your review. Could you please detail which parts you would like to have more documentation on so that I can improve this area? There is an unfortunately growing trend among many users of writing a bad review without even trying to contact the developer first. I am always more than happy to help and make the kit better for you and for other users; it is just not a great feeling having to do so as a result of a bad review that most likely than not will never be updated in the future. It has gotten to a point where it honestly makes me wonder if it makes sense to keep on developing and supporting the kit.
     
  7. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    Definitely. I would not consider my review to be bad though, wouldn't you agree? If you go ahead and update your documentation to a degree where it can be compared to other standard-quality assets, I'll definitely kick the 4 stars up to 5 :)

    So here's the thing; Usually, when I pruchase an asset (or release one myself) that is solely focused on coding, I feel like it has to be noob-proof. For instance, I know Go lang is pretty easy to understand and gather but still, you cannot expect people to take a gander at your code and understand what everything does magically. Providing summaries for functions, descriptions of variables, comments on important lines of code would be the first priority to me as it's not default for a unity developer to be well-versed in a language like go even if the dev is a server veteran. I've built about 8-10 server infrastructures ranging from small to mid-scale and never touched go lang before for example.

    As another example, it seems like we can extend room parameters which is a great and possibly very needed feature but that's not mentioned clearly anywhere. MaxPlayers is just one parameter and seems like with just a few lines of code change in one document, we can add custom options. Even just a custom string would save a lot of time for matching up players. (Didn't try this yet but seems possible)

    Second, the c# code. How exactly am I supposed to know how to connect to the GO server that I built? What function does what in your library? What is the namespace? There are a lot of variables defined with no explanation. How am I supposed to know how that is used? By running the code over and over and trying to understand how it goes? Edfinitely not ideal :) Just a line of explanation should be plenty for your variables and scripts. Sure it's simple enough to see what's going on if you're familiar with server tech and a unity expert of some sorts but for a team-based structure where one dev deals with unity, one dev deals with backend, this is the definition of hell :)

    Third, demo scene. There are a lot of scripts under the scripts folder but unfortunately no folder structure and I cannot possibly know what different scripts named with "Popup" do without going through them line by line.

    Fourth, an API documentation online where the classes and connections can be seen by browsing. This is easily done with tools like swagger or postman or even the most basic doxygen would greatly improve the documentation part.

    I know it sounds like a lot of work and one might say "why bother?" but there are standards in every line of work and any buyer would expect something depending on that :) Hope I was clear enough.

    A few good guides:
    https://blog.submain.com/c-documentation-start-finish-guide/
    https://docs.microsoft.com/en-us/pr...lstudio/visual-studio-2010/z04awywx(v=vs.100)
    https://blog.rsuter.com/best-practices-for-writing-xml-documentation-phrases-in-c/

    A few good examples of what I mean:
    https://www.skaredcreations.com/api/combu/v3/pages.html
    https://www.because-why-not.com/webrtc/
    https://www.easymobile.sglibgames.com/docs/pro/chapters/game-services/scripting.html#initialization
     
  8. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for your detailed explanation. Having said that, the documentation is public and can be checked before purchasing. No user has brought up this matter so far, so it does not seem to be a general opinion (it does not invalidate your points though, although the kind of hand-holding you expect certainly seems a bit too much to me personally).

    I am really sorry to say that I have personally reached the point where I am not going to enter into another situation in which a reviewer says "I will change my review if you do X". It feels like blackmailing and 99% of such reviews are actually never changed in practice. We are a 2-person team and it is simply not enjoyable to work on something with the added pressure of trying to please the random reviewer of the day. We will probably announce the removal of the asset from the store in the next few days; as much as we want to improve our work, this is not a healthy process for us to do so. Many users do not seem to realize there is actual people, with actual feelings, behind the publisher. If you are interested in a refund, please reach us via the contact form at our website and we will be happy to authorize it.
     
  9. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    Oh, well. I didn't think my review would hurt your feelings to be honest. I thought and still think your asset is great. Also, of course I don't request a refund as the asset is as advertised and I'm actually going to use it in my project. I downloaded it, checked it out, had my thoughts on it and shared them. Was that wrong of me to do so? Besides, if 4 stars are that bad with a note on just documentation, I wonder what would 3, 2 or 1 stars be?

    Not that I've reviewed thousands of assets but I've always updated my reviews when appropriate. I do get what you mean though.

    Anyways, sad to see the asset go if it does. Thanks for patiently answering my queries.
     
  10. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    After careful consideration, I can see what you mean as well. It is not about the stars, it is more about this trend of asking for/suggesting features or changes in the review section without even contacting the publisher first. We always appreciate users contacting us first in case they feel some area of the asset could be improved, as more often than not we will be more than happy to submit an update right away.

    Having said that, I will resubmit an update of the kit with more extensive documentation based on your excellent feedback; I hope it will help you navigate the contents of the kit more easily. Thank you again!
     
    Flamacore likes this.
  11. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Now that I am going back to this post in order to try and improve the kit's documentation, I have to note a few things.

    I am adding XML comments to the C# code and their equivalent to the Go source. They still feel mostly redundant to me (and possibly to a majority of our users, as we have not received any similar feedback so far) considering the naming of the scripts is pretty self-explanatory, although I can see the value in the small explanations on top of every script.

    I would also argue that knowing Go should be an obvious prerequisite for buying a Go-based asset.

    That is not the case; we use a single argument and it is currently not extendable. It is a good idea, although I do not see how it is relevant to the documentation side of things.

    This one I can understand and hopefully the changes to the documentation can assist you here.

    We have four popups in the demo, and I would argue their names (AlertPopup, LoadingPopup, LoginPopup and RegistrationPopup) are again pretty much self-explanatory. Explaining that LoadingPopup is the type that represents a loading popup in the demo does not seem to be very helpful.

    Hopefully the XML comments will help with that.

    This is a controversial topic but, personally, when I write code I tend to avoid comments that do not add anything to what the code is already saying. To me, useful comments are the ones with additional insight that can not be gathered from simply looking at the code.
     
    Flamacore likes this.
  12. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Having said that, please do not get me wrong! Your feedback will definitely help improve the kit for future users and is sincerely appreciated. :)
     
  13. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    Thanks a lot for your every answer and I see your points. Personally, btw I aggree on many of them as well. I was just looking at this on a bit more 'producer's eye' and with a 'noob eye' but yeah those improvements does sound like really good improvements.

    Again, sorry if I caused any trouble or inconvenience. I see that you've taken down the asset (saw your earlier post as well) which I assume is in order to upload a newver - better one. As a side note, I've already implemented my custom authentication method to check my own user table instead of the provided sql system. This might be the case for many games if they are large scale and considering the nature of using dedicated servers, mirror network etc. It would be safe to assume that they are large scale.

    Just saying, that might be even more ideal and easier on your side instead of providing a basic user database without allowing to switch to a custom db :) But again, that's just a suggestion. You of course are the owner of the asset and you know what's best for it always.

    Cheers for the great work!
     
    gamevanilla likes this.
  14. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    Rest assured that when the new version is released, I have 5 stars waiting for you right here :)
     
    gamevanilla likes this.
  15. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you so much for your feedback, your response and understanding! I think I initially took it more personally than I should have because of recent negative experiences; I am truly sorry for that.

    That is right; I will submit a new version with more complete documentation this week that should hopefully help in that area. Also noted on the authentication system; I can see what you mean and it is an interesting idea worth thinking about.
     
  16. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Just wanted to let you know the latest version of the kit, with complete documentation on the source code, is now available to download. I have also added some additional notes regarding the codebase to the wiki.

    I hope this helps!
     
    Flamacore likes this.
  17. ghostking9

    ghostking9

    Joined:
    Jan 9, 2019
    Posts:
    4
    I have multiple dedicated servers,Do I need to deploy Dedicated Server Kit on each server?
     
  18. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Yes, but you will need to do some extra work on your end to orchestrate multiple dedicated servers depending on what you want to do (e.g., region-based matchmaking). The kit is pretty much agnostic in that regard.
     
  19. ghostking9

    ghostking9

    Joined:
    Jan 9, 2019
    Posts:
    4
    How to match game rooms on multiple dedicated servers?Is there a master server?
     
  20. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    No; as mentioned earlier that will require additional work on your end. It is not something built into the kit.
     
  21. OrfStudios

    OrfStudios

    Joined:
    Nov 16, 2020
    Posts:
    4
    Too EXPENSIVEEEEEEEEEE
     
  22. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    Hey @gamevanilla :) Been using your kit quite reliably so far. Thanks for the good work. Here's something came up during a system I've been building for a fast-paced random match-making.

    There's no way to delete an existing room while leaving it. And also, I'm not seeing any TTL (Time-to-live) in your code as well. Am I missing something? Let's assume a thousand rooms are created, match is done in approx. 10 mins and then all the players go into match-making again almost immediately after leaving the match. That seemingly causes many of the players to join the previous room cause it still exists.

    I've implemented a form of "custom_data" in your room system and in unity part to pass on some sort of filtering like skill level, cost of the room etc but that does not help with destroying a room obviously. Any idea how I can deal with this?

    Should I destroy the rooms or is there a TTL that I can set?

    Thanks a lot :)
     
  23. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you! You raise an interesting point. The game server script (Unity side) contains a EmptyServerCheckFrequency variable that defaults to 30 seconds, meaning an empty game room will automatically be closed after 30 seconds.

    Similarly to how the UpdateMasterServer method in the same script periodically sends up-to-date information about the room to the Go server, you could arguably send a custom message to lock a "started/used" game room on the Go side and prevent new players from joining it. My original reasoning for not doing this by default was that it is something potentially very game-specific, but maybe it would be worth adding in a future update?
     
  24. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    Hmm. Well I think for my case as I auto-disconnect all players from the room upon the ending of the match, just that EmptyServerCheckFrequency should suffice but still, this might be open to issues in case of a player getting stuck, not properly disconnecting from the room etc. Right now tho, due to tight deadlines, I'll have to make do using that variable :)
     
  25. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    That is right, but handling connection issues directly in the kit sounds like a never-ending source of problems and is also an area I see as being pretty game-specific (as different games handle these in different ways and most of that logic lives in the client and not the server).

    At the end of the day, the kit is a starting point to building your own server backend that can be expanded as needed for your game/s. But, of course, I am always open to suggestions! :)
     
  26. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    True that. So yeah I guess you'll decide if the time/effort is worth the tradeoff :) In a lot of big online games tho, especially when working with photon, room.Close() was a very, very often used code. Just providing information here. Not that it's absolutely necessary (come to think of it) but yeah somewhoe it was easier and lazier I guess? :D

    Thanks for the answers!
     
    gamevanilla likes this.
  27. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    Hmm. On a second thought, I think I've found out where this might lead to a critical issue. I the room is not actually disposed of, there will be no port left to open other games because it always opens a new porteven if there are no unity instances are running. What do you think about this?
     
  28. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    I think you are absolutely right; the C# side of things should make sure that a room is always (eventually) disposed of in order to avoid a perpetual holding of the port. But this should happen already, both via the forced timeout and any extra game-specific logic that you may add for detecting the end of the game/match (irrespective of the status of the player connections).
     
  29. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    137
    It seems it just quits here. Do you think including an UpdateMasterServer() here would be a good idea? Didn't check, just asking right off of my head.

    upload_2021-4-14_18-34-5.png
     
  30. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    I think it would need to be something different so that the Go server knows it can safely "close" the room on its side (and quitting should then not be done right away so that the communication can actually happen); I will check this on my end.
     
  31. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Also, let's move this conversation to the private support channel. We should really not discuss the kit's internals in here. :)
     
  32. PhrozenEye

    PhrozenEye

    Joined:
    Nov 13, 2014
    Posts:
    8
    Hey @gamevanilla, I'm a long-term user of your assets, but I am currently struggling with the same exact issue @Acatist mentioned here, I simply cannot get your demo to work, even after following the new step-by-step tutorial for deploying on a droplet and using that same exact service. Log-ins and sign-ups are working fine, rooms are created, but upon trying to enter the room I get an infinite load with the same error mentioned:

    Client Recv: failed to connect to ip=161.35.219.130 port=9000 reason=System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it.

    The ports are open, the server's running, the linux server build is server-side, no other issues on client-side, but nothing seems to be listening to the designated port.

    Did you ever address this? Or did you ever find a fix on this @Acatist ?
     
  33. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    As far as I know, there was never anything to address on the kit's end. The deployment guide to Digital Ocean is not a theoretical thing but something I have actually tested myself to confirm it works (with the latest version of the kit as of this writing).

    The error message ("no connection could be made because the target machine actively refused it") seems to imply the issue is with the server not accepting incoming connections from the outside, which would point to a configuration/firewall issue. A good way to confirm this would be to have a separate, trivial server application listening on the same port and checking if the connection works or not.
     
  34. PhrozenEye

    PhrozenEye

    Joined:
    Nov 13, 2014
    Posts:
    8
    Thank you for the quick reply, I really appreciate both your work and your readiness to help!

    And you're right, it would be pretty easy to confirm if the port was the issue, but I'm afraid I did as you asked and debugged it simply by swapping the port that your GO server is listening to perform the log-in/sign-up from the default 8000 to 9000 (the one that I can't get a client to join with the asset) and the result is that your login system works just fine, the port reports as listening and whatever port I point the client to always returns the same error, even with the firewall completely turned off on the droplet.


    (this is before swapping the port, and after, showing the port itself is taking in connections from your log-in system)

    For some reason the asset never seems to call the room-creation ports, they never turn into a listening state even if I'm netstating them in real time with the request to join the room.

    On a side-note, you might want to check this line in your Client.cs script:
    "httpClient.BaseAddress = new Uri($"{ipAddress}:{port}/");"

    It returns "UriFormatException: Invalid URI: The URI scheme is not valid." and blocks the user from being able to sign-up or log-in if they try to follow your server-deployment tutorial, changing it to "httpClient.BaseAddress = new Uri("http://" + ipAddress + ":" + port);" fixed the issue for me. Is there any way this could be related to the issue I'm facing?
     
  35. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    I am afraid you will need to further debug this on your end; this is the very reason why we do not provide support for deployment issues: it is simply impossible for us to assist with a setup we do not have any control over. There is a myriad of reasons why things could fail, and more often than not they are not on the kit's side. This also follows from the fact that, if the kits works locally on your development computer, it should work equally as well when deployed to a remote computer.

    The HTTP client also works well for me (as I mentioned earlier, the deployment guide to Digital Ocean has been written while simultaneously following it and making sure it actually works), but I will take a closer look at that line of code. In any case, it should not have any relevance to your issue, which is the Mirror game server apparently not starting (meaning this is unrelated to the Go server).
     
  36. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    On that note, you want to check the Start method of the GameServer script is being called (with the appropriate port number being set and Mirror's StartServer method being called). This is the code that launches the Mirror game server instance and the part that seems to be the issue in your scenario.
     
    PhrozenEye likes this.
  37. PhrozenEye

    PhrozenEye

    Joined:
    Nov 13, 2014
    Posts:
    8
    Hey @gamevanilla! Thanks again for taking the time to address the issue, I'm reporting back on it since I believe you do need to know about it.

    It turns out it really was related to what I mentioned earlier, but the problem went deeper than what I had initially found, because you're using that same format that will return "invalid URI" on the GameSever script:
    httpClient.BaseAddress = new Uri($"{Config.IpAddress}:{Config.Port}/");

    And this one was a bit of a nightmare to debug since it only ever returns the error log when it's already trying to run server-side. Changing that format to httpClient.BaseAddress = new Uri("http://" + Config.IpAddress + ":" + Config.Port); as well as the previous change I mentioned in the Client script completely fixed the issue for me and I am now able to run dedicated online server instances thanks to your asset :)
     
    gamevanilla likes this.
  38. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Thank you for the information and really happy to hear that! It is interesting that the exact same code works perfectly fine on my end, but I will definitely investigate this further.
     
    PhrozenEye likes this.
  39. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Just to confirm this: what makes this work on your server is adding the http:// prefix to the connection string and not removing the string interpolation altogether, right? Meaning this string works on your end as well: $"http://{Config.IpAddress}:{Config.Port}". I am pretty sure that is the case, but asking just to make sure.

    Also, does adding a trailing "/" make any difference?
     
  40. PhrozenEye

    PhrozenEye

    Joined:
    Nov 13, 2014
    Posts:
    8
    Correct! That string works fine, and adding a "/" seems to work as well, although I only tested on the client side.
     
    gamevanilla likes this.
  41. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Excellent; thank you!
     
  42. sdasdasduuuuu

    sdasdasduuuuu

    Joined:
    Sep 4, 2020
    Posts:
    2
    After the Go service is started, a go: github.com/dgrijalva/jwt-go@v3.2.0+incompatible error appears, how to solve it. If the GO service is started, can it be used directly as a lobby?
     
  43. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Please reach us via the contact form at our website for technical support questions; this forum thread is exclusively for announcements and pre-purchase questions. Thank you!
     
  44. sdasdasduuuuu

    sdasdasduuuuu

    Joined:
    Sep 4, 2020
    Posts:
    2
    Thank you Bro!
     
  45. danthanhtrung

    danthanhtrung

    Joined:
    Aug 17, 2021
    Posts:
    1
    I Open and Error
    Library\PackageCache\com.unity.2d.spriteshape@3.0.15\Editor\SpriteShapeControllerEditor.cs(352,38): error CS0103: The name 'DoEditButtonChecked' does not exist in the current context

    How to fix ?
     
  46. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    Please reach us via the contact form at our website for technical support questions; this forum thread is exclusively for announcements and pre-purchase questions. Thank you!
     
  47. Andrey37

    Andrey37

    Joined:
    Oct 25, 2018
    Posts:
    6
  48. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    I am not personally familiar with the resources you link, but the fundamental room creation and management functionality is exactly what our kit provides. Please note we do not include a chat feature though; we believe chat is best done via an independent server/service (it is a different type of traffic and you do not want the chat to affect the essential working of your game rooms).
     
  49. Davinder_Singh

    Davinder_Singh

    Joined:
    Apr 15, 2016
    Posts:
    3
    Hi!
    I am trying to make a multiplayer game using mirror unity and aws ec2!
    I am having trouble with creating room.

    Would this asset be suitable for me?
     
  50. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    I recommend going over the official documentation available here so that you can decide for yourself. Even when using the kit, you are still responsible for writing the multiplayer logic of your game and as such you are expected to have a knowledge of the fundamentals.
     
Thread Status:
Not open for further replies.