Open-world online game

Author: () Open-World Online Game in Unreal Engine ''This post is about answering question of the nature ÔÇ£Can I make an open-world online game in Unreal Engine?ÔÇØ and ÔÇ£Can I make an MMO in UE?...

Updated over 4 years ago Edit Page Revisions

Author: ()

Open-World Online Game in Unreal Engine

''This post is about answering question of the nature ÔÇ£Can I make an open-world online game in Unreal Engine?ÔÇØ and ÔÇ£Can I make an MMO in UE?ÔÇØ Note, itÔÇÖs about answering if you can, not how. I would like to answer this as well, but that would need to be a different article, or book. This article will be, what you can call high-level. I hope it will give you a bit more understanding of how things work, so you can ask more specific questions and begin to think about how to solve the problems you will encounter.

Warning: this will be a long post; it will not be very technical, I will use a language and form thatÔÇÖs easy to understand. ItÔÇÖs not about dumbing it down, I know people way more experienced and smarter than me will read this (and I encourage you to edit and add to this article), itÔÇÖs just that I want everything to be understood by as many as possible, including non-native English speakers.''

I dare say that you can make any type of game you want using Unreal Engine (UE) - within the boundaries of hardware and laws of physics. Whether that be an MMO or an Open World Online Game (OWOG ÔÇô yes, I just coined that). What you have to understand from the beginning is that you donÔÇÖt need to rely on features currently included in the engine, not solely. Complex problems often require custom solutions and implementations. For exactly your needs, you might get away with using just whatÔÇÖs provided in UE, but if you have big ambitions for your game ÔÇô and most who ask these questions have ÔÇô you probably need a few more features.

YouÔÇÖre in luck, because the source code is available and you are free to modify it and implement anything you might need. I see people sometimes answer these questions with ÔÇ£No, you cannot make in UEÔÇØ, and their reasoning is that the features you need are not in the engine. Guess what, as soon as you need a feature that is not common, you usually have to implement it yourself, this goes for any engine available.

I have also seen mentioned multiple times that the dedicated server functionality in UE is not up to par for certain things, whether thatÔÇÖs number of players or number and size of maps to load or the lack of support for world origin shifting (you could make this work for MP, but itÔÇÖs on you). This does not matter, much, for large online games you often need to create your own infrastructure - this includes writing your own dedicated server, or adding to the one provided. For some games the server itself does not even need to be that complicated, but of course you can end up with that, if the feature you require necessitates a complex solution, and multiplayer games are by nature complex.

What is a multiplayer game?

In a multiplayer game, players arenÔÇÖt actually in the same world, but they share this illusion. This is the same for every multiplayer game. The game is actually solely taking place on each playerÔÇÖs computer. The world player1 sees on his screen, is not the world player2 sees. Sure, it looks about the same, but because of issues inherent to networking any system, and other things - like non-determinism in your gamesÔÇÖ simulation - things wonÔÇÖt look exactly the same for every player. When we are talking about real-time multiplayer games the majority of your simulations will take place on each clientÔÇÖs computer, not on the server. Real-time multiplayer games are games where things happen fast, in real-time. Games like Unreal Tournament and Counter-Strike.

Since I used the word determinism I have to explain, in a simplified manner, what that actually means for us. If Unreal Engine had deterministic physics, every time you ran a simulation, like dropping cube on multiple other cubes, the result of this simulation would be the same every time. Meaning, after the simulation had completed, you could check the position (X,Y,Z) of every object and confirm it was the same each time. Even if you ran this same simulation one million times, it would never change. I could have explained this in one sentence: Given the same input, you always end up with the same output. But Unreal Engine does not have this. What we have is non-determinism, so things do not end up in the exact same place every time. There are things you can do to increase accuracy, you can even create deterministic physics, but thatÔÇÖs another post (and itÔÇÖs not recommended when talking about Unreal Engine, but you can read about it (lock-step determinism)), I have however included links at the bottom, for more information regarding this topic.

Physics and Illusion

You now understand why things donÔÇÖt look exactly the same for every player (hereafter player is referred to as ÔÇÿclientÔÇÖ). This is partly why I say multiplayer games are an illusion, and itÔÇÖs important you understand this, if you donÔÇÖt, the task of creating networked games would be too daunting. The other part of this illusion is that most of your gamesÔÇÖ simulations will run on the client, not the server.

In general, itÔÇÖs a good idea to do as much on each individual client as possible, to lessen demands of your server. Imagine the power it would take to calculate complex physics for 5000 players on the server. ThatÔÇÖs why, if you need physics on the server, they are extremely simplified. You may need physics on the server for collision checks. You want to know if players are touching, you donÔÇÖt want them overlapping or occupying the same space.

LetÔÇÖs think about the implications of not having deterministic physics, is it a problem? The short answer is, usually not. Take a game like World of Warcraft, if it even had physics for crates and explosions, an explosion goes off and crates are thrown in the air. Does it matter if they land at the exact same spot on every client? No. No one cares, and no one will notice. What if you could take damage if a crate landed on your head? Now youÔÇÖve added a feature that adds complexity. Well, the server will know (and decide if valid) what your exact position is. And the exact position of every other player ÔÇô thatÔÇÖs what the authoritative server does. For the server to know where every crate was going to land, it would need to run its own physics calculation, which you can choose to do. It could be a very simple calculation, so itÔÇÖs less taxing. Or, you could leave it up to the client to decide where each damage-causing crate lands, but that could open you up to cheating problems.

Even from this simple example, I think you see that thereÔÇÖs a lot of challenges in multiplayer games, and a lot of solutions and compromises to be made. For every feature you want, thereÔÇÖs a set of unique issues. ThatÔÇÖs why itÔÇÖs hard to give definite answers to questions about this topic: the answer will always be, ÔÇ£it depends.ÔÇØ

The authoritative server

There are many ways to do multiplayer architecture. The most common today is Client/Server with the server being whatÔÇÖs known as authoritative. I briefly mentioned this in a paragraph above; here I will explain further. Again, I will skip over some things, and youÔÇÖll have to read through the links at the bottom to get the complete picture.

The most important thing to understand is that the server decides what goes. It sets the rules, it decides how fast or far a player can move, and if a playerÔÇÖs position is valid. It knows the location of every player. When you move your player forward, the move happens instantly on your client, but the server hasnÔÇÖt actually decided if your move was valid (legal) yet. If it were to decide that your move was indeed invalid, it would be corrected (on your client) in hindsight.

The reason you can move freely without lag, before the server has had time to validate your move is because of whatÔÇÖs called client-side prediction. You should google and read more about this, ways to implement it, and also lag compensation. ThereÔÇÖs again, different ways to solve these problems, what you want to end up with is of course, smooth movement, and no to minimal lag perceived on the client. When it comes to the implementation of these things, a good way to go is to do it incrementally and see what you actually need. This is something that can be felt, and measured.

Now remember, that UE4 has great networking code, a lot of things are already implemented, so much of the heavy lifting is done for you, and it has great support for the network architecture of Client/Authoritative Server. Whatever your server solution, the one thing the server needs to know is the position of each client, it will then communicate this to every other connected client.

Clients communicate only with the server, not directly with each other.

- Sample user input

- Send data to server

- Server processes data received and validates, sends data to client

- Receives response and determines game state

- Correct any discrepancies (if server says a move was not valid)

World Size

UE has many features that makes it quite possible to have infinitely big worlds. Read the docs on World Composition for more on that. Like discussed above, the fact that some features are not supported on multiplayer out of the box is not a problem. There are ways around this, but you need to come up with what those ways are. A game developer always need to create ingenious solutions.

LetÔÇÖs just say, and itÔÇÖs a fact, you can have bigger worlds in UE than you would ever care to travel across. What will you actually fill it with? Are you going to create all that content? Navigating empty worlds is not what most gamers find fun. This is something you should give careful thought to, there are ways, sure, you can have procedural content. But will it be interesting and meaningful? You can leave it up to your players to create the content, through user stories and mod support.

With that said, here you have some numbers:

ARMA 3 has a map size of about 270km2

ARK: Survival Evolved - about 36km2

Fuel ÔÇô about 14 440km2

Grand Theft Auto V - about 81km2

Just Cause 3 about 1000km2

Witcher 3: Wild Hunt - about 135km2

A bit of a conclusion

In conclusion, to answer two questions: ÔÇ£Can I make an open world, online game with UE?ÔÇØ and ÔÇ£Can I make an MMO with UE?ÔÇØ ÔÇô the short answer is yes, thatÔÇÖs absolutely possible. The longer answer is this article ÔÇô countless others - and, boy, do you have a lot to learn.

Links

Use these links to learn the technical details of networking and multiplayer games.

Please feel free to edit and add to this article to make it better. Or suggest how I should improve the article.

()