TNet: Tasharen Networking - XianWorld/xxxgame GitHub Wiki
Features
It’s Open: written in C#, comes as full source code for you to modify as you see fit.
It’s Readable: The code was written for others: it’s clean and thoroughly commented.
It’s Flexible: Server can be stand-alone, or started on another thread right within Unity.
It’s Adaptable: “Host” disconnects? Choose another. The game doesn’t end. Everyone disconnects? Save the state (if you want).
It’s Persistent: Not only can remote function calls be saved for future players, but you can save the entire server’s current state and then restart it. When you start it back up, it will be as if you’ve never shut it down (Auto-save anyone?)
It’s Powerful: Written to take advantage of high efficiency sockets (IO completion ports).
It’s Spacious: Each channel on the server is a separate area with its own rules (and save file), letting you host as many simultaneous games as your bandwidth can handle.
It’s Private: Playing by yourself? Put a password on the channel, or just flat out lock it. Others will still be able to PM you, of course.
It’s Consistent: You don’t need to put “if” statements everywhere. Same code that works for multi-player will work in single-player. The callback order is always the same. For example, players always get “left channel” notification before a “disconnect”.
It’s Efficient: You can optimize your frequent remote function calls by specifying a byte ID instead of a function name. Less data will be sent. You can also choose to send frequent updates (such as player position) via UDP instead for even less bandwidth usage.
It’s Straightforward: Remote function call syntax and number of parameters are up to you. Arrays? Sure. Binary data? No problem. A hundred parameters? Uh. Well, sure, if you want.
It’s Elegant: You can even broadcast messages to players on the same LAN or wireless network without requiring them to connect to the server. Perfect for announcing local servers, for example.
It’s Useful: You can save files directly to the server, and load them later, letting players save their avatar thumbnail, inventory, or even an entire game map for others to load.
It’s Friendly: With TNet’s Universal Plug & Play (UPnP) support, there is no need to open up ports on the router or mess with NAT punchthrough. TNet will open ports for you, and close them when you’re done.
Need more information? Check the Documentation page, or read up on the steps on how to get started.