Giter Site home page Giter Site logo

dragonslaya84 / mirrorng Goto Github PK

View Code? Open in Web Editor NEW

This project forked from miragenet/mirage

0.0 1.0 0.0 106.51 MB

Easy to use Network library for Unity 3d

Home Page: https://forum.unity.com/threads/mirror-networking-for-unity-unet-replacement.425437/

License: MIT License

C# 99.99% JavaScript 0.01%

mirrorng's Introduction

Mirror Logo

Documentation Forum Discord release openupm

Build Quality Gate Status SonarCloud Coverage Lines of Code Technical Debt Code Smells

MirrorNG is a high level Networking API for Unity.

MirrorNG is built and tested for MMO Scale Networking by the developers of Cubica.

MirrorNG is optimized for ease of use and probability of success.

With MirrorNG the objects in the client are mirror images of the objects in the server. MirrorNG provides all the tools necessary to keep them in sync and pass messages between them.

Architecture

The Server & Client are ONE project in order to achieve an order of magnitude gain in productivity.

Comparison with Mirror

When migrating a project from Mirror to MirrorNG, these will be the most notable differences.

MirrorNG Mirror
Install via Unity Package Manager Install from Asset Store
Errors are thrown as exceptions Errors are logged
[ServerRpc] [Command]
[ClientRpc(target=Client.Owner)] [TargetRpc]
Subscribe to events in NetworkServer Override methods in NetworkManager
Subscribe to events in NetworkClient Override methods in NetworkManager
Subscribe to events in NetworkIdentity Override methods in NetworkBehaviour
Methods use PascalCase (C# guidelines) No consistency
NetworkTime available in NetworkBehaviour NetworkTime is global static
Send any data as messages Messages must implement NetworkMessage
Supports Unity 2019.3 or later Supports Unity 2018.4 or later

MirrorNG has many new features

  • MirrorNG supports fast domain reload
  • Components can be added in child objects
  • Your client can connect to multiple servers. For example chat server and game server
  • Modular, use only the components you need.
  • Error handling
  • Version defines
  • Server Rpcs can return values
  • The default transport features DoS prevention
  • The default transport has CRC64 integrity check
  • MirrorNG provides unreliable channel out of the box

If you look under the hood, the code base has some significant differences based on the core values of each project

  • MirrorNG follows the SOLID principles.
  • MirrorNG avoids singletons and static state in general.
  • MirrorNG has high Test Coverage
  • MirrorNG has low Technical Debt
  • MirrorNG values code quality, Mirror values API stability

Installation

If you want to make a game with MirrorNG, the preferred installation method is Unity Package Manager.

Install from git url

Use unity 2019.3 or later.

  1. Install git
  2. Open your project in unity
  3. Install UniTask using Unity Package Manager
  4. Click on Windows -> Package Manager
  5. Click on the plus sign on the left and click on "Add package from git URL..."
  6. enter https://github.com/MirrorNG/MirrorNG.git?path=/Assets/Mirror
  7. Unity will download and install MirrorNG
  8. Set a Scoped Register to see updates

Scoped Registry

Install using openupm

This is how I do it for Cubica because unity will display all versions of MirrorNG and allow me to switch amongst them.

  1. Install git
  2. Install node.js 12
  3. Install openupm
  4. install MirrorNG in your project:
    cd YOUR_PROJECT
    openupm add com.mirrorng.mirrorng 
  5. Open your project in Unity

Install manually

If you prefer some pain, you can download it directly from the release section and add it to your project. You will need to manually install UniTask and Cecil.

Development environment

If you want to contribute to MirrorNG, follow these steps:

Linux and Mac

  1. Install git
  2. clone this repo
  3. Open in unity 2019.4.x or later

Windows

  1. Install git or use your favorite git client
  2. as administrator, clone this repo with symbolic links support:
    git clone -c core.symlinks=true https://github.com/MirrorNG/MirrorNG.git
    It you don't want to use administrator, add symlink support to your account. If you don't enable symlinks, you will be able to work on MirrorNG but Unity will not see the examples.
  3. Open in unity 2019.4.x or later

Transports

Here is a list of some transports supported by NG and how they compare to each other

Kcp Websocket Steam LiteNetLibNG IgnoranceNG
CCU 1000+ ? ? ? ?
Protocol UDP TCP UDP UDP UDP
Unreliable
WebGL
Mobile ? ?
CPU LOW HIGH ? ? ?
NAT Punch
Encryption
IPV6 ? ? ?
Managed
Based on KCP Websockets Steam Game Networking Sockets LiteNetLib ENet

Contributing

There are several ways to contribute to this project:

  • Pull requests for bug fixes and features are always appreciated.
  • Pull requests to improve the documentation is also welcome
  • Make tutorials on how to use this
  • Test it and open issues
  • Review existing pull requests
  • Donations

When contributing code, please keep these things in mind:

  • KISS principle. Everything needs to be as simple as possible.
  • An API is like a joke, if you have to explain it is not a good one. Do not require people to read the documentation if you can avoid it.
  • Follow C# code conventions.
  • Follow SOLID principles as much as possible.
  • Keep your pull requests small and obvious, if a PR can be split into several small ones, do so.

mirrorng's People

Contributors

paulpach avatar miwarnec avatar james-frowen avatar semantic-release-bot avatar uweeby avatar atlv24 avatar lymdun avatar michalpetryka avatar mrgadget1024 avatar katori avatar hertzole avatar timpickup avatar beguiled avatar icezman001 avatar softwareguy avatar dmerner avatar paulohmattos avatar phodoval avatar imerr avatar atikadze avatar konstantin890 avatar rxmarccall avatar shulinnn avatar callumferguson avatar apkd avatar dragonslaya84 avatar tomkrikorian avatar rocktavious avatar gabebigboxvr avatar lagunovas avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.