I’m learning the concepts of multiplayer to figure out my path of implementation. I’m aiming to have a game where it is open world, but only 8 or so players per session. I would like to have friends lists and usernames, simple accounts, and some saved variables, but not much.
I’m strongly looking at Photon. Mostly at their Cloud, rather than Server.
I am looking at xml with some devious coding for saves/loads, where it’s not a huge deal if a few fartknockers cheat, but they’re still a PITA.
I’m also considering just exporting a main script that has everything needed to save, as an assetbundle, and users retrieve that each time they play. Not sure if that is feasible.
AssetBundles for DLC and updates would be written to users hard drive.
So, am I able to just have Unity connect to a website to download the xml save files and store them, as well as assetbundles? The purpose of this is to avoid $2k database costs of MySQL, since I don’t need too much data stuff, like an MMO would.
Trying to mostly wrap my head around that last aspect, and get some feedback on this as a whole.
EDIT: Ok… so MySQL is free? So, how do you interact with it as a database…? As a website?
Alrighty, so if I purchase a VPS server, am I able to run Photon Server on that, along with a website and database? If having this all on one server is possible, is it safe to do as far as database hacking and game stability? Would I still be using PHP to interact with the database?
Here is the VPS I’m looking at from DreamHost:
Shows unlimited MySQL and web domain hosting, and 1TB storage.
Or am I supposed to use a VPS just for the website, database, and login authentication stuff, and just use other Servers with Photon Server on them, or Photon Cloud, for the realtime game messaging?
security will be a big issue as always with online games.
I am sure you probably could run them all from the same, but I have never made a full multiplayer game so I am not the person to ask. I have done the database with php and it works fine although I should probably make it a little more secure.
You could run it all on the same server. It’s not a best practice though. As far as stability goes, it doesn’t look like you are looking to do any heavy lifting on the server. So, you only have to worry about high concurrent usage which will be determined by how popular your game is.
You’ll want to do some load testing to make sure the VPS you are using can handle your expected usage patterns.
So my best bet would probably be having a Website or VPS server that acts as a site for the game, and is connected via PHP for updates, DLC, and login/database. And then have either VPS Photon Servers or Photon Cloud for actual game. Is that the normal practice?
It really depends on your setup.
But first to get it out of the way then you need a windows server for Photon Server (not cloud), something like this: http://www.leaseweb.com/en/cloud-hosting/cloud-server. You cannot use your “normal” website server for this.
With photon cloud you dont have to worry about servers they handle it for you. It is nice and easy!
However you only got 500 msg per room so you are limited in the amount of players you got in game.
8 players in a FPS game is however doable if you get your interpolation/extrapolation right. In other games you might be able to have even more players in each session. But remember Photon Cloud is NOT an authoritative server setup, so handling cheating can become very tricky.
For database stuff then you can use an VPS, sure. And depending on how serious your project is, it could be a fine solution:
WWW → to a php script on your server → server to database… and back again.
For our game however we make a call to our Photon Server, which will then talk with our MySql instance on amazon, and then the photon server will send back the information to the players. The IP of the server we use for Photon is also the only one allowed to talk with our MySql instance so we dont get DB calls from “other places”.
But again it all depends on what type of game you are making and how serious the project is.
Thanks for the post, so much to think about. I read somewhere Photon was going to implement (or has already) an authentication for Cloud, so that would help. The Photon Cloud seems so easy peasy, I like that, but so many limitations. Much to think about…
The game is open world with plenty of AI, but I’m going to do some optimizing on their messages. I hope the game will be fairly successful, but I don’t expect it to compete with any major titles. Pretty casual game.
Ill likely go for leaseweb server, and separate database and separate webpage. So to authenticate users, how do you do that? With steam hosting the game? Without a game host?
You can store a username and password in your database, use 3rd party authentication (Facebook, Google+, MS Live, etc), or a combination of both.
Do not trust the client. After they enter their credentials send them to your server and call the 3rd party authentication services from there, not the client. Then create, store, and send back a unique token for that session, while storing the 3rd party token in your database if you need to make subsequent calls back that service (such as for friends lists from Facebook, etc.).
For usernames, passwords, and other sensitive information that only needs to be compared against, hash and salt them in the database.