New Blueprint Networking Tutorial Videos Posted

Amazing tutorials!

Now how do I get my friends playing my networked game?

Here’s another idea for a tutorial on Blueprints. How do you pass variables between blueprints? When should you use a blueprint interface over blueprint communications? A video on this would be a big help!

I LOL’ed at several places watching these. Here are some timeless quotes:

“And… we can comment this…‘handle damage’…I mean that’s… that’s a really lame comment. You would… you would want that to be better than that. Maybe we can make it less lame by making it blue”.

  • Billy Bramer

“A key programmer skill when you’re prototyping things is finding art that the artists made and using it in ways they didn’t intend so that it makes them sad.”

  • Billy Bramer

“Thankfully one of them is named P_Explosion because somewhere out there there is an artist that knows you cannot have content without an explosion… and he and I are best friends.”

  • Billy Bramer

You’re welcome! Will make sure to forward along your request. I think we’ve had a couple requests re: a turret demo now.

When you want to distribute it, you can check out this area of the documentation for packaging/cooking: Packaging and Cooking Games | Unreal Engine Documentation

In the same way in the demos the local client can join via the local host IP address (, you should be able to have friends join via IP address as well (just need the IP of the server). More advanced beyond that would be stuff like match-making/lobbies, but setting that up is admittedly out of my wheelhouse. Maybe can poke another dev who is more familiar with that part to hop in here.

I thought there might have been a video about this, but maybe not. I’ll ping James specifically, he’s been making lots of little blueprint videos.

Haha, glad you liked them. Hopefully all the artists know I’m just kidding…(kind of). :stuck_out_tongue:

I watched the Networking Tutorial. I tried, but it didnt work :frowning:

I´ve set Players up to 2. On the FirstPerson Template i couldnt see the second Player. I was alone on the map on both Editor Windows.
On 3rdPersonTemplate everything was fine, i could see the 2nd Player running around.

BUT when i packaged both templates and started an Multiplayer game (Laptop vs PC), i wasnt able to join the game.
I tried it serveral times with several templates by editing the Shortcut targets, and by joining/hosting ingame via console commands.

It doesnt work for me, why ?? :frowning:

+1 * 10³² !!!

Hmm, were you getting any kind of warning messages or errors? I’ll see if someone here can reproduce the problem with a packaged game next week.

No errors, no.
I´ve just been alone on that map on pc and Laptop.
Could it have something to do with open Ports?

I’m inspired (jealous?) by all of the work Billy is doing, so it’s been on my plate to make sure you guys get a good match making / lobby tutorial with documentation.

Only roadblock is that Epic does not provide an in house matchmaking solution at the moment. Using Steam or another third party service is required, so the information does require some additional setup. That being said, I’m working on getting the Online Subsystem documentation up to par with the rest of the engine. If you work with that, then any platform’s functionality should be approachable. The tech writers and I are on the case.

^Amazing!!! cant wait!!!

Excellent Josh, right now I’m using an external launcher written in basic and connecting by IP command line arguments… kind of greasy, would like to be able to do that in an in-game menu, looking forward to the documentation, thanks!

Great tutorials. I love all the support you guys are putting out for free right out the door. Always having ideas for games myself I decided to get to it and do something about it. As it stands I have something playable and that’s further than I’ve gotten before.

Keep it up and I look forward to more.

When I created Health and BombCount variables, I also set their starting values to their max values. The “Text” on the client side would never change. So it’s important to mention (although it seems obvious in retrospect) that updates never occur if there is nothing to change, even on startup.

Awesome, glad to hear!

Ah yep, that’s an important thing to note. The server won’t set a network update for a variable if it thinks it hasn’t changed. Normally things like health are just replicated instead of RepNotify and then your UI widget is likely reading the value each frame, so you’re not reliant on a notify coming in. For the video, I just used a notify for the sake of the text render component (though it also could have just set every frame).

I haven’t got around to trying to set it up myself, but am wondering what Epic does to replicate things that are normally handled by AnimMontage. There are also situations where you want the server to handle Some physics, but not all physics. What I would consider primary motion/bones and secondary. Or situations where something doesn’t need to be replicated again unless there is a collision event(likely using a volume to warn it before the actual collision occurs). Is that possible with blueprint currently? The networking documentation seems non-existent, though the search function on the documentation page stopped working for me.

Thank you Billy for your great tutorial.
I am having a problem I already asked here but maybe you can help me here :slight_smile:

For short what I want to do is trigger a [server only] function on the client and have the server, then trigger a [client only] function back on the client that triggered it.
Unfortunately I can’t give you any screenshots since I am in the progress of rewriting everything in c++ (I have the same problem there :frowning: ).

Do you have a specific example of what you’re trying to do? Do you mean like instigating a client-side event and letting the server know? For the most part, blueprint networking can do a lot of the stuff C++ can, but not quite everything yet. I know the documentation team is still churning away on the network documentation, so should be coming soon. I just tested the search and noticed it’s broken for me too in Firefox, but not in my Chrome. Not sure what happened there, will ping the web team.

Hmm, what you’re describing should be possible in blueprints or in C++. Do you remember what the blueprint setup look like? Or the code? If the multicast was called on the server, it should also execute on the other relevant clients.

Maybe I just don’t understand the replication mechanisms.
What I am currently doing in c++ is overriding the login + postlogin functions from AGameMode in order to assign a team (just changing an enum on the playercontroller/playerstate object)
to the player’s playerstate (I am experimenting where to put all the variables for my player [a better example on how to use a Playerstate class would be nice; Even the shootergame is no big help :(]) that is connecting.
At this time every code that is executed is only on the server. So in order for the client to notice this changes what function is needed?

If I just called a function that initializes the player camera the changed enum is not yet replcated to the client and nothing happens.
If I a “OnClient” function the result is the same
If I use onrep_notify the client is fine but now the server isnt’t
As far as I understand multicast tells all relevant clients to execute this function but what is relevant in this case? Relevant in terms of “that object belongs to me so only I execute this function”?
On a side note: If I print HasAuthority() to the logs it seems to me that server and client always return true. Also if I start a 2 Player PIE Game I noticed that there are spawning 3 controllers Standalone+List+Client.

I hope that helps a little more

Ok, hopefully I can help clear up a couple parts!

First, AGameMode is not set to replicate, as it is designed to be the server-only authoritative source of game rules, etc. and so if you ever try to do a replicated function call or variable on it, then the client will definitely never see it, as it never even gets the AGameMode actor in the first place!

As for player controller vs. player state, the big difference with them is that controllers are only replicated to their owners, whereas player states are replicated to all machines. So basically if you have a 4 player game, the server will have controllers for each of the 4 players, but each individual player will only know about one controller - their own. We normally put things in the controller that only the player controlling the character needs to know or care about and then put the things that all players might care about on the player state. Team is a good example. You usually want a player to stay on the same team even if their character dies, so you probably wouldn’t want to put that value on the pawn/character directly, where it would be lost on death. You want to put it on something that will persist after the character dies, which leaves you with the choice of the player controller or the player state. Seeing as other clients might often want to know which team a player is on (to draw UI, etc.), it makes sense to put that on the player state. If you make your team enum a replicated variable on the player state and set it on the server, it should be available to all of the clients.

Other random things that might help:

  • If you use replicatedUsing (the C++ equivalent of RepNotify), it works minorly different from how it does in blueprints. In blueprints, if you set the value of the repnotify variable, it calls the OnRep function on the server and the clients (assuming the value changed and they receive a network update). In C++, it only calls the replicatedUsing function on the clients! If you want it called on the server, you have to do so manually when you set the variable.
  • In the same way that PlayerState is the representation of the player that is replicated to everyone, GameState is the equivalent for GameMode. It’s a good place to put things specific to the game mode that need to be available to everyone, like round timers.
  • If you call a multicast function on the server, it will execute on the server and attempt to send it to all the clients to call. If the clients are not relevant for network purposes (usually because they’re too far away), they won’t receive the multicast.
  • Re: the HasAuthority() printing, where are you printing from?

Hope this helps! Let me know if that clears up some confusion.

First thanks for the helpful tips, I got my Team replicated. One mistake was that I added the replicatedUsing macro but didn’t include the variable in the lifetime replication macro. Then I have overridden the OnRep_PlayerState in the PC to call a custom Init() function after the PS was replicated. This way I have at least the value of my team variable on the client before I call the Init().

But can I still call replicated functions on objects (e.g. PC, Pawn , etc…) within the GameMode?

I noticed that if I list all PC Actors on the Listenserver I will get 2 (in a 1LS + 1Client scenario) and 1 on the Client. As I always want to assign team1 to the host and team2 to the client I tried to use GetNetMode()
and check if it is NM_Standalone || NM_Listenserver but the PC for the Client on the serverside is also tagged as NM_Listenserver :frowning: . On the Client itself it is set to NM_Client.
So if I set the team for the PC in the GamMode::PostLogin function the PC object has the same netmode as the server and therefor gets the wrong team assigned

So if I put the assign team logic (maybe I want to have more than 2 teams later) into the GameState it is actually the wrong place and I should only put something like a list with what PC belongs to which team in there?

    • When a new Player connects the GameMode queries the GameState for available teams/slots and assigns the the team to the PCs PlayerState AND adds this PC to the list in the GameState?

Calling somthing like that:

UE_LOG(LogGameMode, Warning, TEXT("%s] PC: %s | NM: %s | NR: %s | ID: %i | Name: %s | Team: %s | isLocal: %i"), *this->GetName(), *ActorItr->GetName(), *NM, *NR, ActorItr->GetUniqueID(), *ActorItr->GetHumanReadableName(), EKaoriGameTeam::ToString(GetTeam()), IsLocalController());

Returns (Team is fixed to Team2 right now)
LogGameMode:Warning: [KaoriPlayerController_4] PC: KaoriPlayerController_4 | NM: S | NR: SimulatedProxy | ID: 22946 | Name: KaoriPlayer260 | Team: Team2 | isLocal: 1 // Standalone

LogGameMode:Warning: [KaoriPlayerController_8] PC: KaoriPlayerController_8 | **NM: LS **| NR: SimulatedProxy | ID: 23026 | Name: KaoriPlayer264 | Team: Team2 | isLocal: 1 // Called on the LS
LogGameMode:Warning: [KaoriPlayerController_8] PC: KaoriPlayerController_9 | NM: LS | NR: SimulatedProxy | ID: 20769 | Name: KaoriPlayer266 | Team: Team2 | isLocal: 1 // Called on the LS
LogGameMode:Warning: [KaoriPlayerController_10] PC: KaoriPlayerController_10 | NM: C | NR: Authority | ID: 20733 | Name: KaoriPlayer266 | Team: Team2 | isLocal: 1 // Called on the Client

This is the answer I get when I try to set a team in my GameState right now which happens before the 3 lines of log I posted above.
LogGameMode:Warning: [KaoriGameState_6] NM: S_LS | NR: SimulatedProxy | ID: 23026 | Name: KaoriPlayer264 | Team: Team2 | isLocal: 1 | isLocalPC: 1
LogGameMode:Warning: [KaoriGameState_6] NM: S_LS | NR: AutonomousProxy | ID: 20769 | Name: KaoriPlayer266 | Team: Team2 | isLocal: 0 | isLocalPC: 0