Hello guys, i have just started to learn how to use networking in UE4 C++, i have started with this tutorial: UE4 C++ Network Multiplayer Game - 0 - YouTube
My game has singleplayer & multiplayer modes, each of them using the same classes, so it should be the same logic only on the singleplayer, all the network code should be ignored
I am wondering in a big game scale, what is the correct design regarding to the networking’s code implementation & the actual logic’s code implementation
Do you think that both of them need to be in the same class? Or it should be separated? If so, how will be the design?
The networking code in UE seems to mostly belong alongside the actual logic. Networking is often intrinsically tied to gameplay. Ie, you might want clients to replay effects when a variable is replicated. In other words, so much of the networking has already done for you that everything that you would factor out has already been made for you by UE (unless you’re doing something outside of what UE supports)
If you want to achieve large scale networking within UE4 and you are using version 4.20 or newer, you can take advantage of their ReplicationGraph class. This way, you can make changes to the replication driver and define the way the server replicates information. Since it is such a new thing, the only documentation you can find on it is reading the comments in its source code. You can also find a more advanced implementation in the ShooterGame code.
With it, you can implement your network logic normally by using UE4 replicated variables and RPCs and then use the ReplicationGraph class to group actors in replication nodes and change they way their network info is updated.
If you build it correctly, you can support a huge number of players. They are using the same thing to achieve their player count for fortnite. Since fortnite has so much replicated info getting passed around, you can probably achieve even greater player counts for simpler games.
The only other solution is to not use unreal’s server and networking at all and write a network engine on top of it. You can use the UDP and TCP wrapper classes unreal has to exhange information between unreal and your custom server.