Game Dev Adventure #3 - New Start and Networking
Updated: Jul 18, 2020
In the past years, I have focused most of my time on single-player games. Until recently, I never thought multiplayer game development would be much different than single-player games, but I was very wrong. Lately, I began concentrating on developing MMORPG multiplayer games, so I started learning about networking. With both networking and programming knowledge I have at this time, I now understand that writing a single-player game is very different than writing a multiplayer game. In my personal opinion, I don’t think there is as much to worry about in developing a single-player game as there is in a multiplayer game. Everything— at least almost everything— that needs to be dealt with when developing a single-player game may also have to be dealt with in a multiplayer game. Moreover, multiplayer games may create critical roadblocks for game developers—e.g. latency, systems architecture knowledge (if not using the P2P model), and more.
When I first began this new project of mine, I had very little networking knowledge, meaning I would have to learn everything from scratch. After doing a lot of research, I still felt very lost and stuck. Rather than hang up the towel, I am going to confront my challenges and work towards developing a successful multiplayer game. While there are many tutorials out there are rarely tutorials tailored to a specific solution for implementation. I understand that every use case would need a different way to implement, so it is hard for any tutorial to fit everyone's needs. However, that is also the reason why a good tutorial would be very valuable for readers like me.
Like most people, I just randomly search topics of interest in Google or YouTube to see if I can find anything close to being useful. “Central host,” “server,” “photon,” “mirror,” “Unity dedicated server set up,” etc. These keywords ended up giving me quite a few results. However, the vast majority of these sites or videos did not teach me anything fundamental.
I proceeded to spend a few days searching for good networking lessons, where I finally found one great tutorial and decided to begin learning from it. The tutorial videos I ended up following are from the "C# Networking Tutorials" series created by Tom Weiland. They discuss how to use the .NET Core framework with the Unity engine to create a multiplayer game. I would highly recommend anybody to check the videos out later, as the tutorials were quite helpful for me. The tutorials have step-by-step guides on how to start writing a server for multiplayer games using .NET Core. Consequently, this required me to throw away my developer pride and act like I am just a newbie even to programming. From these videos, I have learned the basic knowledge I need to at least start implementing the ideas into my own game.
From my understanding so far, there are a few key points to take away from watching all the tutorials: type of network communications, packaging data packets as small as possible, and joining game development communities.
First, the two major types of communication are UDP and TCP. UDP is a very fast way to send packets through the internet, but the major flaw is packets can be dropped at times; TCP is a reliable way to send packets through the internet, but very costly in comparison. Therefore, TCP is good for transferring essential information between servers and clients, whereas UDP is good for signaling consistent fast-paced input or information if the drop of a small number of packages isn't part of the worry.
Second is making sure the data being transferred is constructed as condensed as possible. Every bit of information becomes a cost for the operation, so it is always good to keep in mind that only the necessary data should be sent between the server and clients. If something is redundant, just simplify the data structure and only send out the necessary information on each packet.
Lastly, I realize how important it was to join communities that have game developers. Besides gaining the knowledge needed for networking, I have also learned the value of gaining some new connections with others on the same passion would be very beneficial. Through Discord channels as well as forums, I have found many avenues for information by asking questions and having some fun discussions.
Feel free to comment below to correct me if I have any incorrect information. I am still very new to networking, but I wanted to share what I have learned so far, and hopefully people who are also new can at least have something to follow.
Overall, learning networking is just the first step. Sit down and make sure to learn the fundamentals, since that will certainly help make the process of writing multiplayer games much easier. Without the understanding of the technology, it would be nearly impossible to be able to finish any size of a multiplayer game project; therefore, go learn the basics before jumping right into it. Remember, don't hesitate to start something you enjoy. Even if there is no result, at least the experience you get from the process would be immensely valuable.
Have Fun. Be Happy. Be Inspirational!
Tom's C# Networking Tutorials: Here
Below are two great Unity assets that are also really good for Networking. Can check these out too!