How can I implement multiplayer for a simple game and can I do it for free?
One of many options is mirror.
Wow this is very new, Iāll have a look into it thanks alot buddy
There is an ECS-based networking framework included with the FPS Sample.
Beyond that though there isnāt an official replacement for Unet.
Mirror is older than you think it is. It just wasnāt available for anything other than non-commercial use until recently.
Donāt hold your breath for Unity. If you liked UNET mirror is probably the way to go, but there are lots of other options if you want to go low level.
Itās now been 5 months since the transport layer repository has had a significant update and the transport team has been strangely quiet about progress. The only information that theyāve deigned give, is that they are awaiting changes to Unity before they release any updates.
When you contrast this with the forthright communication coming from the ECS/Jobs group at Unity Engine - Unity Discussions it becomes even more puzzling.
Do not ever suggest that, please.
Care explain why? Isnāt an option, which fits to OP requirements?
+1.
Mirror by far is the easiest to migrate over from UNET, but others like MLAPI and even TinyBirdNet (which aims to be a UNET-like environment on LiteNet) exist.
https://discussions.unity.com/t/636221 page-23#post-4238383
https://discussions.unity.com/t/636221 page-23#post-4237225
The developer blatantly deletes his posts from the topic. Nonsense.
"
The Mirror project proudly announces itself as āMMO Scaleā. When it comes to memory management, itās some of the worst I have seen. Just to send a single message, the message is copied and reallocated multiple times too using .ToArray() methods. Everything to save a few lines of code while taking a huge hit on performance. Both GC pressure and CPU usage are ignored for the sake of saving a few lines of code.
Another great example is the Telepathy transport which is Mirrorās default transport. It spins 2 threads per client just for a read/write loop as opposed to having a general read/write thread that dispatches to each client. By having 2 threads be created per client, at anything close to MMO scale this will cause CPU exhaustion and also require more expensive servers. On a smaller scale, it can impact game performance and require higher requirements than sanely needed. Even Microsoft has said that the āone thread per client model is well-known to not scale beyond a dozen clients or soā, so imagine two threads per client.
Looking over the source code you can find many decisions that align with a lack of consideration for performance. LinQ, which is VERY known to be generous with the amount of garbage it generates, is used in many places instead of a simple for loop in order to save lines. This is clearly documented in Unityās guide Optimizing garbage collection in Unity games.
Memory is never reused. Itās copied and reallocated multiple times per message and is then at the end thrown away.
"
Thank you for detailed explanation.
I know you work with networking solution, so you have solid understanding on the topic.
I agree, that taken approaches, are representing poor, or rather lack of optimization. Hence, you have raised valid concerns.
However, as per OP requirement and potential basics capabilities, I donāt expect OP writing own solutions.
I could perhaps suggest FPS sample based networking, as good alternative, but I am afraid, it may be beyond OP knowledge yet, to understand its implementation. I may be wrong tho.
Sure, there are other solutions too, free with basics features/capacity, then need pay respectively.
Yet, despite all that, for free and very basics features, I believe still, mirror is something that can be good to beginner to start of. It gives at least opportunity, to learn principles, without getting too deep into networking.
Eventually when hit the wall, or pocket are deeper, better solutions can be considered.
Thoughts?
I actually talked to the MLAPI developer about that article and cleared a lot of things in that post. Actually had quite a good chat about it and came out with a constructive outcome.
But this is going off topic and weāre not here to do politics. Letās keep it on track, bringing up the same arguments that are seen in your other posts in other threads is pointless here, wobes. The OP wanted to know what replaced UNET, thereās a lot of options, they can pursue on their own.
@Antypodish You are more than welcome to stop by the Mirror Discord. Weāre a friendly community and weāll be glad to help point you in the right path. Heck, weāve even got a FPS Sample in the works. Iām using Mirror for my own third person shooter title and internal tests have been going really good.
Where is the fps sample located? sounds like a much better example project for newbie to pick apart than pong etc
Here https://unity.com/fps-sample
But is far beyond anything simple, specially for someone starting. It also uses ECS.
No not that bloat, the mirror fps sample, should be something lightweight and easy to explore all the parts that make it run
I just released a new asset that I think qualifies as a replacement for UNet. Itās called Noble Connect, and it provides relays and punchthrough for UNet (and other networking systems very soon). This means that even though UNetās relays are going away you can still use the UNet API with the Noble Connect relay services. This also has the advantage of adding built in punchthrough, which UNet never even had.
Additionally, if you purchase the Starter Pack it comes with our Match Up asset which completes the set-up by adding matchmaking to replace the UNet matchmaking that is also going away.
Unfortunately I donāt think youāll find a true replacement for UNet that is free, because UNet included relays and those are always going to cost you.
Hopefully anyone who is looking to keep using the UNet API finds it useful.
The MLAPI also has a free relay. But donāt expect the same finish as something from @thegreatzebadiah , itās much more DIY and more proof of concept. But it does work just fine and is performant (no copies, protocol suffixing and such)
As for replacing UNET HLAPI, I suggest checking out MLAPI
You seem to be knowledgeable about network programming in Unity. What solution would you recommend that is both easy-to-use and performant?
LiteNetLib with an abstraction of MLAPI would be far enough performant and easy to use. Be careful with GC though. DarkRift also seem to be a good solution.
Reference to some benchmarks: https://github.com/nxrighthere/BenchmarkNet/wiki/Benchmark-Results
The MLAPI will almost not generate any garbage. We reuse almost all memory.