Mirror is a high level Networking API for Unity, built on top of the low level Telepathy library.
Mirror is built and tested for MMO Scale Networking by the developers of uMMORPG, uSurvival and Cubica.
Mirror is optimized for ease of use and probability of success. Projects that use Mirror are small, concise and maintainable. uMMORPG was possible with <6000 lines of code. We needed a networking library that allows us to launch our games, period.
With Mirror, the Server & Client are ONE project (hence the name). Instead of having one code base for the server and one for the client, we simply use the same code for both of them.
[Server]
/[Client]
tags can be used for the server-only and client-only parts.[Command]
are used for Client->Server, and[ClientRpc]
/[TargetRpc]
for Server->Client communication.[SyncVar]
s andSyncList
s are used to automatically synchronize state.
What previously required 10.000 lines of code, now takes 1.000 lines of code. Therein lies the magic of Mirror.
Note: Mirror is based on Unity's abandoned UNET Networking system. We fixed it up and pushed it to MMO Scale.
This is a work in progress branch. The differences with mirror branch are:
- It is no longer built as dlls, you import the source directly in your unity project
- The TCP transport uses asynchronous instead of threads. From our testing, this scales a lot better.
- It only works in Unity 2018.2 and later, support for 2017.4 has been dropped
- Only TCP transport is provided as of this writing, LLAPI and websockets are WIP
- Proper error handling. Just override OnClientError and OnServerError in your network manager
Check out our Documentation.
If you are migrating from UNET, then please check out our Migration Guide. Don't panic, it's very easy and won't take more than 5 minutes.
We recommend to download the most stable Mirror version from the Asset Store!
For the latest improvements, Download Mirror directly from this repository and extract it in your Assets folder.
We included several smaller example projects in Mirror.
For a fully polished, complete project example, consider uMMORPG or uSurvival.
Mirror supports many different low level networking transports:
- (built in) https://github.com/vis2k/Telepathy (Telepathy)
- (built in) Unity's LLAPI
- (built in) https://github.com/ninjasource/Ninja.WebSockets (Websockets)
- https://github.com/Raystorms/FizzySteamyMirror/ (SteamNetwork)
- https://github.com/SoftwareGuy/Ignorance/ (ENet)
- https://github.com/MichalPetryka/LiteNetLib4Mirror (LiteNetLib)
Please support Mirror on GitHub. Priority support included!
- Telepathy 1000 connections test
- uMMORPG 480 CCU worst case test (everyone broadcasting to everyone else)
- uSurvival 122 CCU worst case test
“Would you tell me, please, which way I ought to go from here?”
“That depends a good deal on where you want to get to," said the Cat.
"I don’t much care where—“ said Alice.
“Then it doesn’t matter which way you go,” said the Cat.
- Alice in Wonderland (Lewis Carroll)
As Indie Developers, our #1 goal for Mirror is Ease of Use.
If you want to contribute, always follow the KISS principle. Everything needs to be as simple as possible. As result, the code will be stable, easy to understand, easy to modify and easy to maintain 5 years from now when our games are still running.
Pull Requests for bug fixes are always highly appreciated. New features will be considered very carefully and will only be merged if they are the most simple solution to the given problem.