- Home /
[Unet] A dedicated server. Database? Security? Speed?
So I've been thinking about how to make my project of an online multiplayer game secure. I've come to the conclusion that the best way to design it is a SQL Database with a connection to a dedicated server and clients connected to the server, and then run all logic on the dedicated server. Only retrieving and setting values on the database from the dedicated server.
But then I realised, wouldn't this just be the same as saving all progression (for all players) at the client-host in the built in NetworkManager LAN multiplayer? What would be the benefit of using a SQL database compared to loading data from a file server-side and/or using a lot of [SyncVar]?
As I see it, no matter how I design it as long as a player have access to the "server.exe" they have access to the database (if not through editing what is sent, then through decompiling the code and look for the password, I guess this can be worked around by having a PHP intermediate but wouldn't that make it too slow?) and if not using a database they can just edit the memory. So I feel that there is no real security gain by implementing a SQL Database. But is there atleast performance?
Am I going about this the wrong way?
My project is a Diablo-style hack and slash. So what I'm looking for is hosting a game of 3-6 players per "match" and I need the dedicated server to be able to run several matches (I suppose NetworkMatch.CreateMatch() could handle that for one server? But that's a bit off-topic). So I'm not looking for a way for the server to handle 100+ players at once. Just to give an idea of what I'm working with.
Answer by Megaphone_ · Jun 30, 2016 at 05:20 PM
If your matches only have 3 to 6 players I dont think PHP is going to cause you any speed issues, depending on what is being sent and how often. Im using php to store player AND world information via UnityWebRequest and it is generally fast enough for what I am using it for. I would definitely recommend that approach
Edit-phone pressed enter
The plus side to this method as opposed to keeping it on the Unity Server is maintaining that information if something happens to the server. Imagine if your server crashed and everyone lost progression, you would have a lot of angry players.
Not to say there aren't ways around that eventuality but PHP is easy and friendly.
Your answer
Follow this Question
Related Questions
Unity MySQL database? Saving data to a database available to any player. 0 Answers
PUN and mysql database 1 Answer
Workflow Question with Unity and online Database 0 Answers
MonoDevelop problem with 4.1.4 1 Answer
Database solution networking 0 Answers