Backend for data-driven multiplayer game

I am working on a match-based (5v5) multiplayer steam game that is similar to TF2, LoL, Dota 2, etc.

I am planning a data-driven approach where character/abilities/items/etc. are defined in JSON. This will allow for easy patching to constantly balance the game.

So I have something like the following. (obviously simplified)

{
    "Troll": {
        "name" : "Troll",
        "health" : "100",
        "abilities" : [
            {
                "name" : "ClubSwing",
                "damage" : "50"
            },
            {
                "name" : "FootSmash"
                "damage" : "100"
            }
        ]
    },
    "Orc": {
        "name" : "Orc",
        "health" : "50",
        "abilities" : [
            {
                "name" : "SwordSwing",
                "damage" : "10"
            },
            {
                "name" : "ArrowShoot",
                "damage" : "25"
            }
        ]
    }
}

I am wondering what the best practice way is for storing this data. I obviously can’t store it client-side or the player will be able to cheat. Is it normally stored in the database? I haven’t setup any backend for my game yet. Should I setup a nodejs server with a nosql database like mongodb to be the master of this data? And then build a REST API on top of that for reading this data?

I also need to write some things to a database. Such as the users rank, items, game stats, etc.

Would it be better to have two separate databases? One for reading gameplay data like I have above and another reading/writing user information (stats, rank, items, etc.)

Or would it be wiser to use a single database? Would you recommend nosql or sql based?

Currently I am using a listen server, but think it may be necessary to eventually use the dedicated server instead?

1 Like

Your question is well beyond the scope of Unreal Engine. It touches subjects of implementation of large data-driven backends.

From UE4 side, you can do it two ways:

  1. Keep the data in the game. Contrary to what you said, you don’t have to bother too much about clients changing data on their side. I assume, that with this kind of project, you will be the one running the servers anyway, via your backend infrastructure. Because in UE4 multiplayer model server is authoritative about the state of the game, it fully controls what data is used, and since you’ll control the dedicated servers (unless hacked) clients will have to accept the data your servers servrs. If you let the players run their own servers (listen server) you probably won’t count these matches to the global ranking, so you won’t bother about these games using cheats.
  2. Get the data from external source. When your game starts, UE can query some server endpoint for current stats of entities in the game. What backend you use is irrelevant. Expose it properly through some API consumable from UE (REST is fine) and get it on server start. It’s also quite sensible approach as long as your API responses timely.

Would it be better to have two separate databases? One for reading gameplay data like I have above and another reading/writing user information (stats, rank, items, etc.)

If I were to design this kind of system I’d keep these databases separate. Entity statistics database is almost exclusively read-only (how often you’ll change stats of units vs. how often the db will be queried by the servers starting up), so they have quite different usage scenarios.

Should I setup a nodejs server with a nosql database like mongodb to be the master of this data? And then build a REST API on top of that for reading this data?

<personal rant> No, please don’t. Spare the world another javascript backend server with “where’s my data” databse backend. </personal rant>

Thank you, this was helpful. What would you use to support the entity statistics database then? I was looking at mongodb because of the fact that I was planning on storing the data as json.