Search Unity

Advice for setting up hosted game

Discussion in 'Multiplayer' started by Slaghton, Aug 22, 2018.

  1. Slaghton

    Slaghton

    Joined:
    Sep 9, 2013
    Posts:
    139
    To start off, I decided to get back into learning some basic MySQL/php/multiplayer stuff and have been making some progress which brought up some questions since i'm new to this. Right now I have a short demo where I can enter in a username/password which gets sent to php script(s) and then checks if that username/password is listed in the database. If it succeeds, it sends back a list of characters owned by that user in the database which show up as buttons with the character names and spawns a basic gameobject when clicked (blue capsule for male, pink capsule for female). (in the future, when I initialize client for player i'll load a blank character into world and apply/sync all values during loading from MySQL database)

    Now my main question is, what is the usual way people handle hosting all this? Example, I have a website which does allow me a MySQL database where I have been setting up to practice communicating with a remote db. I'm wondering, do I use this web host for my website+MySQL database+php scripts and have a gaming server handle the unity server? Though, to make things as speedy as possible I assume it would be best to have the gaming server/php scripts/database all on the same server/host to cut down on latency. The mysql database on the website is likely more to be used for the website/forums?

    Other question is, I want the server (not client) to handle as much commands as possible since I want to slowly build this into a small multiplayer game/framework to avoid hacking/cheating. Any tips or things to avoid on this topic would be appreciated. There's the usual don't store char values on the client but on the server and have it synced to the client. Also, I hear there's MySQL security measures you can take to prevent users from doing things they shouldn't (ex:sql injection). I believe I found some info on this but ill have to go over again once I get things actually uploaded and working on a remote server.

    p.s. I'm more of a 3d artist then a coder so go easy on me :oops:.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I'd set up my own LAMP server on a rented VPS or dedicated hardware, rather than using what is provided by a generic web host.

    I wouldn't use PHP/MySQL if speedy response time is a high priority. As far as building an entire multiplayer framework, that is going to involve a lot more than all the clients hitting a PHP server. I'd have your own build acting as the server, the clients connect to your build, and only your server talks to the database. Then to reduce cheating you make everything in your game as server authoritative as possible.

    If you let your clients talk to the database, including a PHP front end, some people will figure out how to craft requests to the PHP server to give them whatever they want.
     
    Slaghton likes this.