Server for MMORPG

Hello, All.

Currently, there are built-in Dedicated Server. We are currently developing a MMORPG on UE4. Question of how to change the server so that it stores the data in the database and other modifications in the code where it is necessary to specifically look for? Or maybe there is a ready-made examples?

Thanks.

Oh dear… this might be abit lengthy to answer so try to bare with me!

First of all… in terms of storing data outside and in some kind of database, that really depends on what sort of database you plan on making. I’d suggest, if you’re new to databases, to start with File Outputs/Writes http://www.cplusplus.com/doc/tutorial/files/

I recommend trying out these examples and bringing in data this way. This will essentially boil down to the bare basics of proper data-base handling… well I wouldn’t exactly say proper but enough to get the job done. Afterwards once you have this system working you’re going to want something much faster, much more efficient and something that is easy to edit. MYSQL. Though I haven’t personally done much with MYSQL so I can’t really say how difficult that will be.

Phew. Anyways, you should probably get started with the link I provided. Good luck!

I will keep my clothes on, thank you very much! I might bear with you being bare, though. :slight_smile:

When you say MMORPG, what kind of gameplay do you mean? Do you mean the kind where there are “zones” and players teleport between them? Or do you mean a large, seamless world? How dense a player population do you need to build?

In general, a MMORPG or virtual world will have three to five tiers in architecture. The simplest system, used by original EverQuest etc, uses a single game server per zone (much like a big FPS game,) and has code that runs on the servers talking to a database using that database’s API (libmysql for the MySQL database, etc.) It is important that the player clients do not talk directly to the database, for security reasons – standard SQL server access controls and performance characteristics are wholly inadequate for exposing to the greater Internet. So, the tiers are client -> server -> DB.

Some systems need to better manage players, and put some kind of gateway in front of the game servers. This may allow them to do things like automatic load balancing, interest management, semi-seamless zoning, etc. That would be another tier, in front of the game servers. If you’re building an “indie” MMO game, you do not need this and it will just complicate things. The tiers are client -> gateway -> server -> DB.

Some systems use more business logic than just simple database inserts/updates. Those systems add an application server between the game server and the database. The application server takes simpler commands from the game servers, and translates them to business logic, which in turn talks to the databases and other back-end systems (payment processors, etc.) The tiers are client -> (optional gateway) -> server -> app server -> DB.

Regarding Kyp’s suggestion to use file I/O for storing things server side, that may work OK for small prototype implementations, but it really will bite you hard as soon as you try to run a robust full-time operation. If you don’t want to use SQL servers, you can look into alternative data stores, like Redis, Cassandra, or some graph database. Or, if you are hosting your servers “in the cloud,” look at SimpleDB, BigTable, and friends.

Now, having answered your question (“use libmysql for Linux, or SQL Server for Windows”) I will also give you another observation: MMO games are large, complex, distributed systems. If you don’t already have at least some experience in that area, you are pretty much doomed to technical failure, unless you get some solid experience on board. Note that you need someone who knows all three of web-type architecture, IT-type architecture, and game-type architecture, to make it come out successful. Someone who only knows one of those three is unlikely to pick the right tool for each job.

Another tought that comes to me is that creating an MMO requires a lot more content than “just” a regular game of the same kind, and a RPG requires more content than, say, an FPS. Thus, if you are in the “indie” situation, you may also be looking at a project that’s too big for the team you have. Without knowing more about your situation, It’s impossible to tell for sure, of course.

Bare, bear. Potato, Patato. Ha.

Parse, Photon, Raknet and plenty of other solutions (even your custom) can be used. Details depend on your requirments, of course :slight_smile:

Thank you. About Database - we use Oracle 12g. Don;'t worry about this.

For the first prototype we will create such as in EQ2 - Zones. So for this reazon we need that the server per zone synch data with database for Character, Mobs, NPC and so on - for prototype this will be enough. In what place we must start to look, and can we realize this modified only source code of the UE or we need to take external tools such as Racknet and so on?

Hi .

Maybe this is of interest to you:

You should be able to prototype using only UE4 networking. You will have to support “late join,” and support zones that keep running even without players – the “host” would be a dedicated server that you operate on your own, and the level will just keep running forever. (Make sure you have no memory leaks!)

Make sure that properties that affect gameplay are server-side only.
Then, when a player connects to a running instance, fetch the actual player stats/inventory/character-info from the database as data (you have to add C++ for this) and poke it into the player character attributes you define for this.
If the player does something that “matters” (trades, loot, etc) then do the appropriate database operation. You’ll probably want a separate thread, not running directly within the Unreal main loop, for those operations, and use asynchronous messaging to that thread and back for those, so you don’t block all of gameplay on talking to the database.

Periodically, and when a player disconnects, you would checkpoint the player state back to the database as well. The “entity destroyed” callback within the UE would have to bundle up the state of the player, and send it over to the database-write thread for final checkpointing. And ideally you want to make sure that that completes before you allow “player reload” on a new server, else a player could connect to server A, get all their stuff, then use all the stuff and zone to another zone, and it may race and re-load the old character state (with stuff) before the new state (without stuff) gets written back.

Can I do this only using UE4 engine? If, yes in what place I must start view the code for setup the dedicated server? If, no - if I right understand I must use any external tools as Raknet and so on

Most likely, yes. It’s just a dedicated server with specific tunings. Like jwatte said, the only things that really need to go into a database are cross-zone information, like player stats (like health, xp, mp, inventory, equipments, buffs, etc). Things that change inside a zone (enemy position and state, for example) can exist only in the server, so you can prototype that with only UE4.

You’ll also need to work a lot in the network replication of player and enemies to allow a good amount of players per zone. That often involves adapting the game design so the gameplay takes those things in account.

Since you seem to be at the very beginning and don’t have experience with this, I suggest you start working on a simple prototype where you have a dedicated server where people can connect to and move from there. Avoid doing a billion things at once, you’ll have problems getting anywhere that way.

Can you suggest to me, pls. From what programming I must start in the UE4 part i mean (What class I Msut extend and so on).

I known that there is out of the box dedicate server in the UE or I’m wrong about this?