Mirror Networking

repository·master·Indexed 27 days ago

https://github.com/mirrornetworking/mirror

A 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.

Tokens
3.5K
Snippets
4
Records
28
Agent score
92%

What's inside Mirror

  1. Overview of Mirror Networking features

    master

    Mirror 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.
  2. Install the Edgegap Unity plugin via Git (Recommended)

    master

    Installing via Git ensures you receive the latest updates automatically.

    Requirements: A functioning git client (e.g., git-scm) must be installed.

    Instructions:

    1. Open your Unity project.
    2. Navigate to Window -> Package Manager.
    3. Click the + icon and select Add package from git URL....
    4. Enter the URL: https://github.com/edgegap/edgegap-unity-plugin.git.
    5. Click Add and wait for the installation to complete.
    https://github.com/edgegap/edgegap-unity-plugin.git
  3. Install Edgegap Relay for Mirror

    master

    To use Edgegap Relay with Mirror, follow these steps to integrate the EdgegapTransport module into your Unity project:

    1. Download and Extract: Ensure you have the EdgegapTransport module downloaded and extracted.
    2. Import Module: Drag and drop the Unity folder from your extracted EdgegapTransport files into your Unity project's Assets/Mirror/Transports/ folder.
    3. Configure NetworkManager:
      • Select your NetworkManager object in the Unity Editor.
      • In the Inspector panel, locate the Network Manager component.
      • Click the + button next to the Transport property.
      • Select Edgegap Transport from the Add Component menu.
      • Drag the newly added Edgegap Transport component into the Transport property field in the Inspector.
  4. Install the Edgegap Unity plugin via ZIP archive

    master

    Use 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-json version.

    Instructions:

    1. Navigate to Window -> Package Manager.
    2. Click the + icon and select Add package by name....
    3. Input com.unity.nuget.newtonsoft-json and install it.
    4. Download the ZIP archive from the Edgegap Unity plugin GitHub repository (ensure you are on the main branch).
    5. Unzip the archive and paste the contents into your Unity project's Assets folder.
    com.unity.nuget.newtonsoft-json
  5. Install and Configure Mirror for Unity

    master

    To 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.

  6. Update the Edgegap plugin in Unity

    master

    Depending 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 Edgegap folder in your project and paste the contents of the newer version. Your settings are saved in your Unity version and should not be lost.