Mirror Networking
repository·master·Indexed 27 days ago
https://github.com/mirrornetworking/mirrorA free, open-source, and modular game networking library for Unity supporting a wide range of game types from small multiplayer games to MMORPGs. It features a modular transport system (including KCP, Telepathy, and SimpleWebTransport), interest management, RPCs, SyncVars, and built-in synchronization for transforms and physics. Mirror is compatible with Unity versions 2019, 2020, 2021, 2022 LTS, and 6000.1.
What's inside Mirror
- SimpleWebTransport is a transport layer implementation that uses WebSockets. It is specifically designed for WebGL builds but is also compatible with standalone builds. It supports encryption via WebSocket Secure (WSS). It can be used as a low-level transport for high-level networking solutions like Mirror or Mirage.
Overview of Mirror Networking features
masterMirror is an open-source game networking library for Unity that provides a wide range of features for various game genres. Key capabilities include:
- Transports: Support for UDP, TCP, Websockets, Steam, Relay, and more.
- Interest Management: Spatial Hashing and Distance Checker for world partitioning.
- SyncDirection: Per-component Server and Client Authority.
- Latency Simulation: Local simulation of latency, packet loss, and jitter.
- Batching: Automatic minimization of message overhead.
- RPCs & SyncVars: Built-in safe remote function calls and synchronized variables.
- Allocation Free: Designed to be free of runtime allocations and GC (except for Transports).
- Transform & Physics: Built-in synchronization for transforms and physics.
- Snapshot Interpolation: Smooth movement across platforms.
- Lag Compensation (Beta): State rollback for input synchronization.
- Encryption (Beta): End-to-end secure communication.
- Cheat Detection (Beta): Mirror Guard for detecting tools like Melon Loader.
Access Mirror Documentation and Support
masterFor detailed guides and troubleshooting, use the following resources:
- Official Documentation: https://mirror-networking.gitbook.io/docs/
- Discord Support: https://discordapp.com/invite/N9QVxbM
- Bug Reports: https://github.com/vis2k/Mirror/issues
Install the Edgegap Unity plugin via Git (Recommended)
masterInstalling via Git ensures you receive the latest updates automatically.
Requirements: A functioning git client (e.g., git-scm) must be installed.
Instructions:
- Open your Unity project.
- Navigate to Window -> Package Manager.
- Click the + icon and select Add package from git URL....
- Enter the URL:
https://github.com/edgegap/edgegap-unity-plugin.git. - Click Add and wait for the installation to complete.
https://github.com/edgegap/edgegap-unity-plugin.gitInstall Edgegap Relay for Mirror
masterTo use Edgegap Relay with Mirror, follow these steps to integrate the EdgegapTransport module into your Unity project:
- Download and Extract: Ensure you have the
EdgegapTransportmodule downloaded and extracted. - Import Module: Drag and drop the
Unityfolder from your extractedEdgegapTransportfiles into your Unity project'sAssets/Mirror/Transports/folder. - Configure NetworkManager:
- Select your
NetworkManagerobject in the Unity Editor. - In the Inspector panel, locate the
Network Managercomponent. - Click the + button next to the
Transportproperty. - Select
Edgegap Transportfrom the Add Component menu. - Drag the newly added
Edgegap Transportcomponent into theTransportproperty field in the Inspector.
- Select your
- Download and Extract: Ensure you have the
Install the Edgegap Unity plugin via ZIP archive
masterUse this method if you do not have a git client installed. Note that you must manually replace files to update, and you must ensure compatibility with your project's
newtonsoft-jsonversion.Instructions:
- Navigate to Window -> Package Manager.
- Click the + icon and select Add package by name....
- Input
com.unity.nuget.newtonsoft-jsonand install it. - Download the ZIP archive from the Edgegap Unity plugin GitHub repository (ensure you are on the
mainbranch). - Unzip the archive and paste the contents into your Unity project's
Assetsfolder.
com.unity.nuget.newtonsoft-jsonInstall and Configure Mirror for Unity
masterTo use Mirror in your Unity project, ensure you meet the following requirements and follow the post-import step:
Requirements
- Unity Version: 2019 or 2020 LTS
- Runtime: .Net 4.x (Configure this in
Project Settings > Player > Other Settings)
Post-Import Step
IMPORTANT: You must restart Unity after importing Mirror to allow the Components Menu to update and reflect Mirror's networking components.
Get started with Mirror Networking
masterTo begin using Mirror in your Unity project:
- Ensure you are using a supported Unity version: 2019, 2020, 2021, 2022 LTS, or 6000.1.
- Download Mirror from the Unity Asset Store.
- Open one of the provided examples in the package and press Play to see it in action.
For detailed learning, refer to the official Mirror Documentation. If you are migrating from UNET, use the Migration Guide.
Update the Edgegap plugin in Unity
masterDepending on your installation method, follow these steps to update:
- Git Installation: Open the Package Manager in Unity, locate the plugin, and click Update.
- ZIP/Manual Installation: Delete the existing
Edgegapfolder in your project and paste the contents of the newer version. Your settings are saved in your Unity version and should not be lost.
Report security vulnerabilities in Mirror
masterIf you discover a critical bug or security exploit in the Mirror core, do not disclose it publicly. Instead, follow the procedures outlined in the official Security Policy.Use Guard Anti-Cheat with Mirror
masterGuard is a source-code level anti-cheat solution designed for Unity games. It is embedded during compilation to provide high impact with zero risk. Guard includes a specific integration for Mirror networking.Requirements for SimpleWebTransport
masterTo use SimpleWebTransport, ensure your project meets the following requirement:
- Unity 2019.4 LTS or newer