SlideShare a Scribd company logo
Developing
Multiplayer
Games in
Unity 3D
Adrian Popovici
Software developer by day
Game developer by night
Games
Digital Void Entertainment
Galactic Hunt ∙ Zorah ∙ Pulse
First prizes on gamedev.ro
Future Visions Games
Desert Land 2115
Early access on Steam
Future Visions Games
Empire of the Fallen Steel
Steam Greenlight
Agenda
1. Multiplayer
2. Technical details
3. Multiplayer solutions
4. Possible problems
5. Interesting facts
6. Demo
1
Multiplayer
In general
Multiplayer: in general
May not refer to LAN or online only!
Can also be on the same platform:
› Split-Screen: Need for Speed
› Same-Screen: Move or Die - check it out!
› Hotseat: Worms, Disciples 2
Multiplayer: LAN / online
Multiplayer: data synchronization between
two or more nodes in a network
A realm of smoke and mirrors for developers
2
Technical
details
Transport protocols
Architectures
Data transfer models
Transport protocols
TCP UDP
Reliability reliable unreliable
Connection connection oriented connectionless
Retransmission Segment retransmission and flow
control through windowing
No window or retransmission
Sequencing Segment sequencing No sequencing
Acknowledgement Acknowledge segments No acknowledgement
Speed Slow Fast
Multiplayer architectures
Based on the control of the data:
› Client-server: centralized
› Peer to peer: decentralized
› Hybrid: mixed
Client-server
Client-server
Characteristics
The server has
control
Clients only
provide input
Pros
No easy
cheating at the
client side
Easy
synchronization
between clients
Cons
Server
maintenance
Server load: it
does most of
the work, so it
needs more
power
Peer to peer
Peer to peer
Characteristics
Clients control
their individual
actions
No actual server
Pros
No hosting costs
Fast if less
clients
Cons
Cheating heaven
Synchronization
can be a hard
problem
Hybrid
Trade-offs between server and client, e.g.:
Master client: a client that takes the role of
the server and handles all synchronizations
Server as facilitator: a server that checks
metadata and stores everything in one place
but clients do their own calculations
Data transfer approaches
Very hard
Discrete, change
the state of the
game, player
etc., e.g., player
death, map
change
Very hard with
interpolation
Usually position,
rotation,
animation
Hard with sync
Requires
synchronization
rarely, e.g., a
clock that is
started with the
game
Data transfer approaches
Delayed hard
Using data from
the past, e.g.,
playing vs a
ghost car from a
player who
played before
Soft
Can be used for
pathfinding or
data that is not
mandatory to be
exact on each
node
Very soft
Result already
processed but
the client
receives it later,
e.g., games like
Travian
3
Multiplayer
solutions
Questions to ask
Technologies
Multiplayer solutions: choice
Pick what makes sense by answering, e.g.:
› What type of game am I developing?
› What is the expected monthly user ratio?
› What is the level of security in the game?
› What server issues appear and how to handle?
› Do I want just an easy solution that works?
Multiplayer solutions: examples
› Unity Multiplayer
› Smartfox
› Amazon Web Services
› Bolt
› Photon Unity Network (PUN)
PUN: features
› Authentication
› Matchmaking
› In-game communication
› Integration with Unity
› Free for 20 concurrent connections
PUN: Photon Cloud
› Uses a hybrid architecture
› No server, only clients
› One client takes the Master Client role
› Photon handles network address translation,
game session finding and other problems that
appear between clients
PUN: adding it to Unity
Takes only 4 steps:
1. Get the Photon Unity network from the asset store
2. Creat an account on photonengine.com
3. Create a new application and get the ID
4. Insert the ID in the Photon Unity network
PUN: connecting to the server
Common Methods
› PhotonNetwork.ConnectUsingSettings( )
› PhotonNetwork.JoinRandomRoom( )
› PhotonNetwork.CreateRoom( )
Common Callbacks
› OnConnectedToMaster( )
› OnJoinedLobby( )
› OnFailedToConnectToPhoton( )
Continuous updates
Done after a specific
interval
Used for position, animation
Data transfer: hard with
interpolation
PUN: data server
Remote procedure calls
Called specifically by a
client
Can be queued for late-
joining players
Can be targeted
Data transfer: very hard, soft
PUN: Photon Core
Unity 3D component used for all operations:
PUN: Photon View
Can observe:
1. Unity 3D components
2. Photon sync components
a. PhotonTransformView
b. PhotonAnimatorView
3. Custom user scripts
a. OnPhotonSerializeView
b. Remote procedure calls
PUN: Master Client
› Picked uniformly at random by Photon Engine
› Re-picked if the current master disconnects
› There should always be one master at all times
› while a game session is in progress
› Has more power than normal clients
can take ownership of objects
› Should implement the game logic
PUN: object ownership
PhotonNetwork.Instantiate
› creates a player-owned object.
› if a player disconnects, the object disappears
Scene objects
› instantiated by the master client
› don’t disappear, even if the master client is changed
4
Possible
problems
Latency at game
Network address translation
Cheating players
Synchronization
Latency At Game: problem
› Multiplayer enemy No. 1
› Affects even LAN networks
› Can create frustration among players
› Probably the most annoying thing
anyone experienced in multiplayer
Latency At Game: solution
Compensation: making up for the lost time;
processes the time of the player’s action
Prediction: client predicting local actions without
the server’s confirmation. Confirmed later by the
server’s message, later, when it arrives
Interpolation: client tries to figure out the values
between the sparse values received from the server
Network Address Translation: problem
Multiplayer games may work in LAN
When the developers decide to take it to the next
level, NAT appears, and it’s here to stay!
Since the IPs over the internet are not the same as
those on the LAN, the connection won’t be possible
Network Address Translation: solution
› Port Forwarding from local router
› Universal Plug and Play
› Relay Server with real IP
› Using a solution out-of-the box like
Photon, which performs this already
Cheating: problem
Usually done by players:
› Directly by fiddling with the code or the packets
sent on the network
› Indirectly by finding a flaw in the network
design and using that to gain advantages
Examples of cheats: Wallhack, maphack,
teleportation, invincibility or unlimited ammo
Cheating: solution
› Fix all bugs that appear
› Do not provide invisible information to a player., e.g., if
an enemy is behind a wall
› Try to use a client-server architecture, this will
minimize consistently the cheating factor
› Implement a reporting system and IP ban
› Implement a lockstep protocol
Synchronization: problem
If the synchronization still persists due to poor server
components or poor connections, you can
implement some hacks to make the game faster
Developer forgets to implement some edge cases
and one user sees information that others don’t
Synchronization: solution
› Don’t show projectiles, just compute
them, as in, e.g., Counter Strike
› Reduce the data or compress it
5
Interesting
facts
Quake
Supreme Commander
Quake
› Created the client-server architecture
› Gave birth to:
› Online gaming that we currently know
› Online server lists
› Clan gaming
Supreme Commander
6
Demo
Data transmission using the
Photon Unity network
Thank you
Adrian Popovici
popovici.ad@gmail.com
Resources ∙ Credits
› Multiplayer video game. Wikipedia link
› Lag compensation explained. Call of Duty Community Forums link
› Source multiplayer networking. Lag compensation. Valve Community Network Developer Wiki link
› Introduction to multiplayer game programming by Brian Hook. Book of Hook link
› Fast-paced multiplayer by Gabriel Gambetta link
› Why do some networked games use interpolation and some use pathfinding for remote movement?
StackOverflow link
› Lockstep protocol. Wikipedia link
› Why Quake changed games forever? by Ryan Winterhalter. 1up link
› Dumaine Google presentation theme by Jimena Catalina. Slides Carnival link
› Icons8 icons with Creative Commons Attribution-NoDerivs 3.0 Unported free license link
Codecamp feedback
https://goo.gl/0XMg0o
Developing Multiplayer Games in Unity3D

More Related Content

What's hot

Part3. 아이디어를 게임기획으로 발전시키기
Part3. 아이디어를 게임기획으로 발전시키기Part3. 아이디어를 게임기획으로 발전시키기
Part3. 아이디어를 게임기획으로 발전시키기태성 이
 
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
Gerke Max Preussner
 
김동건, 할머니가 들려주신 마비노기 개발 전설, NDC2019
김동건, 할머니가 들려주신 마비노기 개발 전설, NDC2019김동건, 할머니가 들려주신 마비노기 개발 전설, NDC2019
김동건, 할머니가 들려주신 마비노기 개발 전설, NDC2019
devCAT Studio, NEXON
 
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
Kiyoung Moon
 
게임제작개론: #2 세부 디자인 요소
게임제작개론: #2 세부 디자인 요소게임제작개론: #2 세부 디자인 요소
게임제작개론: #2 세부 디자인 요소
Seungmo Koo
 
전투 시스템 기획(Canvas 스터디 1차)
전투 시스템 기획(Canvas 스터디 1차)전투 시스템 기획(Canvas 스터디 1차)
전투 시스템 기획(Canvas 스터디 1차)
Chanman Jo
 
게임서버프로그래밍 #7 - 패킷핸들링 및 암호화
게임서버프로그래밍 #7 - 패킷핸들링 및 암호화게임서버프로그래밍 #7 - 패킷핸들링 및 암호화
게임서버프로그래밍 #7 - 패킷핸들링 및 암호화
Seungmo Koo
 
Tammy Levy at GDC 2019: Nature vs. Nurture: Unpacking Player Spending in F2P ...
Tammy Levy at GDC 2019: Nature vs. Nurture: Unpacking Player Spending in F2P ...Tammy Levy at GDC 2019: Nature vs. Nurture: Unpacking Player Spending in F2P ...
Tammy Levy at GDC 2019: Nature vs. Nurture: Unpacking Player Spending in F2P ...
Kongregate
 
[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리
[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리
[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리
강 민우
 
PRESENTATION ON Game Engine
PRESENTATION ON Game EnginePRESENTATION ON Game Engine
PRESENTATION ON Game EngineDiksha Bhargava
 
어서와 게임기획은 처음이지?
어서와 게임기획은 처음이지?어서와 게임기획은 처음이지?
어서와 게임기획은 처음이지?
Lee Sangkyoon (Kay)
 
게임 시스템 디자인 시작하기
게임 시스템 디자인 시작하기게임 시스템 디자인 시작하기
게임 시스템 디자인 시작하기
ByungChun2
 
NDC 2015 삼시세끼 빌드만들기
NDC 2015 삼시세끼 빌드만들기NDC 2015 삼시세끼 빌드만들기
NDC 2015 삼시세끼 빌드만들기
Hyunsuk Ahn
 
Photonのサービス選択の勘どころ
Photonのサービス選択の勘どころPhotonのサービス選択の勘どころ
Photonのサービス選択の勘どころ
GMO GlobalSign Holdings K.K.
 
NDC12 인디게임 개발 시 주의할 점
NDC12 인디게임 개발 시 주의할 점NDC12 인디게임 개발 시 주의할 점
NDC12 인디게임 개발 시 주의할 점Mingu Heo
 
NDC 11 자이언트 서버의 비밀
NDC 11 자이언트 서버의 비밀NDC 11 자이언트 서버의 비밀
NDC 11 자이언트 서버의 비밀
승명 양
 
KGC 2014: 분산 게임 서버 구조론
KGC 2014: 분산 게임 서버 구조론KGC 2014: 분산 게임 서버 구조론
KGC 2014: 분산 게임 서버 구조론
Hyunjik Bae
 
Machinationの紹介
Machinationの紹介Machinationの紹介
Machinationの紹介
Kazuhisa Minato
 
모바일 게임기획 따라하며 배우기
모바일 게임기획 따라하며 배우기모바일 게임기획 따라하며 배우기
모바일 게임기획 따라하며 배우기
Sunnyrider
 
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
Amazon Web Services Korea
 

What's hot (20)

Part3. 아이디어를 게임기획으로 발전시키기
Part3. 아이디어를 게임기획으로 발전시키기Part3. 아이디어를 게임기획으로 발전시키기
Part3. 아이디어를 게임기획으로 발전시키기
 
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
 
김동건, 할머니가 들려주신 마비노기 개발 전설, NDC2019
김동건, 할머니가 들려주신 마비노기 개발 전설, NDC2019김동건, 할머니가 들려주신 마비노기 개발 전설, NDC2019
김동건, 할머니가 들려주신 마비노기 개발 전설, NDC2019
 
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
 
게임제작개론: #2 세부 디자인 요소
게임제작개론: #2 세부 디자인 요소게임제작개론: #2 세부 디자인 요소
게임제작개론: #2 세부 디자인 요소
 
전투 시스템 기획(Canvas 스터디 1차)
전투 시스템 기획(Canvas 스터디 1차)전투 시스템 기획(Canvas 스터디 1차)
전투 시스템 기획(Canvas 스터디 1차)
 
게임서버프로그래밍 #7 - 패킷핸들링 및 암호화
게임서버프로그래밍 #7 - 패킷핸들링 및 암호화게임서버프로그래밍 #7 - 패킷핸들링 및 암호화
게임서버프로그래밍 #7 - 패킷핸들링 및 암호화
 
Tammy Levy at GDC 2019: Nature vs. Nurture: Unpacking Player Spending in F2P ...
Tammy Levy at GDC 2019: Nature vs. Nurture: Unpacking Player Spending in F2P ...Tammy Levy at GDC 2019: Nature vs. Nurture: Unpacking Player Spending in F2P ...
Tammy Levy at GDC 2019: Nature vs. Nurture: Unpacking Player Spending in F2P ...
 
[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리
[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리
[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리
 
PRESENTATION ON Game Engine
PRESENTATION ON Game EnginePRESENTATION ON Game Engine
PRESENTATION ON Game Engine
 
어서와 게임기획은 처음이지?
어서와 게임기획은 처음이지?어서와 게임기획은 처음이지?
어서와 게임기획은 처음이지?
 
게임 시스템 디자인 시작하기
게임 시스템 디자인 시작하기게임 시스템 디자인 시작하기
게임 시스템 디자인 시작하기
 
NDC 2015 삼시세끼 빌드만들기
NDC 2015 삼시세끼 빌드만들기NDC 2015 삼시세끼 빌드만들기
NDC 2015 삼시세끼 빌드만들기
 
Photonのサービス選択の勘どころ
Photonのサービス選択の勘どころPhotonのサービス選択の勘どころ
Photonのサービス選択の勘どころ
 
NDC12 인디게임 개발 시 주의할 점
NDC12 인디게임 개발 시 주의할 점NDC12 인디게임 개발 시 주의할 점
NDC12 인디게임 개발 시 주의할 점
 
NDC 11 자이언트 서버의 비밀
NDC 11 자이언트 서버의 비밀NDC 11 자이언트 서버의 비밀
NDC 11 자이언트 서버의 비밀
 
KGC 2014: 분산 게임 서버 구조론
KGC 2014: 분산 게임 서버 구조론KGC 2014: 분산 게임 서버 구조론
KGC 2014: 분산 게임 서버 구조론
 
Machinationの紹介
Machinationの紹介Machinationの紹介
Machinationの紹介
 
모바일 게임기획 따라하며 배우기
모바일 게임기획 따라하며 배우기모바일 게임기획 따라하며 배우기
모바일 게임기획 따라하며 배우기
 
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
 

Similar to Developing Multiplayer Games in Unity3D

Lets Play Together
Lets Play TogetherLets Play Together
Lets Play Together
Amir H. Fassihi
 
Photon Session / Unite12 Conference
Photon Session / Unite12 ConferencePhoton Session / Unite12 Conference
Photon Session / Unite12 Conference
Christof Wegmann
 
Behind the Scenes: Deploying a Low-Latency Multiplayer Game Globally
Behind the Scenes: Deploying a Low-Latency Multiplayer Game GloballyBehind the Scenes: Deploying a Low-Latency Multiplayer Game Globally
Behind the Scenes: Deploying a Low-Latency Multiplayer Game Globally
James Gwertzman
 
Building Multiplayer Games (w/ Unity)
Building Multiplayer Games (w/ Unity)Building Multiplayer Games (w/ Unity)
Building Multiplayer Games (w/ Unity)
Noam Gat
 
Reliving the history of multiplayer games
Reliving the history of multiplayer gamesReliving the history of multiplayer games
Reliving the history of multiplayer games
Wooga
 
Applying AI in Games (GDC2019)
Applying AI in Games (GDC2019)Applying AI in Games (GDC2019)
Applying AI in Games (GDC2019)
Jun Okumura
 
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
David Geurts
 
Building fast,scalable game server in node.js
Building fast,scalable game server in node.jsBuilding fast,scalable game server in node.js
Building fast,scalable game server in node.js
Xie ChengChao
 
GDC 2015 - Low-latency Multiplayer Gaming with AWS
GDC 2015 - Low-latency Multiplayer Gaming with AWS GDC 2015 - Low-latency Multiplayer Gaming with AWS
GDC 2015 - Low-latency Multiplayer Gaming with AWS
Nate Wiger
 
P2P with Flash Player 10.1
P2P with Flash Player 10.1P2P with Flash Player 10.1
P2P with Flash Player 10.1Peter Elst
 
Flash Camp Chennai - P2P with Flash Player 10.1
Flash Camp Chennai - P2P with Flash Player 10.1Flash Camp Chennai - P2P with Flash Player 10.1
Flash Camp Chennai - P2P with Flash Player 10.1RIA RUI Society
 
Tech solutions and tricks in real time mobile multiplayer
Tech solutions and tricks in real time mobile multiplayerTech solutions and tricks in real time mobile multiplayer
Tech solutions and tricks in real time mobile multiplayer
DevGAMM Conference
 
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
 
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
DevClub_lv
 
JS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3D
JS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3DJS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3D
JS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3D
JSFestUA
 
Designing a pragmatic back-end service for mobile games
Designing a pragmatic back-end service for mobile gamesDesigning a pragmatic back-end service for mobile games
Designing a pragmatic back-end service for mobile games
iFunFactory Inc.
 
Deploying a Low-Latency Multiplayer Game Globally: Loadout
Deploying a Low-Latency Multiplayer Game Globally: Loadout Deploying a Low-Latency Multiplayer Game Globally: Loadout
Deploying a Low-Latency Multiplayer Game Globally: Loadout
Amazon Web Services
 
GDC Next 2013 - Synching Game States Across Multiple Devices
GDC Next 2013 - Synching Game States Across Multiple DevicesGDC Next 2013 - Synching Game States Across Multiple Devices
GDC Next 2013 - Synching Game States Across Multiple Devices
David Geurts
 

Similar to Developing Multiplayer Games in Unity3D (20)

Lets Play Together
Lets Play TogetherLets Play Together
Lets Play Together
 
Photon Session / Unite12 Conference
Photon Session / Unite12 ConferencePhoton Session / Unite12 Conference
Photon Session / Unite12 Conference
 
Behind the Scenes: Deploying a Low-Latency Multiplayer Game Globally
Behind the Scenes: Deploying a Low-Latency Multiplayer Game GloballyBehind the Scenes: Deploying a Low-Latency Multiplayer Game Globally
Behind the Scenes: Deploying a Low-Latency Multiplayer Game Globally
 
Building Multiplayer Games (w/ Unity)
Building Multiplayer Games (w/ Unity)Building Multiplayer Games (w/ Unity)
Building Multiplayer Games (w/ Unity)
 
Reliving the history of multiplayer games
Reliving the history of multiplayer gamesReliving the history of multiplayer games
Reliving the history of multiplayer games
 
Applying AI in Games (GDC2019)
Applying AI in Games (GDC2019)Applying AI in Games (GDC2019)
Applying AI in Games (GDC2019)
 
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
 
Building fast,scalable game server in node.js
Building fast,scalable game server in node.jsBuilding fast,scalable game server in node.js
Building fast,scalable game server in node.js
 
GDC 2015 - Low-latency Multiplayer Gaming with AWS
GDC 2015 - Low-latency Multiplayer Gaming with AWS GDC 2015 - Low-latency Multiplayer Gaming with AWS
GDC 2015 - Low-latency Multiplayer Gaming with AWS
 
P2P with Flash Player 10.1
P2P with Flash Player 10.1P2P with Flash Player 10.1
P2P with Flash Player 10.1
 
Flash Camp Chennai - P2P with Flash Player 10.1
Flash Camp Chennai - P2P with Flash Player 10.1Flash Camp Chennai - P2P with Flash Player 10.1
Flash Camp Chennai - P2P with Flash Player 10.1
 
Tech solutions and tricks in real time mobile multiplayer
Tech solutions and tricks in real time mobile multiplayerTech solutions and tricks in real time mobile multiplayer
Tech solutions and tricks in real time mobile multiplayer
 
GamingAnywhere: An Open Cloud Gaming System
GamingAnywhere: An Open Cloud Gaming SystemGamingAnywhere: An Open Cloud Gaming System
GamingAnywhere: An Open Cloud Gaming System
 
Les 1 ppt
Les 1 pptLes 1 ppt
Les 1 ppt
 
Les 1 ppt
Les 1 pptLes 1 ppt
Les 1 ppt
 
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
 
JS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3D
JS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3DJS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3D
JS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3D
 
Designing a pragmatic back-end service for mobile games
Designing a pragmatic back-end service for mobile gamesDesigning a pragmatic back-end service for mobile games
Designing a pragmatic back-end service for mobile games
 
Deploying a Low-Latency Multiplayer Game Globally: Loadout
Deploying a Low-Latency Multiplayer Game Globally: Loadout Deploying a Low-Latency Multiplayer Game Globally: Loadout
Deploying a Low-Latency Multiplayer Game Globally: Loadout
 
GDC Next 2013 - Synching Game States Across Multiple Devices
GDC Next 2013 - Synching Game States Across Multiple DevicesGDC Next 2013 - Synching Game States Across Multiple Devices
GDC Next 2013 - Synching Game States Across Multiple Devices
 

Recently uploaded

Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 

Recently uploaded (20)

Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 

Developing Multiplayer Games in Unity3D

  • 2. Adrian Popovici Software developer by day Game developer by night
  • 3. Games Digital Void Entertainment Galactic Hunt ∙ Zorah ∙ Pulse First prizes on gamedev.ro Future Visions Games Desert Land 2115 Early access on Steam
  • 4. Future Visions Games Empire of the Fallen Steel Steam Greenlight
  • 5. Agenda 1. Multiplayer 2. Technical details 3. Multiplayer solutions 4. Possible problems 5. Interesting facts 6. Demo
  • 7. Multiplayer: in general May not refer to LAN or online only! Can also be on the same platform: › Split-Screen: Need for Speed › Same-Screen: Move or Die - check it out! › Hotseat: Worms, Disciples 2
  • 8. Multiplayer: LAN / online Multiplayer: data synchronization between two or more nodes in a network A realm of smoke and mirrors for developers
  • 10. Transport protocols TCP UDP Reliability reliable unreliable Connection connection oriented connectionless Retransmission Segment retransmission and flow control through windowing No window or retransmission Sequencing Segment sequencing No sequencing Acknowledgement Acknowledge segments No acknowledgement Speed Slow Fast
  • 11. Multiplayer architectures Based on the control of the data: › Client-server: centralized › Peer to peer: decentralized › Hybrid: mixed
  • 13. Client-server Characteristics The server has control Clients only provide input Pros No easy cheating at the client side Easy synchronization between clients Cons Server maintenance Server load: it does most of the work, so it needs more power
  • 15. Peer to peer Characteristics Clients control their individual actions No actual server Pros No hosting costs Fast if less clients Cons Cheating heaven Synchronization can be a hard problem
  • 16. Hybrid Trade-offs between server and client, e.g.: Master client: a client that takes the role of the server and handles all synchronizations Server as facilitator: a server that checks metadata and stores everything in one place but clients do their own calculations
  • 17. Data transfer approaches Very hard Discrete, change the state of the game, player etc., e.g., player death, map change Very hard with interpolation Usually position, rotation, animation Hard with sync Requires synchronization rarely, e.g., a clock that is started with the game
  • 18. Data transfer approaches Delayed hard Using data from the past, e.g., playing vs a ghost car from a player who played before Soft Can be used for pathfinding or data that is not mandatory to be exact on each node Very soft Result already processed but the client receives it later, e.g., games like Travian
  • 20. Multiplayer solutions: choice Pick what makes sense by answering, e.g.: › What type of game am I developing? › What is the expected monthly user ratio? › What is the level of security in the game? › What server issues appear and how to handle? › Do I want just an easy solution that works?
  • 21. Multiplayer solutions: examples › Unity Multiplayer › Smartfox › Amazon Web Services › Bolt › Photon Unity Network (PUN)
  • 22. PUN: features › Authentication › Matchmaking › In-game communication › Integration with Unity › Free for 20 concurrent connections
  • 23. PUN: Photon Cloud › Uses a hybrid architecture › No server, only clients › One client takes the Master Client role › Photon handles network address translation, game session finding and other problems that appear between clients
  • 24. PUN: adding it to Unity Takes only 4 steps: 1. Get the Photon Unity network from the asset store 2. Creat an account on photonengine.com 3. Create a new application and get the ID 4. Insert the ID in the Photon Unity network
  • 25. PUN: connecting to the server Common Methods › PhotonNetwork.ConnectUsingSettings( ) › PhotonNetwork.JoinRandomRoom( ) › PhotonNetwork.CreateRoom( ) Common Callbacks › OnConnectedToMaster( ) › OnJoinedLobby( ) › OnFailedToConnectToPhoton( )
  • 26. Continuous updates Done after a specific interval Used for position, animation Data transfer: hard with interpolation PUN: data server Remote procedure calls Called specifically by a client Can be queued for late- joining players Can be targeted Data transfer: very hard, soft
  • 27. PUN: Photon Core Unity 3D component used for all operations:
  • 28. PUN: Photon View Can observe: 1. Unity 3D components 2. Photon sync components a. PhotonTransformView b. PhotonAnimatorView 3. Custom user scripts a. OnPhotonSerializeView b. Remote procedure calls
  • 29. PUN: Master Client › Picked uniformly at random by Photon Engine › Re-picked if the current master disconnects › There should always be one master at all times › while a game session is in progress › Has more power than normal clients can take ownership of objects › Should implement the game logic
  • 30. PUN: object ownership PhotonNetwork.Instantiate › creates a player-owned object. › if a player disconnects, the object disappears Scene objects › instantiated by the master client › don’t disappear, even if the master client is changed
  • 31. 4 Possible problems Latency at game Network address translation Cheating players Synchronization
  • 32. Latency At Game: problem › Multiplayer enemy No. 1 › Affects even LAN networks › Can create frustration among players › Probably the most annoying thing anyone experienced in multiplayer
  • 33. Latency At Game: solution Compensation: making up for the lost time; processes the time of the player’s action Prediction: client predicting local actions without the server’s confirmation. Confirmed later by the server’s message, later, when it arrives Interpolation: client tries to figure out the values between the sparse values received from the server
  • 34. Network Address Translation: problem Multiplayer games may work in LAN When the developers decide to take it to the next level, NAT appears, and it’s here to stay! Since the IPs over the internet are not the same as those on the LAN, the connection won’t be possible
  • 35. Network Address Translation: solution › Port Forwarding from local router › Universal Plug and Play › Relay Server with real IP › Using a solution out-of-the box like Photon, which performs this already
  • 36. Cheating: problem Usually done by players: › Directly by fiddling with the code or the packets sent on the network › Indirectly by finding a flaw in the network design and using that to gain advantages Examples of cheats: Wallhack, maphack, teleportation, invincibility or unlimited ammo
  • 37. Cheating: solution › Fix all bugs that appear › Do not provide invisible information to a player., e.g., if an enemy is behind a wall › Try to use a client-server architecture, this will minimize consistently the cheating factor › Implement a reporting system and IP ban › Implement a lockstep protocol
  • 38. Synchronization: problem If the synchronization still persists due to poor server components or poor connections, you can implement some hacks to make the game faster Developer forgets to implement some edge cases and one user sees information that others don’t
  • 39. Synchronization: solution › Don’t show projectiles, just compute them, as in, e.g., Counter Strike › Reduce the data or compress it
  • 41. Quake › Created the client-server architecture › Gave birth to: › Online gaming that we currently know › Online server lists › Clan gaming
  • 43. 6 Demo Data transmission using the Photon Unity network
  • 45. Resources ∙ Credits › Multiplayer video game. Wikipedia link › Lag compensation explained. Call of Duty Community Forums link › Source multiplayer networking. Lag compensation. Valve Community Network Developer Wiki link › Introduction to multiplayer game programming by Brian Hook. Book of Hook link › Fast-paced multiplayer by Gabriel Gambetta link › Why do some networked games use interpolation and some use pathfinding for remote movement? StackOverflow link › Lockstep protocol. Wikipedia link › Why Quake changed games forever? by Ryan Winterhalter. 1up link › Dumaine Google presentation theme by Jimena Catalina. Slides Carnival link › Icons8 icons with Creative Commons Attribution-NoDerivs 3.0 Unported free license link