- Home /
Multiplayer, Browser, SQL?
Is it possible to make a multiplayer browser based game that interacts with a SQL database? It would need to be secure. Meaning I can't have people stealing any code or viewing the SQL database details. I would need to have the code compiled or encrypted or something. The SQL database is off-server but on the same network.
The SQL is a SQLi database running on a windows 7 desktop with xampp
Answer by Landern · Oct 03, 2014 at 07:35 PM
Is it possible to make a multiplayer browser based game that interacts with a SQL database?
Sure, but if it's real time, it will probably have nasty lag, but that depends on how you read/write the data and whether you use a connection pool(max connections can run out quickly).
It would need to be secure. Meaning I can't have people stealing any code or viewing the SQL database details.
Good luck, nothing is truly secure, your .Unity3d can be decompiled and reflected, get over it, it happens all the time(see mobile games). The SQL server security is dependent on implementation and accessibility to your server.
I would need to have the code compiled or encrypted or something.
You can obfuscate your code which will make it harder to understand the decompiled(unity) code.
The SQL database is off-server but on the same network.
Fantastic, a middle tier and no direct access to the database is a smart move.
Thanks for the help! Are you aware of any tutorials that would show me how to make a SQL dependent multiplayer game and how to make it as secure as possible? I understand anything can be decompiled with enough force but to make it as difficult as possible?
Answer by tanoshimi · Oct 03, 2014 at 07:38 PM
There is no such thing as perfect security (well, unless you don't ever let anyone play your game) - every application on the internet can potentially be hacked, reverse-engineered, packet-sniffed... if you're not happy with this, then stop now.
But yes, of course published Unity applications are compiled, and it is possible to add encryption to the code as well (although, IMHO, this is largely redundant). And, assuming you follow best programming practice (i.e. don't use dynamic SQL statements that can easily be subject to SQL injection attacks, only run sprocs that are stored on the server, don't store your connection credentials in plaintext etc etc...), then your application and SQL database are just as secure as the millions of other SQL databases that are accessed by various applications on the internet.
The most straightforward model is to create a RESTful interface to your DB and then interact with that through Unity's WWW class.
Thanks for the help! Are you aware of any tutorials that would show me how to make a SQL dependent multiplayer game and how to make it as secure as possible? I understand anything can be decompiled with enough force but to make it as difficult as possible?