A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Connected Games' started by unity_94d33m, Mar 13, 2019.
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 https://forum.unity.com/forums/entity-component-system-and-c-job-system.147/ it becomes even more puzzling.
Do not ever suggest that, please.
Care explain why? Isn't an option, which fits to OP requirements?
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.
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.
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
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.
I was talking about LiteNetLib allocations. Especially with their NetPacketProcessor utility.
MLAPI is just missing more upto date examples, I think it has a project that is like a year old all these network libraries are really missing good examples that are simple and not on the overdone large side (mirror has vis2k own projects built on it but nothing you'd want to pick apart) unet has many tutorials and assets built for it, but good as useless now really because you'd want to use mirror and hardly anything on the tutorial side for that, that wouldn't just be watching unet tuts and then going through the ballache of figuring out what that is meant to be in mirror, and then the other asset store addons that support unet, well some are supporting mirror now given its similarity... MLAPI needs that to happen or have built in equivalents imo.. not sure if it has much community support/discord etc?
Mirror now has LiteLibNet udp library as a transport alternative, so I'm inclined to settle down on that and stop wasting time loooking around but MLAPI looks good its just I need good examples and docs with examples to get started.
Examples have been on the TODO for a long time and will be started shortly.
Support for the MLAPI is good, I dedicate much of my time for that, if someone needs a feature. I will almost always happily build it in in a short amount of time.
Is there any tutorial to accompany this fps sample (specifically the netcode authoritative server part)? I was just beginning my learning on networked multiplayer games using Unet some months ago, now I have more time again I wanted to learn more but I don't want to just download sample code as I'll likely never figure out how it works).
There are official Unite talks, which discuss FPS networking technical aspects, along with other talks. Is not really tutorial, but will give you an idea, how it works, quite in detail. Since I am on the phone, I don't have link of hand. Sorry.
I don't have plans to use a community run version of networking. I will either use Photon or Unity's new one. As Unity's new one doesn't have many details at time of writing, I don't have a judgement on if it is good or not so I won't be talking about that until I see it.
For hobbyists or tinkerers I suggest nobody pays for a networking library. Unet is fine (from package manager). Community ones are all fine IF they are 100% free. Seriously, easy to get fooled by hungry sellers so don't buy anything. No point.
Indies should use Photon if selling and need it managed. Don't bother if the company isn't reputable. And it should be a company providing it. Way safer bet.
Pros shouldn't be reading this
Thanks mate I will try to find them now
I would like to add to that IF.
If they are 100% free AND open source. It really makes a big difference.
Im sure most people already found this, but I couldnt find it immediately and ended up here after searching for it. But this github page is the hub for the new FPS Sample for Unity (https://github.com/Unity-Technologies/FPSSample) and this video is the presentation from one of its creators:
I'd second that, if some of you clever cloggs out there are able (and willing :]) to make a free AND open source solution, that would be my first choice as a hobbyist/learner trying to implement a small online game purely for fun/personal use (with a view to one day perhaps being able to build a commercial game using the same tech). Many times the 3rd Party solutions have better documentation and are sometimes easier to get into as a beginner
The MLAPI for example is free and open source. So is many other solutions. It's not that difficult to find them.
I guess its not if you understand what you are looking for. For me, I get mixed up between the deprecated/obsolete stuff and other parts. I believe all my experience thus far is with the HLAPI (so when I make a class extend NetworkBehaviour and then I use OnStartServer() or [ClientRpc] that is all gone now.)
But if I want to make the very simple game of capsules shooting little cubes at eachother in a multiplayer environment I have no clue how to make them a networked gameobject any more. I can very quickly make the game as a single-player game, but I just need some help where to start on make a server and how to make it communicate with my existing small scripts (which make the player move , shoot and take damage for example).
(NOTE: I do understand that the questions I'm eluding to hereare not straightforward and probably don't have quick answers -but at least the old system had full documentation with Unity and some very helpful and basic tutorials, this new way I cannot find anything which is a pure example of basic game working in this dedicated server fashion)
Hope that makes some sense, i am somewhat confused :S
(....I'm gonna study the MLAPI till i drop and see if I can bash something together.... thanks for your help my friend!)
Sounds great, any questions are happily answered on the discord server. This is what's good with any active projects (doesn't just apply to the MLAPI). Usually there are active discord or other chat services where you can ask ppl about any problems you encounter.
Sorry to keep bugging you , but I am wanting to get started using your MLAPI and just wondering do I need to download only the Example Project or must I also download the full library from Github? (Im guessing that the Project will include the library already but I dont want to get confused any further so thought Id ask you here first)
I've joined your discord and im looking through the examples now. I'm having a little trouble starting the Example Project so I'll probably be in touch on discord soon. Thanks again
You are never bugging me. But since this is getting a big off topic. You are welcome to chat in the discord. A brand new Example project is in the works
Not offtopic. Only limitation here is that it must not be a paid networking library promoted. Talk about free networking libs as much as you'd like. Preferbly open source.
(Photon is not free but they don't need to be discussed really, the info is everywhere).
I was interested when unity talk about new multiplayer solution replacing Unet :
But since then (7-8 month after) no real news about this ? Or am I missing it somewhere (and searching about it is the point of coming to this thread in a first place).
Nope, no real news. But Joachim Ante himself has specifically mentioned networking and how important it is to the engine at GDC two years in a row now, so I'm keeping the faith. Plus with the acquisition of Vivox and Multiplay Unity networking is starting to look like it will have a pretty awesome future. Although I expect long time frames on this (ala the SRP).
Doesn't excuse the poor communication from the networking team though.
Yes, the physics engine on package manager (fully deterministic for networking with stateless rollback) is a big part of this.
The deterministic behaviour will be fully realised with a Burst update later in the year.