C++ Multiplayer Tutorial Needed

Hm so you want a tutorial about Replication in general? Nothing about creating sessions, joining and hosting in C++?
Because the Session thing is quite complicated to explain. You will have to look into the ShooterGame or ask someone
who might already done a basic session setup.

The replication thing in the other hand is already explained by Epic itself. The idea behind it is the same in C++ and BP.
So to understand the background, you can take the BP stuff.

The C++ Part now, is only the way to need to define functions and variables.

The normal way is, that you set the bReplicates bool to true, add the Network.h as an include
and then create your Variable and Functions that should replicate.

How to do this?

The UPROPERTY and UFUNCTION macro gives you everything you need.

For example this:


UPROPERTY(Replicated)
    float Health;


will create a replicated float variable. You now need the general function that takes care of the replication.
It is everytime the same function for all replicated actors:


GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const

In there, you call the “Super::GetLifetimeReplicatedProps(OutLifetimeProps)”
and list all your replicated variables, with and without conditions:


 DOREPLIFETIME(AYourCharacter, Health);

Functions are working similar. But before i continue copy pasting stuff from the wiki, i will just leave you the
link to read through it and see yourself how to define variables and functions for networking.

If you want to learn about general networking, you might want to check out Epics Youtube Channel (Unreal Engine)
and their Network tutorial.

Or you visit my youtube channel, and check out my stream recap about networking. Although i always say, that i
can’t guarantee that it is pretty good. I just talk about how networking works and show some images. Maybe it helps you (:
https://youtube.com/watch?v=_JCBNHfvUA4
(: Feel free to ask question if you still have them after watching the videos and reading the wiki.