Free networking framework for C#?

Started by
4 comments, last by hplus0603 7 years, 6 months ago

Hi,

I know Unity has it's own networking API but in the past I have run into major issues running this outside a local network where I got NAT Punchtrough errors, strangely these seem to be still present and I don't want to run into the same wall again. Recently I have been working a lot with Java/Libgdx and the Kryonet framework for networking, and this works great. Now I want to play around with Unity again and I was wondering if there is something like KryoNet for C#. I know there are some paid networking frameworks like Photon but I just want to play around and perhaps eventually setup my own server somewhere so I have full control over it.

I have been looking into C# socket programming and this works, but it's hard to make a robust client/server system without tons of knowledge. So is there a framework, perhaps similar to KryoNet for C#, that would work with Unity? Where I could just run the server without problems locally or from Raspberry Pi and connect anywhere with a service like noip.com or eventually from a paid service like VPS, AWS, Azure, etc. Or perhaps the HLAPI or the Transport layer do work now or there is some work around for that NAT Punchtrough error?

More specifically, I want to create a lobby and a matchmaking system where 2 or more users can play games with/against each other.

Thanks,

Advertisement

.Nets provide its own mechanism for networking:
System.Net

You also have WCF which is a service messaging framework.

If you still find it insuccifient, you may try this:

http://www.networkcomms.net/

I was actually using System.Net for writing my own Socket application and wasn't aware of WCF. I will be looking into it, all I currently need is functionality to send data between server and clients. I currently also have a working connection between a Unity client and a C# console server using Lidgren.Network.

edit:

Just looked at that link and that actually looks amazing. It looks to be well documented, I can't believe I missed that in all my searches.

WCF is wholly unsuitable for the front-end networking of multiplayer games. It can work fine for back-end service-to-service communications.

Lidgren is a C# game networking library. I don't know how easy it would be to integrate with Unity, whether the assemblies would work as-is, and such, but it might be worth a shot.
enum Bool { True, False, FileNotFound };

WCF is wholly unsuitable for the front-end networking of multiplayer games. It can work fine for back-end service-to-service communications.

Lidgren is a C# game networking library. I don't know how easy it would be to integrate with Unity, whether the assemblies would work as-is, and such, but it might be worth a shot.

It works good with unity. But I have to poll for new messages instead of catching it in a observer pattern. I currently got this polling working but I actually want to extend it with a observer pattern so I can override something like void OnGameWorldChanged(). But first I want to familiarize myself a bit more and have some sort of chat/lobby application with rooms.

I have to poll for new messages instead of catching it in a observer pattern.


The good news is that it's easy to go from polling to observer -- all it takes is a hash table :-)
Glad to hear it's working alright for you; please let us know how it works out in the future.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement