Networking In Unity

Engine:

Unity 3D

 

Team Size:

1

 

Role(s):

Programmer

 

Language:

C#

 

Year:

2017

Description

 

I worked on an authoritative multi-player networking system using .NET sockets over UDP for use in the Unity game engine. Everything is written from scratch including the serializer and concurrent classes. In addition to the networked code, I'm also used threads and synced the networked operations to the main Unity UI thread.

I included a CRC32 in the header for an extra data integrity check, along with an XOR encryption for a simple attempt to waylay tampered packets. Also included are sequence numbers and acknowledge numbers (and a bitmask to check previous acks).

There is still much that can be done for optimizations and features (like implementing RPCs), but as it is, it can send any type of data. It can support any number of clients (as long as the server's hardware can handle it). It sends data every frame instead of immediately so that it can pack smaller messages together (which is why the ping shows as 16-33).


Source code: https://bitbucket.org/ProtoTerminator/udpnetwork/

Tim Cassell

Game Programmer
cassell.timothy@gmail.com  |  (703)-909-1641  |  GitHub  |