Custom networking with a custom-made server

I was wondering if it’s possible to implement custom networking? I wanted to make a C#-coded server that’s separate from the UE4 code, and have my game, which does use UE4’s code, communicate with it? Additionally, I’m not too comfortable leaving the networking up to the engine. I’d prefer to use Boost for the networking code. Is there such a way? Am I going to be sacrificing any abilities?

Of course there is a way. Here is a decent starting point for having the client connect to a third party server:
Wayback Machine LINK HERE

http://www.osnapgames.com/2014/05/24/connecting-to-a-third-party-socket-server-in-unreal-engine-4/.

From there, network communication is the same as if you wrote your own client and server applications. The big thing is how to handle serialization. You can easily send data from UE4, serialized to your server. However, you need your server to be able to deserialize that data into meaningful objects it can handle.

I wouldn’t say it would be abilities you are sacrifice… but a lot of time. I would suggest serializing the data you send into some kind of common format that would be easy to implement on both sides. First one that comes to mind is JSON.

What you need to consider:
Cost Effectiveness - Is it really worth the extra work to feel comfortable?
What Do I Gain - What is the value of having my own dedicated server and the extra time needed to do this
Why am I doing this - If I can list a couple of things that UE4 absolutely cannot do, then I should be doing this
Application Protocol Requirements - How do I have both endpoints serialize/deserialize data

Edit: Added Wayback Machine Link

Well, suppose I wanted to encrypt the packets or send them over SSL to prevent cheaters/hackers. This comes especially in handy in the case of login information being sent/received. Additionally, I’d like to make my server modular via plugin DLLs, since I plan to distribute it with the game, and C# helps with that moreso than C++.

Unfortunately provided link is not active anymore. So if anyone else has tips and tricks on this please respond :slight_smile:

FTFY

You can create a C# library to serializes and de-serializes data in a way to matches Unreal’s FArchive. Then you can just serialize data in Unreal or your server app and send back and forth over a socket connection or messaging app like RabbitMQ.

Other than FString, the primitive types are the same bit length. FStrings put the string length as first four bytes, and then adds a null terminator (0).