C# Networking API for Unity
This proof-of-concept Unity Networking Package was my Final Year Project at University. Created in 6 months of tough research and development, it deepened my understanding of the history and technology of networking in games. The artefact alongside an 11,000 word dissertation was graded to have achieved 80.8% of the possible marks. The project was to research and create a prototype Multiplayer API that was capable of connecting games across the internet.
Features
- Packet Handling
- Runtime Object Spawning & Synchronisation
- Ownership & Authority
- Automatic Variable Synchronisation
- Client and Server Remote Procedure Calls
How It Works
This project provides a framework to connect Clients to a Server and allow them to send Packets to eachother, which are then interpreted to create fully functioning multiplayer gameplay by interacting with Unity's systems. Networked Objects are given unique IDs that allow for manipulation across the network.
Packets are easily createable and automatically handle serialisation when sending and receiving, and methods are provided to call functions when receiving specified Packet types on both the Client and Server. Serialisation can be overriden when more complex control is needed, for example to compress Packet sizes like the in built Network Transform does.
MonoBehaviours can be replaced with NetworkBehaviours, which provide the tools to automatically synchronise variables with the [SyncVar] attribute as well as remotely call functions with the [ClientRPC] and [ServerRPC] attributes.
Source Generators were used to provide additional complex functionality, such as efficiently registering custom Packets, generating the code to synchronise networked variables as well as call remote functions. The Source Generator source code can be viewed in the "Source Generators" folder in the GitHub repository.
Download
The package is available on my GitHub, where you can also view the source code and the Pong demo project.
Download Source