It looks like you're new here. If you want to get involved, click one of these buttons!
So something I am noticing across the programming forum is that the "How do I do multiplayer" question is raised multiple times throughout the day, almost every day. The purpose of this post is to clear up some confusion about multiplayer, and how to implement it.
WHAT YOU SHOULD KNOW:
There is no universal way to implement multiplayer into Unity as of now. Many people reference the Brackeys "How to make a multiplayer FPS" tutorial as a guideline, but this should not be used as a way to implement multiplayer. In that video, Brackeys uses "UNET". This is Unity's old, legacy networking system that is being phased out.
If you make a game with UNET, that code will be obsolete and unsupported in less than a year. You can read more about UNET deprecation here.
Before I talk about options, I want to point out that networking is not only difficult, but it requires knowledge in C# and networking itself. Please make sure you understand how Unity works, and at the very least can program small games on your own, with minimal help from tutorials. If you dont know what you're doing, networking a game will hit you like a pile of bricks.
READ THIS ARTICLE! It has information about different networking protocols, and networking theory that will be imperative to your success!
Until Unity's new networking system is released, and complete, you're going to have to use your own networking code, or 3rd party software. Lets talk about the pros and cons of these.
YOUR OWN IMPLEMENTATION / C# SOCKETS
USEFUL NETWORKING INFORMATION:
Transmission Control Protocol - Wikipedia
Network Programming in the .NET Framework | Microsoft Docs
There are many more systems you can try and use, these are just popular ones you might want to try. If I made any mistakes please correct me, I am not an expert. I just see this question very often.
If you have any corrections, questions, or info about other software to put onto this list @Warp me, with a list of pros, cons tutorials etc and I will amend this post to reflect that.
I never used it, but Mirror is popular too: https://mirror-networking.com/
I personally went with the websocket approach when I needed multiplayer but I plan moving to one of those soon
@Roby65 I actually wanted to add Mirror to the list, but there is a letter limit. Im going to make a comment with some extra software people can use. Thanks!
that helps me a lot , but i believe that every big thing come by steps , as an amateur in game dev world i think we should make it step by step , muliplayer is an advanced level .
Forge also has a very helphulf community... You should join their discord even the creators of forge try to help you with any questions.
I have used both forge and mirror and I can say that both have absolutely great communities with devs ready to help anytime. I just find mirror easier to use, so I went with it, but your preference may vary.
Nice Post, this should be pinned!
I have recently had to make the decision of which path to take, and this post is very helpful to answer some of the questons I had. There is, however, still something I am unsure about - which is what Unity advices people to do. I haven't paid much attention to Unity's development the last few years, but from my understanding, this has been going on for a couple of years. And it will go on for one or two more, right? When you visit the UNET manual, you are told that it is deprecated and that you can see a blog post or FAQ to get more information. They have a flow chart that shows which system you should use, but it seems... Odd. And not very actionable. UNET will be deprecated, so it seems silly to pick that up now. But the new system is not at all done, and I have found next to no information about it (except for people explaining what it is). Unity's official web page on it seems more like an abstract ad with fancy buzz words than something that might be helpful.
Does Unity have any actionable advice on which path to take? Or is it simply left up to the community to figure out some Thord party software in this 4-year void? Have I missed something obvious?
I do not know about "Unity's actionable advice", if they had one, we probably would have known it. But, the reason why mirror and forge exist is the void you mentioned. Mirror for example is better version of UNET, simply put.
That is exactly what prompted me to make this post, other than the people asking about it on the forum. Unitys manual has an entire section dedicated to UNET multiplayer, but at the top of every single page in the manual is a link to the deprecation page.
I dont understand why Unity is treating multiplayer this way. Its a real shame too, because the new system will apparently not have good P2P support, which is what made UNET so great. The P2P relay system was awesome, because you didnt need to pay for servers. Now, it looks like they're leaving indie multiplayer in the dust.
They don't have any official advice as far as i'm concerned, but I dont care. Forge is better than UNET. Photon is better than UNET. Mirror is better than UNET.
I probably wont even check out their new multiplayer system. I dont trust them enough for it. Forge suits my needs, is open source, and has P2P capability, which is literally #1 when it comes to indie multiplayer.
Ill be sticking with 3rd party software for multiplayer.
I see. Thanks for the replies!
Happy to help!
@Warp This is a perfect discussion, thank you.
June 2020 - I am trying to get ECS + NetCode working on 2+ physical devices and am struggling. I have tried all the samples at https://github.com/Unity-Technologies/multiplayer with no luck as well as the DOTS Sample, which works brilliantly with Thin Client bots, but even if I build a Server and Client build and have running on the same LAN, they just don't connect.
I DID get the FPS Sample working perfectly with very little effort, so I could theoretically strip that down and start from there, but that seems a very hard way to get going. I'm happy to advise on how I did this if anyone wants to know.
I also recently stumbled on DOTSNET, but haven't checked that out yet.
Does anyone have a good way to get an absolutely basic ECS/Netcode mutliplayer actually working on 2+ physical devices on a LAN?
Thank you very much for this! It'll be super useful in the future, I'm sure! <3
I have been looking for networking solution for some time, trying the Forge Networking Remastered now.. thanks!
does anybody knows a tutorial series about full photon setup in unity.i really want it.
Search on youtube
How to become a Game Developer?