Download

Training Livestream - Understanding Replication in UE4 - March 21 - Live from Epic HQ

What are best practices for managing Client and Server version numbers?

I have a plug-in that uses a client-only and server-only plug-in. So I need two different projects, Client and Server.

I use the same source to build both but when connecting the client to the dedicated server I have invalid version issues.

What process am I supposed to follow for this?

[QUESTION]
Are there any things to keep in mind about replication in terms of making a VR multiplayer game?

Why not use Server module and Client module for your project and add your plugin dependency accordingly? This way the plugin will only be compiled and distributed for that specific target and since you are using the same project you can have same build numbers. I am not sure about your specific workflow but for my project it simply generates a new build number for every compile and I can access it in both server and client so in packaged game I do a HTTP request to check if client is running the same version as of Server. :slight_smile:

I would love to see some discussion/advice on compressing data for physics replication.

Things like not sending velocity and just deriving it from delta position (with a high enough frame rate) and only sending 3 of the 4 elements of a quaternion for rotation.

Any more tips like that would be awesome.

The plugins add to blueprint functionality. So I need them active in my project before packaging. Correct me if I’m wrong but using your method would only have them activated after they are packaged to Client/Server targets?

Edit: Moved edit to new reply below…

#1: After a bit of research it sounds like modules might be what I need, are there any tutorials out there for creating them?

#2: Is there an easy way to add modules in a Blueprint Only game? C++ Class? Also I know this is a hacky way to do this but how would I enable this? Specifically the part at the bottom… “Used to allow BP only projects to override network versions”.

I would like to hear a few sentances about mobile “internet” multiplier in blueprints and where to begin. Thanks!

Already good questions in here, but I figure I’ll throw in some feedback anyhow.

With VR, we’re seeing a greater demand for environments you can interact with. If we want to bring that into multiplayer, it means replicating a lot of non-baked motion. In the past that usually meant physics, but now we have all kinds of motion controllers to account for that may be even more unpredictable in addition to physics.

Many games just use canned animations and dice rolls rather than actual physical events… Paragon for example feels like you’re fighting large hitboxes rather than physical characters when compared to Robo Recall, I’m sure that makes it easier to replicate.

If we want to come close to replicating Robo Recall, we need better prediction tools.

There are going to be cases where you want to handle a lot of secondary motion or local prediction on the client side, but need a way to tell the client to start or stop doing that efficiently, sorting that out can become rather tedious if you want fine control. In the context of advanced character movement, perhaps you only want partial replication or to only replicate few poses based on certain physics events(using that lovely pose snapshotting tool). Perhaps only for specific end-effector bones; such as an initial collision position/force and a rest/blend-out position.

Tim said he thought VR would end up being used for social interaction, and I consider throwing physics coffee cups and paper-wads at people social interaction.

Oh question time!

How should i qualify what i should replicate to every client and what should be done locally by the client? as example a sword hitting another player, causing a hit sound, Do i tell both clients to play the sound locally or send a RPC by the server so it tells the other clients to receive / play the sound as well?

Hi,

can you please show an Simple Example how to Replicate things like Grab a Stone and Drag it around or move it, and every client and the server can see it like the owning client sees it. I tried all combination of Execute on Server or Multicast or Execute on client and tried to replicate variables like transform or hit result but everytime the Clients dont get the same Information about the exact location of the stone at that moment, as the Player who moves/grabs it gets…idk how to explain.

Simple Example i spawn a stone all is ok on the client and on the server and on the 2nd client all get the same information and all looks good, but when im attaching the spawned Stone to my Grab Point and move it around, the server sees what the client does, moving in each direction and showing the right location of the grabbed stone at every frame, when the server grabs it, the client sees just the grabbed item and which direction the server is facing…and not getting the up down and looking information which the server gets from the client, where all looks good.

and when a release the grab on the both clients the stone disapears…

on the server is all ok i tried every combination of replicating in all forms i know but something is not working i have all Keys and functions in My player character as i tried to use it in my player controller nothing worked anymoore, is there any other point where i have to set the replication for moving things …i have checked all actors to replicate and if i spawn a stone and ran into it the information is ok it rolls around and all clients and server see the same but not when i grab…idk** an example of a simple grab which is replicated so all client see the stuff moving around would be great** or a tip how to do it, like replicate all or how all get the same information.

im not a noob in using unreal engine but the replication especially when u use attach to is a little bit confusing cause the clients dont get the world location of the grabbed or attached actor at anytime…thx for help :slight_smile:

Have a Good Day

Question: How do i properly replicate level streaming using listener client?
Example: I have two players in diffferent places with different levels streamed and dont want to load everything from one to the other

Question: Unreal Engine uses a Client-Server architecture. But is it possible to have two dedicated servers (running the same project but not the same map) communicate between each others using UE4? Say, with a server creating a beacon into the other server or some (or less) other trickery.

EDIT: Question answered on stream, thanks a lot! The answer was, it is possible but not out of the box. By instantiating UNetDrivers ourselves, we can instanciate a UNetDriver on a server that we make talk to another server instead of a client.

Question: How can you host multiple games at the same time on shooter game? I am thinking about it as a single dedicated server per map. So when I have two different levels loaded at the same time I am a little confused. Since it is using online subsystem=null are these separate levels just sessions? If so how many of these sessions can shooter game run at the same time?

Alexander / Ryan,
I noticed on the client side that projectiles were seemingly just rolling along the floor and not following the same projectile path as the server side was. You touched on it that it might have been a double montage playing as being the cause of the issue but didn’t talk about a solution.
How can this problem be fixed?

Just finished watching the recording of this stream - thank you for answering some excellent questions! I have a few to add that I wasn’t able to post earlier:

Can you explain why replicated variables are rounded off when sent to clients? For example, we’ve noticed that vectors seem to replicate fairly accurately (to a tenth I believe?), but rotators were being rounded to the nearest whole number.

Can you also help me to explain why the engine doesn’t “replicate everything”? My understanding of it is to minimize network traffic for smoother gameplay across devices with different internet speeds, and to prevent cheating. But I ask because I work with some folks who specialize in computer science, and they’re a bit baffled on why a client can’t be a mirror image of the server given today’s network speeds. They point out that variables should take very little bandwidth to update, while at the same time I cry “No! No replicating everything!”. I’m sure they’d appreciate a more detailed answer from a fellow programmer. c:

As a final note, I noticed that the subject of more C++ learning material was brought up briefly, and would like to add my vote towards future additions! I would especially like to see a sort of primer for those who came from UnrealScript and have no C++ experience. What is different, what is similar, how to approach mentally translating one language to the other as a starting point, ect. I can vouch that this would have helped me a lot when just starting out.

Any feedback on these would be greatly appreciated - thanks!

It does that to minimize the data size, it’s an optimization to keep the traffic minimized. I expect all fast paced online games to do this. The technique is called quantization, for example you can take a look at FVector_NetQuantize, FVector_NetQuantize10. FVector_NetQuantize100 etc. You can change the amount of accuracy you want per actor. With blueprints, you’d go to actors class defaults, expand advanced settings from replication and change it here:

I don’t know if there’s any way to turn off the quantization for built-in actor replication or if variables do get quantized automatically, but nothing prevents you from serializing the data yourself if you really need to have the full accuracy (and have enough bandwidth budget for it).

It’s to minimize the network traffic but also to provide low latency. It’s one thing to send a lot of data across the network and other thing to get that without a lot of delay from server to all clients as quickly as possible, Modern online games send packets around 60 times per second. In Unreal they send replication data after each Tick (as covered in the stream), so if your game is running 60 fps, you get also network packets sent 60 times in a second. While Unreal has mechanics to help with telling what is relevant and what is more important for replication, you shouldn’t waste the bandwidth for things that don’t matter for the gameplay/user experience. While such naive approach (replicate everything) could work for something slow paced where things move slowly, you can’t afford that way of thinking on a fast based online shooter etc. Also while network speeds are good for most part of the world, there are still places around where bandwidth is really limited.

[MENTION=8]Alexander Paschall[/MENTION], [MENTION=34]Ryan Gerleve[/MENTION], thanks for the stream and for the explanation about TickFlush. This helped me to get some confirmation for my assumptions how things work around UE4 replication.

My follow up question is: I want to send network updates from another thread at fixed intervals, what would be best approach to something like that using built-in UE4 systems? Syncing data on Tick before sending isn’t alternative (too much lag for networked physics since I need to do physics async to Tick).

My current assumption on how one could do this using steamworks:

  1. Create session
  2. Get players / server addresses from PlayerControllers
  3. Use (steam) sockets to send/receive manually serialized data between client/server
  4. Potentially use built-in replication for less time intensive data so one can keep the manually serialized data structure simple.
  5. Handle rest like usual

Is step 2 valid approach for something like this or is there some better way to that or the whole approach in general?

Useful stream - could do with another stream or two just answering everyone’s replication questions :wink:

Noticed there were a couple of questions regarding level streaming in multiplayer, would’ve been great to touch on that a little - I have an existing question here on that topic too: Level must be “visible” on server for client to walk on it?

#1: Creating a server module only works with UE4 that is compiled from source since the launcher ones don’t support dedicated server. I can give you a sample project if you want with server module but you will need source version to open it (I use promoted branch).

#2: Have’nt messed around with FNetworkVersion.

1 - A sample project would be fantastic. I am already running my blueprint project from 4.15 source!

2 - I’m still ramping up my C++ knowledge but with the FNetworkVersion apparently I need to bind a delegate to “GetLocalNetworkVersionOverride” which would allow me to override the network version check. Apparently I need to bind in to a GameMode object class, still wrapping my head around this a bit.