PurrNet
  • 🐈Introduction
    • ‼️Unique to PurrNet
    • 💲Pricing
    • 💻Compatibility
    • 📚Addon library
    • 🗺️Roadmap
    • 🏎️Performance
      • RPC Benchmarks
      • Network Transform benchmarks
    • 🥰Support PurrNet
  • 📚Guides
    • Installation/Setup
    • Getting Started
    • Converting to PurrNet
      • Converting from Mirror
      • Converting from FishNet
    • Lobby System
    • Networking custom classes, structs & types
    • Chat system with broadcasts
    • Easy Multiplayer Physics (input Sync)
  • 🎮Full game guides
    • 🔫First Person Shooter
    • 🪓Survival Game
  • 🖥️Systems and modules
    • Network Manager
      • Network Rules
      • Network Prefabs
      • Network Visibility
        • Distance condition
      • Transports
        • Composite Transport
        • UDP Transport
        • Web Transport
        • Local Transport
        • Steam Transport
        • Purr Transport
      • Authentication
    • PlayerID (Client connection)
    • Network Identity
      • NetworkBehaviour
      • Ownership
      • Sync Types
        • SyncVar
        • SyncList
        • SyncArray
        • SyncQueue
        • SyncDictionary
        • SyncEvent
        • SyncHashset
        • SyncTimer
      • Don't destroy on load
    • Network Modules
    • Collider Rollback
    • Client Side Prediction
      • Overview
      • Predicted Identities
      • Predicted Hierarchy
      • Best Practices
      • Input Handling
      • State Handling
    • Plug n' play components
      • Network Transform
      • Network Animator
      • Network Reflection (Auto Sync)
      • State Machine (Auto Networked)
    • Spawning & Despawning
    • Remote Procedure Call (RPC)
      • Generic RPC
      • Static RPC
      • Awaitable RPC
      • Direct Local Execution of RPCs
    • Instance Handler
    • Scene Management
    • Broadcast
  • 🤓Terminology
    • Early Access
    • Channels
    • Client Auth/Everyone (Unsafe)
    • Host
    • Server Auth (Safe)
  • 💡Integrations
    • Dissonance
    • Cozy Weather
Powered by GitBook
On this page
  • Converting individual parts (& differences)
  • Network Manager
  • PurrNet Network Identity vs Mirror Network Identity
  • Spawning & Despawning
  • RPC's
  • SyncTypes
  1. Guides
  2. Converting to PurrNet

Converting from Mirror

PreviousConverting to PurrNetNextConverting from FishNet

Last updated 1 month ago

Keep in mind that both PurrNet and Mirror are systems which are constantly evolving and could be prone to change.

Converting from Mirror to PurrNet is fairly simple given that both systems have similar logic for developers.

It is recommended to do the conversion in a separate project in order to use the "old" project for comparison.

Make sure your project is backed up prior to beginning any conversion!

Converting individual parts (& differences)

Network Manager

Both Mirror and PurrNet rely on a NetworkManager to handle network operations, but their implementations differ. This is somewhat what a setup on a gameobject with both systems looks like: Mirror:

  • Network Manager

  • Transport

  • A list of Spawnable Prefabs

  • Built-in callbacks for connection management & registering

PurrNet:

  • Network Manager

  • Transport

To easily setup your Network Manager in just seconds, please have a look at the guide.

PurrNet Network Identity vs Mirror Network Identity

Comparison

Mirror:

❌ No support for nested networked prefabs.

❌ Single ownership per GameObject.

❌ No runtime un-parenting of transforms.

❌ Can't do generic RPC's

❌ Can't do static RPC's

❌ Can't do returnable RPC's

PurrNet:

✔️ Supports nested prefabs.

✔️ Allows different ownership per component on a GameObject

✔️ Enables dynamic transform management at runtime.

✔️ Can do generic RPC's

✔️ Cam do static RPC's

✔️ Can do returnable RPC's

Spawning & Despawning

Handling new objects or removing existing networked objects is a bit different between the systems. In Mirror, you'd need to instantiate the object and spawn the attached NetworkIdentity component. And if you'd want to spawn with ownership, it would be added as a parameter to the spawn call. That would look like this: Mirror:

GameObject go = Instantiate(myPrefab);
NetworkServer.Spawn(go, connectionToClient);
NetworkServer.Destroy(go);
var identity = Instantiate(myIdentityPrefab);
identity.GiveOwnership(ownerPlayer);
Destroy(identity.gameObject);

RPC's

Mirror
PurrNet

[Command]

[ServerRpc]

[ClientRpc]

[ObserversRpc]

[TargetRpc]

[TargetRpc]

SyncTypes

[SyncVar]
private string mySyncName;

private void MyMethod(string newName) {
    mySyncName = newName;
}

Setting up a SyncVar and changing value in PurrNet:

private SyncVar<string> mySyncName = new();

private void MyMethod(string newName) {
    mySyncName.value = newName;
}

Subscribing to changes with synchronized variables is also a bit different, but easy with both systems

Mirror:

[SyncVar(hook = nameof(OnNameChange))]
private string mySyncName;

private void OnNameChange(string oldName, string newName) {
    
}

PurrNet

private SyncVar<string> mySyncName = new();

private void Awake() {
    mySyncName.onChanged += OnNameChange;
}

private void OnNameChange(string newName) {
    
}

In both systems, everything that needs to act on the network, must have a Network Identity attached. The difference being that Mirror's network identity acts as a full gameobject networking component. PurrNet's is what every networked component inherits from, and isn't a component of its own. This is meant to give the ultimate flexibility for the developer(s).

PurrNet handles automatically, however, if you want to modify something relative to the identity, you can do that at the same time as spawning it, and it will arrive in the same packet. PurrNet:

Working with RPC's from Mirror to PurrNet is pretty easy, as the naming conventions change, but functionality remains. However, there are some key differences in terms of usage. This will depend on your so make sure to read up on those. If you are running with a rule set similar to the default "ServerStrict" rules, then the usage will be the same. But if you're running with a rule set similar to the "Unsafe" rules, then you can send any RPC directly from any client!

Synchronizing is a bit different between the systems. It's similar in naming and nature. Both systems are meant to automatically sync for you, however, the setup and usage slightly varies. Other than that, PurrNet also allows for fully owner authorized SyncTypes, making them instantly responsive to it's controller. Read more on this in the individual . Setting up a SyncVar and changing value in Mirror:

📚
Getting Started
Network identity
spawning & despawning
Network Rules
SyncType guides