SlideShare a Scribd company logo
1 of 46
Download to read offline
MOVING PIXELS ON
SOMEONE ELSE'S
SCREEN
INTRODUCTION TO UNITY NETWORKING
HELLO šŸ‘‹
Massimo Frasson
Giovanni Frigo
Computer Science student,
Game developer @ Belka
CTO & Co-founder of Belka
So, you want to develop
a multiplayer videogame?
LETā€™S DO THIS!
The main objective:
synchronizing things
The old-fashioned way
šŸ‘¶
The old-fashioned way
#
The old-fashioned way
šŸ‘“
The old-fashioned way
šŸ’€
Sounds like a lot of work!
TO THE RESCUE!
Network Stack in Unity
You were
here
>Your scripts here<
Setting up a multiplayer scene
Setting up a multiplayer scene
Setting up a multiplayer scene
Setting up a multiplayer scene
Setting up a multiplayer scene
SYNCING THE STATE
Server + Client 1
State sync: built-in objects
NetworkManager Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Client 2
Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Client n
Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Scene
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
State sync
The Network Identity component
controls a GameObjectā€™s unique
identity on the network, and it
uses that identity to make the
networking system aware of the
GameObject.
ā€¢ Unity-speciļ¬c objects (position, rotation,
animation..)
ā€¢ Simple variables (int, ļ¬‚oat, ..)
ā€¢ Everything serializable! (custom classes)
State sync
Sets the Unique ID of this
object on the network, so that
we know who has changes
State sync: built-in objects
Server + Client 1
State sync: built-in objects
NetworkManager Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Client 2
Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Client n
Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Scene
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Server + Client 1
State sync: built-in objects
NetworkManager Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Client 2
Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Client n
Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player 2
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
Player n
ā€¦ā€Ø
ā€¢ NetworkIdentityā€Ø
ā€¢ NetworkTransform
NetworkTransformā€Ø
updates
Scene
State sync: built-in objects
This is cool!
How can I replicate it also for more
generic variables?
State sync: variables
Letā€™s set a random color to each player and keep it
synced!
State sync: variables
The [SyncVar] attribute tells the
server that once the variable is
changed on the server, it should also
inform everyone else about it
State sync: pretty much
anything serializable!
ā€¢ Basic types (integers, strings, ļ¬‚oats, ā€¦)
ā€¢ Unity types (Vector3, Color, ā€¦)
ā€¢ Serializable objects
ā€¢ Structs made up by types above
State sync: pretty much
anything serializable!
ā€¢ Basic types (integers, strings, ļ¬‚oats, ā€¦)
ā€¢ Unity types (Vector3, Color, ā€¦)
ā€¢ Serializable objects
ā€¢ Structs made up by types above
Bonus: Lists of the primitive types above!
COMMANDS & RPC
State sync: variables
Server + Client 1
NetworkManager Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player 2
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Client 2
Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player n
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Client n
Other scene objects
(terrain, camera, light)
Player 1
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player 2
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player n
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Color SyncVarā€Ø
updates
Scene
Player 2
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player n
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player 1
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
State sync: variables
How can I set the color into the server?
šŸ¤”
State sync: variables
Server + Client 1
NetworkManager Other scene objects
(terrain, camera, light)
Client 2
Other scene objects
(terrain, camera, light)
Client n
Other scene objects
(terrain, camera, light)
Scene
CmdChangeColor
Player 2
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player n
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player 1
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player 1
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player 1
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player 2
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player n
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player 2
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Player n
ā€¦ā€Ø
ā€¢ ColorControllerā€Ø
-[SyncVar] Color
Commands
The Client asks the server to perform an
action
The code is executed on the Server
Commands
This is executed on server!
RPC
The Server tells the client to execute some
code
The code is executed on each of the Clients
RPC
RPC
Client
RPC
Client
Server
RPC
Client
Server
Client
BUT
..it can get messy, if for each action
you always have the RPC and
Commands in the same ļ¬le!
GOING FURTHER
Messages
Used to send some info from a
speciļ¬c client to another
DEMO TIME!
Belka
Code: github.com/BelkaLab/unity-networking-demo
THANKS!
Questions?
@MaxFrax96
@john_frigo
@MaxFrax96
@john_frigo

More Related Content

What's hot

Game engines and Their Influence in Game Design
Game engines and Their Influence in Game DesignGame engines and Their Influence in Game Design
Game engines and Their Influence in Game Design
Prashant Warrier
Ā 
Game development with Cocos2d-x Engine
Game development with Cocos2d-x EngineGame development with Cocos2d-x Engine
Game development with Cocos2d-x Engine
Duy Tan Geek
Ā 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with Unity
Petri Lankoski
Ā 

What's hot (20)

Unreal Engine Basics 03 - Gameplay
Unreal Engine Basics 03 - GameplayUnreal Engine Basics 03 - Gameplay
Unreal Engine Basics 03 - Gameplay
Ā 
Deterministic Simulation - What modern online games can learn from the Game B...
Deterministic Simulation - What modern online games can learn from the Game B...Deterministic Simulation - What modern online games can learn from the Game B...
Deterministic Simulation - What modern online games can learn from the Game B...
Ā 
Game engines and Their Influence in Game Design
Game engines and Their Influence in Game DesignGame engines and Their Influence in Game Design
Game engines and Their Influence in Game Design
Ā 
Game development with Cocos2d-x Engine
Game development with Cocos2d-x EngineGame development with Cocos2d-x Engine
Game development with Cocos2d-x Engine
Ā 
Data Ward Pitch, v1.0
Data Ward Pitch, v1.0Data Ward Pitch, v1.0
Data Ward Pitch, v1.0
Ā 
2D Video Games with MacRuby
2D Video Games with MacRuby2D Video Games with MacRuby
2D Video Games with MacRuby
Ā 
Games on Demand: Are We There Yet?
Games on Demand: Are We There Yet?Games on Demand: Are We There Yet?
Games on Demand: Are We There Yet?
Ā 
Escape: Level Design Exercise in Unity
Escape: Level Design Exercise in UnityEscape: Level Design Exercise in Unity
Escape: Level Design Exercise in Unity
Ā 
Developing Multiplayer Games in Unity3D
Developing Multiplayer Games in Unity3DDeveloping Multiplayer Games in Unity3D
Developing Multiplayer Games in Unity3D
Ā 
Unity 3d Basics
Unity 3d BasicsUnity 3d Basics
Unity 3d Basics
Ā 
Flowcharts
FlowchartsFlowcharts
Flowcharts
Ā 
Bringing Supernatural Thriller, "Oxenfree" to Nintendo Switch
Bringing Supernatural Thriller, "Oxenfree" to Nintendo SwitchBringing Supernatural Thriller, "Oxenfree" to Nintendo Switch
Bringing Supernatural Thriller, "Oxenfree" to Nintendo Switch
Ā 
Computer Games Inner Workings - I. Loukeris AIT
Computer Games Inner Workings - I. Loukeris AITComputer Games Inner Workings - I. Loukeris AIT
Computer Games Inner Workings - I. Loukeris AIT
Ā 
Cocos2d-x C++ Windows 8 &Windows Phone 8
Cocos2d-x C++ Windows 8 &Windows Phone 8Cocos2d-x C++ Windows 8 &Windows Phone 8
Cocos2d-x C++ Windows 8 &Windows Phone 8
Ā 
Game development -session on unity 3d
Game development -session on unity 3d Game development -session on unity 3d
Game development -session on unity 3d
Ā 
Presentasi Seminar Unity (AMIKOM Game Dev)
Presentasi Seminar Unity (AMIKOM Game Dev)Presentasi Seminar Unity (AMIKOM Game Dev)
Presentasi Seminar Unity (AMIKOM Game Dev)
Ā 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with Unity
Ā 
Introduction to Unity3D Game Engine
Introduction to Unity3D Game EngineIntroduction to Unity3D Game Engine
Introduction to Unity3D Game Engine
Ā 
What Is A Game Engine
What Is A Game EngineWhat Is A Game Engine
What Is A Game Engine
Ā 
Casual and Social Games with Unity
Casual and Social Games with UnityCasual and Social Games with Unity
Casual and Social Games with Unity
Ā 

Similar to Moving pixels on someone else's screen: introduction to Unity networking

Initial design (Game Architecture)
Initial design (Game Architecture)Initial design (Game Architecture)
Initial design (Game Architecture)
Rajkumar Pawar
Ā 
GamingAnywhere: An Open Cloud Gaming System
GamingAnywhere: An Open Cloud Gaming SystemGamingAnywhere: An Open Cloud Gaming System
GamingAnywhere: An Open Cloud Gaming System
Academia Sinica
Ā 
Supersize your production pipe enjmin 2013 v1.1 hd
Supersize your production pipe    enjmin 2013 v1.1 hdSupersize your production pipe    enjmin 2013 v1.1 hd
Supersize your production pipe enjmin 2013 v1.1 hd
slantsixgames
Ā 

Similar to Moving pixels on someone else's screen: introduction to Unity networking (20)

Photon Session / Unite12 Conference
Photon Session / Unite12 ConferencePhoton Session / Unite12 Conference
Photon Session / Unite12 Conference
Ā 
Initial design (Game Architecture)
Initial design (Game Architecture)Initial design (Game Architecture)
Initial design (Game Architecture)
Ā 
Cocos2d game programming 2
Cocos2d game programming 2Cocos2d game programming 2
Cocos2d game programming 2
Ā 
Cocos2d programming
Cocos2d programmingCocos2d programming
Cocos2d programming
Ā 
2004: Sƶldner - a Post Mortem
2004: Sƶldner - a Post Mortem2004: Sƶldner - a Post Mortem
2004: Sƶldner - a Post Mortem
Ā 
GamingAnywhere: An Open Cloud Gaming System
GamingAnywhere: An Open Cloud Gaming SystemGamingAnywhere: An Open Cloud Gaming System
GamingAnywhere: An Open Cloud Gaming System
Ā 
Supersize Your Production Pipe
Supersize Your Production PipeSupersize Your Production Pipe
Supersize Your Production Pipe
Ā 
98 374 Lesson 02-slides
98 374 Lesson 02-slides98 374 Lesson 02-slides
98 374 Lesson 02-slides
Ā 
Unity workshop
Unity workshopUnity workshop
Unity workshop
Ā 
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
Ā 
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Ā 
Supersize your production pipe enjmin 2013 v1.1 hd
Supersize your production pipe    enjmin 2013 v1.1 hdSupersize your production pipe    enjmin 2013 v1.1 hd
Supersize your production pipe enjmin 2013 v1.1 hd
Ā 
Sephy engine development document
Sephy engine development documentSephy engine development document
Sephy engine development document
Ā 
GDC 2015 ć§ć®ćƒć‚¤ć‚Øćƒ³ćƒ‰ć‚°ćƒ©ćƒ•ć‚£ćƒƒć‚Æć‚¹
GDC 2015 ć§ć®ćƒć‚¤ć‚Øćƒ³ćƒ‰ć‚°ćƒ©ćƒ•ć‚£ćƒƒć‚Æć‚¹GDC 2015 ć§ć®ćƒć‚¤ć‚Øćƒ³ćƒ‰ć‚°ćƒ©ćƒ•ć‚£ćƒƒć‚Æć‚¹
GDC 2015 ć§ć®ćƒć‚¤ć‚Øćƒ³ćƒ‰ć‚°ćƒ©ćƒ•ć‚£ćƒƒć‚Æć‚¹
Ā 
XNA for Windows Phone
XNA for Windows PhoneXNA for Windows Phone
XNA for Windows Phone
Ā 
De Re PlayStation Vita
De Re PlayStation VitaDe Re PlayStation Vita
De Re PlayStation Vita
Ā 
Computer Games Development Chapter 7
Computer Games Development Chapter 7Computer Games Development Chapter 7
Computer Games Development Chapter 7
Ā 
Developing and optimizing a procedural game: The Elder Scrolls Blades- Unite ...
Developing and optimizing a procedural game: The Elder Scrolls Blades- Unite ...Developing and optimizing a procedural game: The Elder Scrolls Blades- Unite ...
Developing and optimizing a procedural game: The Elder Scrolls Blades- Unite ...
Ā 
Scalability & Big Data challenges in real time multiplayer games
Scalability & Big Data challenges in real time multiplayer gamesScalability & Big Data challenges in real time multiplayer games
Scalability & Big Data challenges in real time multiplayer games
Ā 
Unity
UnityUnity
Unity
Ā 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
Ā 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
Ā 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
Ā 

Recently uploaded (20)

Introducing Microsoftā€™s new Enterprise Work Management (EWM) Solution
Introducing Microsoftā€™s new Enterprise Work Management (EWM) SolutionIntroducing Microsoftā€™s new Enterprise Work Management (EWM) Solution
Introducing Microsoftā€™s new Enterprise Work Management (EWM) Solution
Ā 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
Ā 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
Ā 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
Ā 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Ā 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
Ā 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
Ā 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Ā 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Ā 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
Ā 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
Ā 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
Ā 
call girls in Vaishali (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Vaishali (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļøcall girls in Vaishali (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Vaishali (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
Ā 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
Ā 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Ā 
call girls in Vaishali (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Vaishali (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļøcall girls in Vaishali (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Vaishali (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
Ā 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
Ā 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Ā 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
Ā 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Ā 

Moving pixels on someone else's screen: introduction to Unity networking

  • 1. MOVING PIXELS ON SOMEONE ELSE'S SCREEN INTRODUCTION TO UNITY NETWORKING
  • 2. HELLO šŸ‘‹ Massimo Frasson Giovanni Frigo Computer Science student, Game developer @ Belka CTO & Co-founder of Belka
  • 3. So, you want to develop a multiplayer videogame?
  • 10. Sounds like a lot of work!
  • 12. Network Stack in Unity You were here >Your scripts here<
  • 13. Setting up a multiplayer scene
  • 14. Setting up a multiplayer scene
  • 15. Setting up a multiplayer scene
  • 16. Setting up a multiplayer scene
  • 17. Setting up a multiplayer scene
  • 19. Server + Client 1 State sync: built-in objects NetworkManager Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Client 2 Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Client n Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Scene Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform
  • 20. State sync The Network Identity component controls a GameObjectā€™s unique identity on the network, and it uses that identity to make the networking system aware of the GameObject. ā€¢ Unity-speciļ¬c objects (position, rotation, animation..) ā€¢ Simple variables (int, ļ¬‚oat, ..) ā€¢ Everything serializable! (custom classes)
  • 21. State sync Sets the Unique ID of this object on the network, so that we know who has changes
  • 23. Server + Client 1 State sync: built-in objects NetworkManager Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Client 2 Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Client n Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Scene Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform
  • 24. Server + Client 1 State sync: built-in objects NetworkManager Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Client 2 Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Client n Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player 2 ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform Player n ā€¦ā€Ø ā€¢ NetworkIdentityā€Ø ā€¢ NetworkTransform NetworkTransformā€Ø updates Scene
  • 25. State sync: built-in objects This is cool! How can I replicate it also for more generic variables?
  • 26. State sync: variables Letā€™s set a random color to each player and keep it synced!
  • 27. State sync: variables The [SyncVar] attribute tells the server that once the variable is changed on the server, it should also inform everyone else about it
  • 28. State sync: pretty much anything serializable! ā€¢ Basic types (integers, strings, ļ¬‚oats, ā€¦) ā€¢ Unity types (Vector3, Color, ā€¦) ā€¢ Serializable objects ā€¢ Structs made up by types above
  • 29. State sync: pretty much anything serializable! ā€¢ Basic types (integers, strings, ļ¬‚oats, ā€¦) ā€¢ Unity types (Vector3, Color, ā€¦) ā€¢ Serializable objects ā€¢ Structs made up by types above Bonus: Lists of the primitive types above!
  • 31. State sync: variables Server + Client 1 NetworkManager Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player 2 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Client 2 Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player n ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Client n Other scene objects (terrain, camera, light) Player 1 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player 2 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player n ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Color SyncVarā€Ø updates Scene Player 2 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player n ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player 1 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color
  • 32. State sync: variables How can I set the color into the server? šŸ¤”
  • 33. State sync: variables Server + Client 1 NetworkManager Other scene objects (terrain, camera, light) Client 2 Other scene objects (terrain, camera, light) Client n Other scene objects (terrain, camera, light) Scene CmdChangeColor Player 2 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player n ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player 1 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player 1 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player 1 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player 2 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player n ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player 2 ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color Player n ā€¦ā€Ø ā€¢ ColorControllerā€Ø -[SyncVar] Color
  • 34. Commands The Client asks the server to perform an action The code is executed on the Server
  • 36. RPC The Server tells the client to execute some code The code is executed on each of the Clients
  • 37. RPC
  • 41. BUT ..it can get messy, if for each action you always have the RPC and Commands in the same ļ¬le!
  • 43. Messages Used to send some info from a speciļ¬c client to another