Building Multiplayer Games in Unity: Using Mirror Networking Dylan Engelbrecht Download
Building Multiplayer Games in Unity: Using Mirror Networking Dylan Engelbrecht Download
https://ebookmeta.com/product/building-multiplayer-games-in-
unity-using-mirror-networking-dylan-engelbrecht/
https://ebookmeta.com/product/unity-networking-fundamentals-
creating-multiplayer-games-with-unity-first-edition-sloan-kelly/
https://ebookmeta.com/product/christian-dior-the-illustrated-
world-of-a-fashion-master-megan-hess/
Cross Over to HTML5 Game Development 1st Edition Zarrar
Chishti
https://ebookmeta.com/product/cross-over-to-html5-game-
development-1st-edition-zarrar-chishti/
https://ebookmeta.com/product/brazil-india-renewable-energy-
cooperation-connecting-the-continents-arrais-de-miranda-mousinho/
https://ebookmeta.com/product/lonely-planet-costa-rica-15th-
edition-lonely-planet/
https://ebookmeta.com/product/encyclopedia-of-public-
health-22-volume-set-arnold-aboubacar/
https://ebookmeta.com/product/the-ideology-of-failed-states-why-
intervention-fails-1st-edition-susan-l-woodward/
A Cultural History of Hair in Antiquity 1st Edition
Mary Harlow
https://ebookmeta.com/product/a-cultural-history-of-hair-in-
antiquity-1st-edition-mary-harlow/
Building
Multiplayer
Games in Unity
Using Mirror Networking
—
Dylan Engelbrecht
Building Multiplayer
Games in Unity
Using Mirror Networking
Dylan Engelbrecht
Building Multiplayer Games in Unity: Using Mirror Networking
Dylan Engelbrecht
Johannesburg, South Africa
Chapter 2: The Messenger Pigeon, Packets, and a Trip Around the World��������������� 7
Introduction to Networking����������������������������������������������������������������������������������������������������������� 7
A Brief History of Networking�������������������������������������������������������������������������������������������������� 8
Understanding Packets����������������������������������������������������������������������������������������������������������������� 9
A Look at TCP Packets����������������������������������������������������������������������������������������������������������� 10
A Look at UDP packets���������������������������������������������������������������������������������������������������������� 12
How Packets of Data Get Transported Around the World������������������������������������������������������������ 13
TCP/IP Model������������������������������������������������������������������������������������������������������������������������� 13
IPv4 – Internet Protocol Version 4����������������������������������������������������������������������������������������� 15
ARP – Address Resolution Protocol��������������������������������������������������������������������������������������� 18
DNS – Domain Name System������������������������������������������������������������������������������������������������ 19
How a Headshot Travels Around the World���������������������������������������������������������������������������� 20
The Importance of Keeping Your Packets Small�������������������������������������������������������������������� 23
Network Topologies��������������������������������������������������������������������������������������������������������������� 27
Gateways������������������������������������������������������������������������������������������������������������������������������� 35
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
What Is the Most Crucial Piece of Advice You Could Give to Someone
Learning Multiplayer Game Development?������������������������������������������������������������������������� 198
Do You Have Any Other Advice That You’d Like to Include for My Readers?������������������������ 199
Do You Want to Thank Anyone?������������������������������������������������������������������������������������������� 199
Curt – Senior Solutions Architect���������������������������������������������������������������������������������������������� 199
Tell Me a Bit About Yourself and Where You Come From����������������������������������������������������� 199
What Are Some of the Biggest Networking-Related Challenges That You and
Your Team, or Clients, Have Faced While Shipping Multiplayer Games?����������������������������� 200
How Did You Overcome These Challenges?������������������������������������������������������������������������� 201
What Would You Say Is Important?�������������������������������������������������������������������������������������� 201
What Is More Important in Multiplayer-Level Design? Balance or Map Fun Factor?����������� 201
How Much Value Per Player in USD Is a Good Target?��������������������������������������������������������� 201
How Much Should You Be Spending on Cloud Infrastructure as a Percentage of
Your Budget?����������������������������������������������������������������������������������������������������������������������� 202
What Is Your Preferred Cloud Infrastructure Provider for Databases?��������������������������������� 202
What Is Your Preferred Cloud Infrastructure Provider for Server Hosting?�������������������������� 202
What Is the Most Crucial Piece of Advice You Could Give to Someone Learning
Multiplayer Game Development?���������������������������������������������������������������������������������������� 202
Index��������������������������������������������������������������������������������������������������������������������� 231
ix
About the Author
Dylan Engelbrecht is a Unity specialist. Born and raised
in South Africa, he has worked at the top enterprise VR
development studio in the country, and he’s currently
working at the largest game development studio on the
continent. He has in-depth knowledge of commercial and
enterprise game development, with work showcased by
invite at Comic Con Africa and rAge Expo. He is an avid
gamer who enjoys immersive experiences and real-time
strategy games.
xi
About the Technical Reviewer
Deepak Jadhav is a game developer based in Bonn,
Germany. He received his bachelor’s in Computer
Technology and master’s in Game Programming and Project
Management. Deepak has been involved in developing
games on multiple platforms such as mobiles, console,
and PC. He has a strong background in C# and C++ as well
as years of experience in using Unity, Unreal Engine for
Game Development, Augmented Reality, Mixed Reality, and
Virtual Reality.
xiii
CHAPTER 1
A Brief Introduction
Content is king, but a king is nothing without the people. The same applies to games. You
could create all of the world’s content and walk your new land like a king – but it would
still feel like it’s missing something. Humans are social creatures, craving interaction and
shared experiences. We’re fascinated by new ways of experiencing, and linear, single-
player experiences are great, but they can feel empty and soulless if not done perfectly.
Welcome to Building Multiplayer Games in Unity Using Mirror Networking, where
I’ll take you on a deep dive into multiplayer with Unity3D. We’ll use Mirror Networking
to bring your players together, creating the ultimate shared experience. Learn the
fundamentals of RPC/Command multiplayer architecture, and dig deeper into
networking and data persistence to achieve scalable, highly performant, large-scale
multiplayer.
You’ll learn to develop multiplayer games using Unity within a commercial or
enterprise environment. We’ll take a look behind the scenes at what makes multiplayer
games tick. Explore how you can utilize different authoritative structures to best suit
your needs. We’ll also look into scaling your architecture and explore industry-leading
methods of deploying your game to the masses.
You’ll form a solid understanding of valuable networking principles and boost your
game development career. Finally, we’ll wrap up with some advice from leading experts
who’ve deployed the games that you love and play. These experts will shed light on past
mistakes and provide valuable advice for your next project.
1
© Dylan Engelbrecht 2022
D. Engelbrecht, Building Multiplayer Games in Unity, https://doi.org/10.1007/978-1-4842-7474-3_1
Chapter 1 A Brief Introduction
Why Multiplayer?
Multiplayer, used right, can add a certain depth to a game that we cannot achieve
otherwise. I’m not implying that you should make every game multiplayer. Certain
games do indeed feel better as a single-player experience if done right. So, it’s essential
to look at what your product has to offer, its downfalls, and what multiplayer can give or
take from the player experience.
Benefits of Multiplayer
Let’s explore some of the benefits of multiplayer:
2
Chapter 1 A Brief Introduction
Caveats of Multiplayer
Multiplayer offers many benefits, but it does have some caveats that you should be aware
of when deciding to build or convert your existing product into a multiplayer game:
3
Chapter 1 A Brief Introduction
Figure 1-1. A comparison chart with various Unity networking solutions and
frameworks
Note Single-game CCU (Concurrent Users on the same game server at the same
time) is highly dependent on your game’s architecture and coding.
So, why not develop a multiplayer game in Unity using Unity’s built-in HLAPI? Well,
that’s what you’d expect. Unity has a networking framework, called UNet, and a big part
of UNet is the HLAPI or High-Level Application Programming Interface. However, the
Unity HLAPI is deprecated, and you really should avoid it for any new projects. It also
has several limitations, preventing it from being a good, scalable solution. Unity has
promised us a new networking framework. Unity released the initial public version of
their new multiplayer framework, called MLAPI, in March 2021. Many of the concepts
you’ll learn in this book will also apply to the MLAPI, as they’re all loosely based around
the same source code and architecture.
4
Other documents randomly have
different content
The Project Gutenberg eBook of Punainen
leski: Romaani
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Language: Finnish
PUNAINEN LESKI
Romaani
Kirj.
Suomennos
I. Falkenberg.
II. Laukaus.
III. Rakas veli, minä olen viaton.
IV. Salapoliisi.
V. Ilta Pursiklubissa.
VI. Kirjainarvoitus.
VII. Seuraava päivä.
VIII. "Hän on kostanut."
IX. Naisen ryöstö.
X. Kuollut talo.
XI. Valaistu huone.
XII. J.R.
XIII. Uusi tulokas.
XIV. Viimeinen keino.
XV. Punaiset liekit.
XVI. Kirje.
XVII. Peili.
XVIII. Kuoleman edessä.
XIX. Hurja leikki.
XX. Automobiili.
XXI. Valentinen uusi autonkuljettaja.
XXII. Loppu.
I.
Falkenberg.
— Mitä!
— Niin, koska herra konsuli tahtoo sen tietää, sanoi palvelija, niin
pelkään, että automobiili on nyt kokonaan kadonnut.
— Tunsitko naisen?
— Sulje ovi!
Palvelija meni.
Mutta nyt Falkenbergin hyvä tuuli oli tiessään. Sen sijalle oli
häneen tullut jotain ärtyisää ja kiihtynyttä. Hän kiroili hiljakseen.
Hetken kuluttua hän avasi oven ja ärjäisi:
— Takkini!
— No no…
— Perinnöstänikö, tarkoitat?
— Kukaties.
— Kahvia.
— Kaksikymmentäviisi tuhatta.
Charlie säpsähti.
— Ei.
Laukaus.
— Huomenna.
— Niin, he ajoivat.
— Niin.
*****
— Hyvä on.
Yksi seikka oli hänelle selvänä. Veli oli varmasti hyvin onneton.
— Ei, tämä auto on vihreä, sanoi kuski. — Niin että ei se voi olla
meidän.
Pöydällä oli muutamia kirjeitä, joita hän silmäili. Joukossa oli muun
muassa kamariherra Totenin lähettämä painettu illalliskutsu. Sen
alareunaan kamariherra oli omakätisesti kirjoittanut: "Saatte tehdä
mielenkiintoisen tuttavuuden."
Hän avasi kirjeen ja luki sen kahteen kertaan. Sitten hän hymyili
onnellisen näköisenä ja suuteli pientä paperia.
Mutta hänen täytyi koettaa nukkua hiukan. Hänellä oli vielä ruusu
napinreiässä illan juhlasta. Se alkoi lakastua ja hajota. Hän irroitti
sen ja heitti pois. Ja ruusu putosi matolle jääden siihen pienen
valkoisen paperipalan viereen.