Group Group Group Group Group Group Group Group Group

3-Tier Online Database

#1

Hey Guys,

I have looked up some Videos (Youtube) about how you can connect Unity to a Database to make for example an online Highscore. In every of these tutorials I looked up the comments-section and - on every single Video someone wrote, that this style of connecting from Unity to the Database is very unsafe, because the Database-Data is stored on every client. In the worst case cheaters could get the informations out of your client and if they wanted, they could delete things in your Database and so - this would be a horror if I think about that.

I nearly spent 3 hours yesterday to figuring out how you could manage this, there was very theoretical answers but I found no really practical step-by-step for that. They wrote in the forums you need something like a “3-tier Architecture” to achieve a more safe Database. Like there is a “middleman” between the client who doesnt directly know the database-variables (user who uses unity) who sends his variables to the “middleman” and then the “middleman” interprets /communicates with the database to give him the command to change values in the Database.

Do you guys know a place with a step by step tutorial on this? Would really like to learn this on my own, i think if i could manage to do something very simple like a Highscore-List in this way I could stretch it out to an inventory system or something like this. I think I would need knowledghe in PHP to achieve this.

Or is there an buyable asset which can achieve what I am searching for? Everything I found in the asset store sounds like alle the Videos who are doing it simple and unsafe.

Thank you for your answers.
Dario

#2

Yes, you can connect your database to Unity to track and keep information on a server, but believe me, creating your own database it’s a pretty much just a headache… If you’re interested, I recommend you to check out these database solutions, it just works and there is some interesting stuff with the integration of other services and databases.

#3

The bottom line is, if someone wants to cheat they will eventually find a way. So while there are ways to layer complexity you may have to trade off performance or offline capabilities to protect data.

Encryption is only useful until someone figures out the keys, combine that with heavy obfuscation and you’ll at least deter all but the most dedicated hackers.

Something that not a lot of unity developers know is that the compiled build of your game also contains the source code, so hiding keys in your code without heavy obfuscation is quite useless.