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

Best way to store my server(API) of game that I created with Unity

Discussion in 'General Discussion' started by veljkorankovic, May 21, 2020.

  1. veljkorankovic

    veljkorankovic

    Joined:
    Apr 27, 2020
    Posts:
    9
    Hi everyone.
    I created quizz game in Unity, and I used Node.js as my server side. I use it to connect with MySQL base. There is 5-6 post requests that save/load data from game to database and getting data for rankings and getting time from server to restore energy. Later I will upgrade my game into player vs player, but it will again be post requests to database to store data about how fast someone answer and to signal who is a winner. So I need my server part for that kind of stuff. It is not constant communication like on other multiplayer games with positions and etc.
    Can someone explain me what kind of hosting should I use, should that be VPS hosting or dedicated hosting or just web hosting can do the job? Or if there is some other way to store data outside of players device like it would be done with node.js and mysql and hosting.
    Please help.
    Thank you in advance.
     
  2. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    If you're only sending HTTP requests occasionally, standard web hosting should be enough.
    Heroku has fantastic Node.js server hosting support, and has several MySQL addons you can include with your project.
     
    Joe-Censored and veljkorankovic like this.
  3. veljkorankovic

    veljkorankovic

    Joined:
    Apr 27, 2020
    Posts:
    9
    Yea its is HTTP requests. I already have web hosting and I asked them they told me that I need VPS hosting, but I am not sure if they just want to sell me VPS hosting since it is expensive compare to web hosting, or they advice me that because I really need VPS hosting.

    The number of requests are max 2-3 per second if they open ranking panel, but usually only 1 per second.
    So I can start with web hosting, since I already have that bought for my websites and if I notice some problems I should switch to VPS, or is there any number of users that I should look out for so that I should transfer to VPS hosting?
    I use for web hosting https://unlimited.rs/shared-web-hos...upTrUxWjKN3of2Fuob7Tyjci_Y3IrpT0aAophEALw_wcB
    optimum one. Can that be a good one for my game, at least for some number of users?

    And one more question just for confirmation. For example if there is a lot of players and they are all sending requests will the server break at some point or the response will be slower?

    Thank you for first reply and thank you for any more information?
     
  4. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    It's hard to say for certain what plan you will need until you need it.
    I'd stick with your current plan and try it out first. If you find that it's struggling to handle the amount of requests coming in, then go ahead and upgrade to the VPS plan.

    The server shouldn't "break", but responses will be slower if the requests are over-capacity.

    One potential optimization I can already see is from what you've stated here:
    From my understanding, this "ranking panel" is like a leaderboard where users can view their ranks against other players?

    If that's the case, then there really shouldn't be any need to send out requests every 1-3 seconds while they're viewing this panel. Only one request should be required to get the ranking information and display it to the user.
    If the ranks are expected to be changing very frequently, then maybe include a "refresh" button instead for the user to click on, which will re-send the get request and re-display the results.
    This way, users can still get updated information without the client automatically sending very frequent requests.
     
  5. veljkorankovic

    veljkorankovic

    Joined:
    Apr 27, 2020
    Posts:
    9
    Thank you for reply. I will start with web hosting as you said.
    Regarding 1-3 requests, maybe I did not say it right, 1-3 requests per second is because 2 of them is for getting energy time and booster time(if it is activated) from server every second. At first I wanted to make server time to prevent to hack time by changing time on device, but I figured out that there is a way to avoid that and to make time calculation on a device.
    In that case I will only have request for leaderboard, witch is only when player click to open the panel and if click the refresh button, and other requests would be when enter main scene to load player data from server and to store it to the server when needed and when someone unlock some item witch would be very rare, since there is not much items and they are expensive, so it takes time to get resources to unlock it.
    So in this case I will have much less then 1-3 per second, and it should work without any problem on net hosting if there is let say 1-5 requests per 30-40 seconds, maybe even less then that, right?