Even though the network is a well covered subject in UE4 documentation, a small tutorial explaining how to get started with a really simple application is really missing. In this article, I propose you to implement a multiplayer small game over the network, and we will see how easy it is using Unreal Engine if we know where the things must be placed and what configuration must be done.
But first, let’s start with the basic principles of Unreal Engine network.
Note: if you are looking for an excellent reference about UE4 network, you need to check this http://cedric-neukirchen.net/2017/02/14/multiplayer-network-compendium/.
UE4 Networking Concepts
These are the things to know before starting. We always want to start coding but some knowledge about the concepts used in UE4 networking is mandatory to avoid losing time later.
First of all, the UE4 multiplayer is based around the client-server model. We won’t go into the details here (they can be found there), right now we just need to know that there is a Server side and a Client side.
The server side will be in charge of managing all the rules of the game, while the client side will be in charge of managing the player inputs. The connection between both will be mostly managed by the UE4 framework. Knowing this rule is important to know where all the data must be placed and managed: for instance, the score is typically something we will want to manage on the server side, meaning it will be stored by the server (replicated to the clients) and updated by the server. A client should not be able to directly update the score: it will tell the server “this player has done this action”, and the server will handle the action and eventually update the score.
The important classes for the server, the ones which will be storing the state of the game and manage it, are respectively GameState and GameMode. All the data required by the clients should be stored in the GameState.
The important classes for the client are:
- PlayerState: Contains all the attributes of a player that need to be known to every player, but which are not critical for the game. It can be the name of the player, its best score, and so on. But we won’t store the player position in this class.
- PlayerController: The interface between the human player and the Pawn.
- Pawn: The most important class, it will be the representation of the player in the game, will react to the input of the player and its attributes will be replicated to the server and all other players.
Then, this is what will basically happen on player connection on the server side: the GameMode will receive an event with the connection of the player (the PlayerController will be a parameter of the event), the GameMode will then spawn a Pawn, and will affect the Pawn to PlayerController (the PlayerController will possess the newly created Pawn). After this, the player on the client side will be able to control the Pawn created by the server.
Finally, the last important thing to know is that if we want something to be replicated to all the players, it must be marked as Replicated and it must be run on the server side.
According to this, the next steps to implement our multiplayer game are just:
– Defining the Pawn that will be controlled by the client
– Handling the connection of the players and giving them Pawns to control
– And test it
For this tutorial, the game we will make will be really simple: each player will control a ball which will move up when the space bar is pressed.
Implementing the Server Logic
The Pawn will be created on the server side. The GameMode will be in charge of spawning them and they will be managed by the server.
Let’s define our BP_Sphere_Pawn pawn. It’s just a sphere with a MoveUp method.

By default, a Pawn is replicated over the network, but we have to define that we want the components to be replicated.
Now, in the GameMode, we will react to the connection of a player by spawning a new SpherePawn and making the player possess it:

Here, when a new player is starting, we find the player start in the current server map, and we spawn a BP_Sphere_Pawn at this location (with the strategy Try To Adjust Location, But Always Spawn), then we make the player possess this Pawn.
Implementing the Client Logic
On the client side, we will create a PlayerController, that will call the MoveUp method of its Pawn when the space bar is pressed:

MoveUp needs to be run on the server side, because it needs to be known by all clients. That’s why we are calling it in an event with the attribute Run On Server.
Testing Network with the Editor
Everything is almost setup. We just have to select the right GameMode, and then we can just start the game with two players:

Then, when Play is clicked, two windows should show up. When the space bar is pressed in one, the associated Sphere should move in both windows. When the space bar is pressed in the other window, the other sphere should move in both windows.
The Content folder for this project can be found here: MultiSphere.
In this tutorial, we have seen the basic principles of Unreal Engine 4 network and how to set up quickly something working. If you follow the other tutorials on the net, you can now make something great.
We will continue to cover the subject of the UE4 network in the next tutorials, and we will go deeper in the explainations. If you want to know when the new articles are out, you can follow us on Twitter and Facebook.
Nice tutorial ! 🙂 Thank you for this. It is a good start to understand where the code needs to be at the beginning.
Oh!!! please continue this subject! the style of writing and level of depth are on point!
Good day. Could you please explain what the purpose of a Multicast custom event would be? In your example here, you do not use multicast and all, and your project works fine. So the question is, in which situations is multicast custom events useful, if the server events seem to already be sent down the clients anyway?
Thanks.
It makes very little sense to put those RPC’s in the Player Controller – you’re just creating an arbitrary dependency between the two classes then. The player already ‘owns’ the pawn class and can call RPC’s through it, and it responds to input already too.
casino
49slotsgo, yeah? Could be better, tbh. But I didn’t hit any snags and got to pull off a few wins (small ones, haha). Go in with low expectations and maybe you will surprised! : 49slotsgo
JLjl1CasinoLogin… Another gambling site to try your luck on! Worth a shout if you like to try new ones. jljl1casinologin
Looking for a legit sv388 agent? sv388sv288.org seems like a solid choice! Easy registration and reliable payouts so far. Give them a try if you need a reputable agent for live sabong fun. Place your bets here sv388sv288
I will right away clutch your rss feed as I can not in finding your e-mail subscription link or e-newsletter service. Do you have any? Please let me understand so that I may subscribe. Thanks.
BK8BK8XO? That’s a mouthful! But the site is pretty decent. Worth exploring, for sure. Check it: bk8bk8xo
Heya i’m for the first time here. I found this board and I find It really useful & it helped me out a lot. I hope to give something back and help others like you helped me.
I am sure this piece of writing has touched all the internet visitors, its really really nice post on building up new blog.
I enjoy what you guys tend to be up too. This sort of clever work and coverage! Keep up the wonderful works guys I’ve incorporated you guys to my own blogroll.
Greetings! Very useful advice within this article! It is the little changes that will make the most important changes. Many thanks for sharing!
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article. https://accounts.binance.com/hu/register?ref=IQY5TET4
At this time, your phone screen looks like the below mention pic.
I need to to thank you for this good read!! I certainly enjoyed every little bit of it. I have you book marked to look at new things you
Way cool! Some very valid points! I appreciate you penning this article plus the rest of the site is very good.
I’ll immediately grasp your rss as I can not to find your e-mail subscription link or newsletter service. Do you’ve any? Please allow me know in order that I may just subscribe. Thanks.
Thanks for this; I’m formally a huge fan of your weblog.
Inhoud voor volwassenen is toegankelijk via veilige
en betrouwbare websites. Ontdek veilige adult sites voor kwaliteitsinhoud.
Here is my webpage :: BUY XANAX WITHOUT PRESCRITION
I will immediately clutch your rss as I can not to find your email subscription hyperlink or e-newsletter service. Do you’ve any? Kindly permit me understand in order that I could subscribe. Thanks.
**boostaro reviews**
Boostaro is a purpose-built wellness formula created for men who want to strengthen vitality, confidence, and everyday performance.
It’s very straightforward to find out any topic on net as compared to books, as I found this paragraph at this web site.
I am sure this post has touched all the internet viewers, its really really fastidious paragraph on building up new website.
Expliciete video’s bekijken op veilige en betrouwbare platforms.
Vind betrouwbare sites voor een premium ervaring.
my website: BUY XANAX WITHOUT PRESCRITION
https://askoff.ru
ra website https://otvetnow.ru best rated life insurance companies for term insurance
https://asklong.ru
Nieuwe xxx sites bieden geavanceerde inhoud voor volwassenen. Kies voor
betrouwbare frisse sites voor veilig kijken.
Feel free to surf to my website; BUY XANAX WITHOUT PRESCRITION
Hey! 3rrcom is the site. Let’s see what it offers. I have high hopes because I haven’t been disappointed to date Let’s see with this! This is the link: 3rrcom
2jbet, let’s get down to business! I’m ready to place my bets and see if I can win big. Fingers crossed for some lucky wins! Explore betting options at 2jbet.
G777login provides fast and reliable access to all the cool games. Navigation is simple and withdrawals are pretty quick. Good site overall: g777login.
That’s a solid point about late-game upsets! Seeing platforms like 1jl ph download prioritize secure gaming & localized options for Filipino players is great for growth in the scene. Definitely adds to the fun!
You have made some good points there. I looked on the internet for additional information about the issue and found most individuals will go along with your views on this website.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://accounts.binance.com/id/register-person?ref=UM6SMJM3
Porn is available on various adult websites for
entertainment. Always choose secure content hubs for a protected experience.
Here is my site … buy xanax without prescrition
https://qtjpqhtfcs.wordpress.com
https://iagperjusu.wordpress.com
https://dwspqdxcgw.wordpress.com
https://xrsaugpsya.wordpress.com
https://gxvkxeawwa.wordpress.com
https://azacgxicis.wordpress.com
https://zfcejfyxiv.wordpress.com
https://cxadxqpked.wordpress.com
https://akiwdiycje.wordpress.com
https://iqakruyprf.wordpress.com
https://dgaiyziytk.wordpress.com
https://hrjcdfdcvj.wordpress.com
https://wryxvrrhxe.wordpress.com
You made some really good points there. I checked on the net to find out more about the issue and found most people will go along with your views on this site.
Thank you for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.
Adult content is available on various adult websites for entertainment.
Always choose secure content hubs for a protected experience.
Feel free to surf to my website BUY XANAX WITHOUT PRESCRITION
Way cool! Some extremely valid points! I appreciate you penning this article plus the rest of the website is extremely good.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
This is a topic which is near to my heart… Many thanks! Where are your contact details though?
I love what you guys are up too. This kind of clever work and coverage! Keep up the terrific works guys I’ve added you guys to our blogroll.
Ahaa, its pleasant conversation regarding this post here at this weblog, I have read all that, so now me also commenting here.
Greetings! Very helpful advice within this post! It’s the little changes which will make the most important changes. Many thanks for sharing!
Link exchange is ոothing eⅼse except it is ߋnly placing the otһer person’s blog link ߋn your page at apprоpriate plɑсe anɗ оther person wіll also dо ѕame iո favor of уou.
Bro, ktobets is where it’s at for online betting! Got a great selection of games and sports. Definitely worth checking out. Hit it up here: ktobets
Orionplaylogin, heard some stuff in one of the live streams, some people are saying it is good. I’ll check it out later. Explore orionplaylogin now: orionplaylogin
PHSuperlinklogin, it’s my go-to! Easy navigation and keeps things interesting. Check it out if you’re looking for some fun! phsuperlinklogin
I am sure this article has touched all the internet people, its really really pleasant post on building up new website.
Greetings! Very helpful advice within this post! It is the little changes that will make the most significant changes. Thanks for sharing!
I am sure this article has touched all the internet people, its really really good paragraph on building up new blog.
This is a topic which is close to my heart… Thank you! Exactly where are your contact details though?
What’s Going down i’m new to this, I stumbled upon this I have found It absolutely useful and it has aided me out loads. I’m hoping to give a contribution & help other users like its helped me. Good job.
I am sure this article has touched all the internet users, its really really good piece of writing on building up new website.
Heya i am for the first time here. I came across this board and I find It truly useful & it helped me out a lot. I hope to give something back and aid others like you aided me.
As quickly because the hack software will reach a high amount of users, we shall be implementing the so known as survey verification methodology.
Hola! I’ve been reading your blog for a long time now and finally got the courage to go ahead and give you a shout out from Dallas Texas! Just wanted to tell you keep up the great job!
Excellent way of telling, and fastidious piece of writing to obtain information concerning my presentation topic, which i am going to convey in institution of higher education.
Way cool! Some very valid points! I appreciate you writing this post and the rest of the website is extremely good.
These are truly enormous ideas in on the topic of blogging. You have touched some fastidious things here. Any way keep up wrinting.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. https://www.binance.info/register?ref=IHJUI7TF
I am sure this article has touched all the internet visitors, its really really nice piece of writing on building up new webpage.
Fastidious response in return of this matter with solid arguments and telling the whole thing regarding that.cheap mlb jerseys China