How to create a database?

Hello Everyone,

How would you create a database for multiplayer games so what the player does is saved? I don’t have a lot of experience with coding but have been starting with c sharp as it’s easier to use.

This entirely depends on the needs of the game. Most games simply take the current state of the game, serialize it into some format, and dump that into a local file. A serializer like @JoeStrout 's GRFON, a StreamReader for loading data and a StreamWriter for saving data would do the job for those.

There are exceptions to this though. If you have a large quantity of world data but can only load a small portion of it into memory or only a small portion of it is modified at a time then you might divide it into multiple files (Minecraft does this) or use a dedicated database solution (MMOs do this).

1 Like

The game is going to have lots of things in it. Lots of game mechanics(tree cutting, building etc.) that will already be implemented in singleplayer but I would like to convert it to multiplayer.

First things first, you need a server for your database to be run on. Do you at least have your own web server?

This episode is pretty good at explaining some of the database options at a high level. Of course every time they mention Parse you should probably replace it with something like PlayFab. Turns out being brought out by Facebook is not a recipe for long term stability.

http://thedebuglog.com/2015/07/09/episode-1-you-put-my-data-where/

1 Like

I will be using Authoritative Server on the asset store, I have been in contact with the developer and he said it is suitable for MMO’s, and that I will need to create my own database and separate codes(for the server information) for each game mechanic.

Right, but you need a dedicated computer someplace called a “server”… do you understand what a server is? It’s not an asset from the asset store. Like…


These are where servers live. In an air conditioned room with modular ceilings and floors… they are protected under lock and key because they contain lots of personal information. Most likely you’re going to have to pay for someone to allocate some space and bandwidth for you. When you understand this concept you can move forward.

Until then… continue buying assets I guess, especially anything that says “MMO” on it.

So we need a dedicated server even with a simple multiplayer game?! why not a shared server?

Thank you for sharing the information about database creation.

Why would you need an entire machine dedicated to your game? There is the software concept of a “server”, and then there is a physical server, which is a computer that does nothing but relay data back and forth. Don’t confuse all the terms all up.


Don’t do it.

Your Database will live on a computer that is connected to the internet 24/7.
This computer that is connected to the internet 24/7 is called a Server.
If you want to have a Database you need to have a Server.

This will probably cost Money, unless you have a friend who has his own server and he can hook you up.

When you get your “Server” you will probably find that it already has a “Database”. If not, then you have to set one up. There’s tons of guides on doing this all over the internet.

When your Database is set up correctly (have fun kids) then it will all depend on what you’re using to communicate between your software and the database, but the concept is the same… your program sends stuff to the database through some kind of back-end code running on the server, this server-side code accesses the database and can also be queried for information. You don’t want to have any kind of database login credentials stored in the client because then somebody can basically fuck over your entire database in seconds.

So BASICALLY you need your CLIENT PROGRAM to COMMUNICATE WITH YOUR SERVER PROGRAM which will then access the DATABASE and PERFORM DATABASE OPERATIONS (CRUD) and then RESPOND TO THE CLIENT PROGRAM.

The best part is… it’s actually MORE complicated than it sounds… MUCH MORE.

Some shit to keep in mind…

Structuring databases is an art form. It’s a job that people get paid good money for.
Your back-end will probably not be in whatever language you are currently programming in. Basically, it’ll probably be PHP unless you have some rare unicorn machine or you’re some kind of Ruby fanboy. Don’t even ask about servers that run Windows back-ends… literally, don’t ask. I don’t want to talk about it.
Your server will probably get hi-jacked at some point, so if you plan on having real-life players invest in your game, you will need to have a recovery strategy and lots of layers of security built-in.

My recommendation… stay in school, kids.

Or you can just press the “Make MMO” button. It’s coming in Unity 6.

Wait, so Unity 6 will make multiplayer easier? But how much easier? And when is Unity 6 getting released?

I’m being fucked with.

1 Like

I agree with the frog on this one. Waiting for the release of Unity 6 might be your best idea.

1 Like

I thought you needed a server to run code that manage 1millions players at the same time, not just store their GB of data :sweat_smile:

1 Like

I’m gonna put this in terms you understand.

TO MAKE A MULTIPLAYER GAME WITH CHARACTER PROFILES AND A DATABASE, YOU WOULD HAVE TO BE LIKE THIS:

TO MANAGE MILLIONS OF ACCOUNTS, TO WRITE THAT KIND OF SOFTWARE TO MANAGE ALL OF THE REQUESTS AND TRAFFIC, BOTTLENECKS, ETC… YOU WOULD HAVE TO BE LIKE THIS…

And the reality is, most of you are more like this:

So… GO MAKE PONG.

2 Likes

Ah don’t explain my joke pls :sunglasses:

1 Like

Okay, so I WAS being fucked with after all… phew

Except I know and understand the problem and still want to make a mmo just to fail and f**k with everyone :sunglasses: Say welcome to the trickster :sunglasses:

You don’t have to fail. You just have to be pragmatic, realistic, patient and just generally make good choices for a long enough period of time to accomplish what you’re trying to do. Put on your grown up face, roll up your sleeves and just do the fucking thing.

You don’t play Dwarf Fortress do you?

1 Like