New Blueprint Networking Tutorial Videos Posted

This should be pretty straightforward. You are correct, each client only has their own playercontroller.

The AGameState class is the perfect candidate for your timer. I would have the server set an int value for “time in seconds” and then set that value to replicate. All clients will get that class and that variable. Each UI can just grab the value and draw it. Leave the timer on the server and update it there.

The only drawback is replication time might make the 7…6…5 not “second accurate”, but it is good enough. You can have the client use this value and decrement it on its own timer as well for “more client side accuracy”, but still let the server overwrite it. They would compete.

You might see 7…6…7…6…5… but only in laggy circumstances. You wouldn’t be happy with a client at 0 but nothing happening either, but at least in the server authoritative way it is correct.

Hey, is there any way to create a dedicated server with this example? I tried -server and -listen using the cooked game but I couldn’t connect… Ip, ports, etc; everything is configured correctly!

I got it working by creating this shortcut for the designated server: “C:\Program Files\Unreal Engine\4.3\Engine\Binaries\Win64\UE4Editor.exe” “C:\Users\YourUserName\Documents\Unreal Projects\YourProject\YourProject.uproject” YourLevel -server

The client was just the same as when connecting to a client-server. The only thing that’s weird is that since the designated server doesn’t bring up a window, it’s hard to tell when it’s running. The only way I found to check if it’s running/close it is to go to the task manager and check for an instance of UE4Editor.exe in processes using the least memory (The one using the most was the actual editor, and then each of my clients used up about 3 times as much memory as the server).

Cooked games require the standalone MyGame.exe and MyGameServer.exe and don’t require -game or -server to run. These executables imply cooked content. UE4Editor does not use cooked data, just the data in your development /Content/ directory structure.

That being said, unless you write custom code to put your server in a more “headless” state, you will need to specify the map and gamemode on the commandline (or in the DefaultEngine.ini). Your game startup logic will have to handle waiting for players to join and knowing when it is legal to start the game. This can be very different from listen servers where you get the first player implicitly.



[/Script/EngineSettings.GameMapsSettings]
GameDefaultMap=/Game/Maps/MyDefaultMap
ServerDefaultMap=/Game/Maps/MyDefaultServerStartupMap
GlobalDefaultGameMode="/Script/MyGame.DefaultStartupMode"
GlobalDefaultServerGameMode="/Script/MyGame.DefaultStartupModeForServer"


Try adding -log to your server commandline to get a window with status. We haven’t come up with a nicer server solution yet.

Here’s my C++ version of the tutorials

Hello everyone.

I’m proud to show off my C++ version of these tutorials. :slight_smile:

It’s available free at my GitHub account: GitHub - marcthenarc/NetGameCPP: A C++ version of the Network Bluprint tutorial

As you can see, I added a semi-transparent HUD. I also added more bounciness in the bombs with accurate rotation. But everything works as advertised. It took me a while to get the equivalent calls to work.

I’ve also noticed that in C++, when the server receives the signal OnPropjectileBounce(), it has the authority to set Armed to true but this change won’t reflect on itself, only clients receiving that change to Armed will call OnRep_Armed(). This can be seen as an optimization if whatever is done in OnRep_Armed() is purely cosmetic for a dedicated server - in this case, it merely changes the bomb’s colour - but for a client that also plays the role of server to everyone else, the colour never changed because OnRep_Armed was never called. Maybe there’s a call that I missed or a UPROPERTY() meta parameter to add, somehow.


void ABomb::OnProjectileBounce(const FHitResult& ImpactResult, const FVector& ImpactVelocity)
{
	if (Role == ROLE_Authority)
	{
		Armed = true;

		// You must call the rep function yourself for the server or it will never change color.
		OnRep_Armed();

		GetWorldTimerManager().SetTimer(this, &ABomb::OnFuseExpired, FuseTime, false);
	}
}

Enjoy! Let me know what you think and suggestions are always welcome for making better code.

https://lh5.googleusercontent.com/-b0CiUmcijgw/U-u2-Ud0OmI/AAAAAAAAAZ8/LuEPbtEphuQ/w565-h436-no/net.png

Hey guys. I’m new to blueprints and I followed the tutorials side by side to make my own game.
My question is - we are checking to see if there are actors in the blast radius, how do I prevent the bomb from damaging a player if he is behind a wall?
Thanks.

Thank you so much for these tutorials! They make setting up multiplayer gameplay so easy.
Its great to hear insights on how multiplayer is being handled in Fortnight, the insider knowledge on workflow is awesome.

Im also looking forward to this :slight_smile:
I would be very interested in hear any insights you have on developing Drop-In-Drop-Out Multiplayer.

EDIT: I should add that any info on how you are integrating with Steam would be great to learn too!

One possible way I can think of:
After doing a radius check you could then do a raycast to those within the radius and that will tell you if there is a wall in the way.

What ever happened to releasing the project? A lot of people learn by looking at examples also. Can you please release the full finished tutorial project?

That map is included in version 4.6+ in the “Content Examples” examples map list.

Network Features Map? What about the map you can drop a bomb and replicate health?

Awesome! Thank you!

> 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.

Sooo what if I built out my round timer in GameMode? Everything works as expected but is there any disadvantage to using GameMode instead of GameState? (Blueprints)

GameMode isn’t replicated to clients, so if you wanted them to be able to see the timer (like on their HUD), they wouldn’t be able to. If you just use it for gameplay purposes and don’t show it to users, then it’s fine on the GameMode.

The Network Features map has the pieces from the first parts of the tutorial. The bomb one I literally did on the fly while recording and didn’t have it pre-setup, so I think I didn’t actually think to save it for distribution, like a dummy :x. Sorry about that!

Hello Billy. Great tutorial series.

My situation:

A player overlaps a box.

A function is called.

The player is moved (inside of function above^).

The problem is the player controller index. Everything works as designed and is replicated as desired. The problem is what happens if player index 1 overlaps the box. Then player index zero is moved. Where am I going wrong? The ‘get player controller’ or ‘the cast to pawn’

Thank you in advance.

The “Get Player Controller” is probably your problem, depending on how you have it setup. That function returns the player controller associated with the player index you provide. It looks like in your case, you have it always as zero, so it’s always going to pick the first one. A note here, the “Get Player Controller” node in general is a bit tricky, as it will return different values for the server and the client. Player controllers exist on the server and then are only replicated to the client that owns them. As an example, pretend you have 4-players connected to a dedicated server. If you use “Get Player Controller” on the server, it will have 4 possible values (indices 0-3), as it has a player controller for each player in the game. If any individual client calls “Get Player Controller” though, they’ll only have one possible value, their own controller.

In your specific case, are you saying you’re calling “Set Actor Location” inside your Move function? If so, I’d suggest just making your Move function also have an input parameter that is a pawn, then you can pass the result of your cast right into the function and use that one directly.

Funnily enough I solved this issue moments after I sent you that pm to take a look. When the player overlaps the start box and I cast to pawn I simply store that variable and then use it as the target of set actor location. This is the exact solution you just provided me. I appreciate your time and help Billy.

Hi billy awesome stuff thanks. Can you do a follow up video on something i know a lot of people struggle with, how to replicate animations. For example a reloading animation so that when the client reloads everyone sees it happening. All the examples and documents i can find are complicated and dont really explain properly Thanks

First off HUGE THANKS for the tutorials! I love the Epicness of the Epic Devs/Community.

^ I am very interested in an example of replicating animations,head turn, on a dedicated environment.

I could be totally wrong, but I think the main thing there is making sure the variables that drive your AnimBP are set to replicate.