Matt
Member
Please note that this add-on is currently under development and is not available for purchase. More details including the pricing and any closed alpha/beta testing will come in the near future. This is mainly an announcement and discussion thread - any progress will be posted as milestones.
To help keep the PUN Network announcement thread clear of Mirror discussion, this is the thread for the UCC Mirror Add-On.
The idea of my Add-on is to make it as transparent as possible so you don't have to get your hands dirty having to write the network code yourself. Basically, the features you see in the PUN integration should be in my Mirror add-on.
Let's get started!
Is Mirror better than PUN?
Both Mirror and PUN do the same thing - network your game. However, it's how the network system interacts with your code and scene that matters.
Photon Networking
Please note that my PUN knowledge might be very limited and/or incorrect. Do your own research about PUN before taking my words seriously!
PUN is based around a Peer-to-Peer Client Authoritative environment, where one client in a room behaves as a HostClient (Game Host and Client in one instance) while everyone else are connect to the host in client-only mode. The host client and standard client(s) all chat to each other each time something of interest happens.
This sort of communication is much like console P2P games (see Modern Warfare and Modern Warfare 2 on PlayStation/Xbox). As such these messages bounce back and forth between all clients all at the same time.
Photon is designed to get you running FAST... which means it's also based on a subscription model. You pay for the CCU and Messages Per Second. Your game gets relayed through Photon's Cloud services so players can be on a really bad connection (Australian internet) and Photon still has your back. It's also ideal for games that need quick and dirty network prototypes up and running without the fuss of server instances etc.
However, for some games like shooters, unless you are willing to spend big dollars on anti-cheat solutions, it makes sense to forfeit PUN for a server authoritative solution.
Mirror Networking
Mirror started out as HLAPI Community Edition. As someone who used it in the past for TPC 1.3.x networking, it was a godsend over Unity's buggy UNET implementation. Mind you, we are not talking about the new UNET that Unity is taking forever to implement with their "Multiplay" services - we're talking about the old UNET that has been around since Unity 5.
Mirror is designed for server authoritative networking in mind. Basically, the server instance - be it a Dedicated Server or Host Client instance - barks the orders and the clients must acknowledge them or they'll be booted off the server. Clients use Commands and the Server uses custom Messages or RPCs (Remote Procedure Calls) to tell Clients what to do. If a client tries to do something that requires server authority like set someone else's health on an object they do not own, then they are denied and an error is thrown.
NOTE: Both systems can run in client authoritative modes, however Photon is designed around it exclusively. Mirror is focused on server authoritative, but some components can run in client authoritative mode.
Which one is right for me?
That's the ultimate question. You need to do your own research and figure this answer out, but here's a few dot points:
To help keep the PUN Network announcement thread clear of Mirror discussion, this is the thread for the UCC Mirror Add-On.
The idea of my Add-on is to make it as transparent as possible so you don't have to get your hands dirty having to write the network code yourself. Basically, the features you see in the PUN integration should be in my Mirror add-on.
Let's get started!
Is Mirror better than PUN?
Both Mirror and PUN do the same thing - network your game. However, it's how the network system interacts with your code and scene that matters.
Photon Networking
Please note that my PUN knowledge might be very limited and/or incorrect. Do your own research about PUN before taking my words seriously!
PUN is based around a Peer-to-Peer Client Authoritative environment, where one client in a room behaves as a HostClient (Game Host and Client in one instance) while everyone else are connect to the host in client-only mode. The host client and standard client(s) all chat to each other each time something of interest happens.
This sort of communication is much like console P2P games (see Modern Warfare and Modern Warfare 2 on PlayStation/Xbox). As such these messages bounce back and forth between all clients all at the same time.
Photon is designed to get you running FAST... which means it's also based on a subscription model. You pay for the CCU and Messages Per Second. Your game gets relayed through Photon's Cloud services so players can be on a really bad connection (
However, for some games like shooters, unless you are willing to spend big dollars on anti-cheat solutions, it makes sense to forfeit PUN for a server authoritative solution.
For example, you shoot Sarah on your screen for 5 damage, and your client will say to everyone else in the room, "Hey I shot Sarah for 5 health". They all reply with acknowledgements and you see Sarah's health bar 5 points less.
Now Justin comes in with his overpowered RPG launcher and fires it at you for 200 damage. You just got swiss cheesed, so your client says "Haha, you got me, I want to respawn now". Again, the host and everyone else in the room say "That's cool" and you respawn.
Another example is you're looking at a explosive crate. And thinking it's a cool idea to play with that. Well, your client is busy saying "Hey I'm looking at the crate at XYZ, I'm also running interact ability" to everyone else. Everyone else in the room knows you're looking and playing with explosives.
Techy details:
PUN uses a CCU system which 1 connected client is 1 CCU. CCU stands for Concurrent Users. Each subscription tier has a CCU limit and Messages limit.
The benefit of this model is that it's easier as you have a fixed cost every month to run your game online, and it's faster to deploy. Exit Games also have cloud relays implemented so that you and your mates can connect anywhere when you have a stable internet connection.
The downside to PUN is that it seems that the Game Server host has to be Windows-only (citation needed) and some people don't like this subscription based system. PUN provides Networking as a Service (NaaS) and Exit Games could boot you off their services at any time.
There's also the problem of room security - unless you're using encryption, there's been hackers that breach the protocol layer of the Photon networking layer and can take control of rooms. For example, we had a developer come from PUN to Mirror because he had to bribe a hacker to stop ruining his online experience since the hacker would connect, take control of the room and randomly spam "kill player" packets to everyone for easy wins. This could be avoided by using encryption, for example.
Now Justin comes in with his overpowered RPG launcher and fires it at you for 200 damage. You just got swiss cheesed, so your client says "Haha, you got me, I want to respawn now". Again, the host and everyone else in the room say "That's cool" and you respawn.
Another example is you're looking at a explosive crate. And thinking it's a cool idea to play with that. Well, your client is busy saying "Hey I'm looking at the crate at XYZ, I'm also running interact ability" to everyone else. Everyone else in the room knows you're looking and playing with explosives.
Techy details:
PUN uses a CCU system which 1 connected client is 1 CCU. CCU stands for Concurrent Users. Each subscription tier has a CCU limit and Messages limit.
The benefit of this model is that it's easier as you have a fixed cost every month to run your game online, and it's faster to deploy. Exit Games also have cloud relays implemented so that you and your mates can connect anywhere when you have a stable internet connection.
The downside to PUN is that it seems that the Game Server host has to be Windows-only (citation needed) and some people don't like this subscription based system. PUN provides Networking as a Service (NaaS) and Exit Games could boot you off their services at any time.
There's also the problem of room security - unless you're using encryption, there's been hackers that breach the protocol layer of the Photon networking layer and can take control of rooms. For example, we had a developer come from PUN to Mirror because he had to bribe a hacker to stop ruining his online experience since the hacker would connect, take control of the room and randomly spam "kill player" packets to everyone for easy wins. This could be avoided by using encryption, for example.
Mirror Networking
Mirror started out as HLAPI Community Edition. As someone who used it in the past for TPC 1.3.x networking, it was a godsend over Unity's buggy UNET implementation. Mind you, we are not talking about the new UNET that Unity is taking forever to implement with their "Multiplay" services - we're talking about the old UNET that has been around since Unity 5.
Mirror is designed for server authoritative networking in mind. Basically, the server instance - be it a Dedicated Server or Host Client instance - barks the orders and the clients must acknowledge them or they'll be booted off the server. Clients use Commands and the Server uses custom Messages or RPCs (Remote Procedure Calls) to tell Clients what to do. If a client tries to do something that requires server authority like set someone else's health on an object they do not own, then they are denied and an error is thrown.
That said, the Mirror Networking API is completely open source apart from some paid add-ons that enhance things like 1000+ CCU. The benefit of being open source is that you can easily look at the code when you encounter a bug and get an idea of the code path your code is going through.
This makes it possible to use your own infrastructure in the form of cheap VPS from providers like Linode, Vultr, etc to run your online game servers, be it Windows, Mac or Linux. Or if you have the cash, you can rent a dedicated server with a full remote access solution and have real performance like how AAAs run the show. I have a in-house test server in Sydney that has this setup and it's sweet.
The downside is you need to know how to maintain a Windows/Linux based server and also open ports on the firewall. Linux based VPSes are cheaper and more secure to run, but you have to learn the Linux way of running binaries while Windows is point and click. Once that's sorted you're smooth sailing.
This makes it possible to use your own infrastructure in the form of cheap VPS from providers like Linode, Vultr, etc to run your online game servers, be it Windows, Mac or Linux. Or if you have the cash, you can rent a dedicated server with a full remote access solution and have real performance like how AAAs run the show. I have a in-house test server in Sydney that has this setup and it's sweet.
The downside is you need to know how to maintain a Windows/Linux based server and also open ports on the firewall. Linux based VPSes are cheaper and more secure to run, but you have to learn the Linux way of running binaries while Windows is point and click. Once that's sorted you're smooth sailing.
NOTE: Both systems can run in client authoritative modes, however Photon is designed around it exclusively. Mirror is focused on server authoritative, but some components can run in client authoritative mode.
Which one is right for me?
That's the ultimate question. You need to do your own research and figure this answer out, but here's a few dot points:
- Define your game genre. Fast paced games can be developed with Mirror or Photon. However, if you're going for a party game like Mario Party, then Photon will be a better fit. For a server tick-based system that has the final say as to what happened, then Mirror is the way to go.
- Do you need NAT punch through and relays? Photon ticks the box. Mirror requires additional setup, unfortunately.
- Do you want to be able to use a TCP and WebSockets multiplexing system at the same time? Mirror can do that.
- Are you planning to release for console (PlayStation/Nintendo Switch/Xbox)? Photon has been battle tested on those platforms, however due to limited resource power, Mirror has not been tested on consoles. That doesn't mean you can't use it, it could encounter some weird bugs that need to be reported.
Last edited: