programming multiplayer game - wordpress.com · 2013-10-10 · phoenix area game developer since...
TRANSCRIPT
![Page 1: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/1.jpg)
Multiplayer Game Programming
![Page 2: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/2.jpg)
David Koontz@dkoontz
dkoontz.wordpress.com
● Phoenix area game developer since 2001● Teacher at Art Institute since 2006● Worked on a variety of educational and
commercial games● Author of iTween Visual Editor and
CameraFor2D components for Unity● Currently developing Star. Ship. Story., a
co-op space faring adventure○ Slightly crazy to be making a
multiplayer game
![Page 3: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/3.jpg)
How the Internet worksSpecial considerations for gamesUsing a library vs writing your ownExisting tools for Flash, C#, HTMLQuestions
Content Packet Header
![Page 4: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/4.jpg)
How the Internet worksSpecial considerations for gamesUsing a library vs writing your ownExisting tools for Flash, C#, HTMLQuestions
Content Packet Header
![Page 5: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/5.jpg)
The Problem
A B
![Page 6: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/6.jpg)
The Problem
A B
![Page 7: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/7.jpg)
The Problem
A B
![Page 8: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/8.jpg)
The Problem
A B
?
![Page 9: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/9.jpg)
The Problem
A B
![Page 10: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/10.jpg)
The Problem
A B
![Page 11: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/11.jpg)
The Problem
A B
![Page 12: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/12.jpg)
The Problem
A B
![Page 13: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/13.jpg)
The Problem
A B
![Page 14: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/14.jpg)
The Problem
A B
![Page 15: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/15.jpg)
The Problem
A B
![Page 16: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/16.jpg)
The Problem
A B
![Page 17: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/17.jpg)
The Problem
A B
![Page 18: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/18.jpg)
The Problem
A B
![Page 19: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/19.jpg)
The Internet functions by being able to break data (usually cats) into “packets” and then (semi)reliably delivering those packets to their destination using whatever networks are available.
IP Protocol
Destinations are numbered addresses that look like this:
127.0.0.1192.168.0.10068.105.28.11
![Page 20: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/20.jpg)
The “protocol” bit of the “IP Protocol” is just the expected actions of each party participating in the exchange and an agreed upon way of interpreting data sent between the systems
What is a protocol?
![Page 21: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/21.jpg)
What is a protocol?
Shaking hands when meeting someone is a social protocol. Signalling before changing lanes is standard driving protocol. “Belay, on belay, belay on” is standard rock climbing protocol.
The “protocol” bit of the “IP Protocol” is just the expected actions of each party participating in the exchange and an agreed upon way of interpreting data sent between the systems
![Page 22: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/22.jpg)
It’s protocols all the way down
TCP
ReliableOrdered
Maintains a connectionNeeds handshake
Fetching a web siteTransferring a fileChat messages
Turn based games
UDP
UnreliableUnordered
ConnectionlessLess overhead per packet
Voice chatMost high action games
Anything severely affected by latency
IP
![Page 23: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/23.jpg)
Both TCP and UDP add another element to the “where” part of delivering a packet
Ports
68.105.28.11:3724
![Page 24: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/24.jpg)
Both TCP and UDP add another element to the “where” part of delivering a packet
Ports
68.105.28.11:3724
IP address Port
![Page 25: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/25.jpg)
Ports allow the receiving computer to differentiate the packets coming in for one application vs another
Ports
![Page 26: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/26.jpg)
Ports
Think of how many applications you have receiving data at once through the same network connection
![Page 27: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/27.jpg)
Ports
Web browser AIM PandoraSkype MSN SpotifySystem updates GChat Games
![Page 28: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/28.jpg)
The anatomy of an IP packetTo
tal l
engt
h, p
roto
col
num
ber,
othe
r im
porta
nt
but b
orin
g va
lues
Sou
rce
IP a
ddre
ss
Des
tinat
ion
IP a
ddre
ss
Dat
a
Por
t, H
ands
hake
info
, se
quen
ce n
umbe
r, et
c.
Header
![Page 29: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/29.jpg)
The anatomy of an IP packetTo
tal l
engt
h, p
roto
col
num
ber,
othe
r im
porta
nt
but b
orin
g va
lues
Sou
rce
IP a
ddre
ss
Des
tinat
ion
IP a
ddre
ss
Dat
a
IP Protocol Your application’s protocolTCP/UDP
Por
t, H
ands
hake
info
, se
quen
ce n
umbe
r, et
c.
16 bytes 16 bytes /4 bytes
![Page 30: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/30.jpg)
The data that is sent mustbe converted to a format that can be sent across the Internet.
The process of converting your data to this format is called serialization
Serialization (aka marshalling)
Dat
a
![Page 31: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/31.jpg)
The serialized form of your data is always a byte array
Serialization
int
bool
float
string
serializer byte[ ]
![Page 32: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/32.jpg)
Deserialization is just the opposite process, extracting specific bits of data from the byte array as an int / float / string / etc.
Deserialization
int
bool
float
string
deserializerbyte[ ]
![Page 33: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/33.jpg)
You must know the format of the data that was serialized so that you can deserialize it correctly
Deserialization
float
bool
int
string
deserializerbyte[ ]
![Page 34: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/34.jpg)
You must know the format of the data that was serialized so that you can deserialize it correctly
Deserialization
float
bool
int
string
deserializerbyte[ ]
![Page 35: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/35.jpg)
How the Internet worksSpecial considerations for gamesUsing a library vs writing your ownExisting tools for Flash, C#, HTMLQuestions
Content Packet Header
![Page 36: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/36.jpg)
The game state is all the significant values needed in order for the game to operate.
Position / RotationPlayer itemsEnemy actionTime remaining
State
![Page 37: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/37.jpg)
All input can be processed on the same frame/update
There is only one game state
Cheating is handled by the players themselves
Input arrives inconsistently from clients
There are (# of player) game states
Cheating must be handled by the game
Local vs Internet multiplayer
![Page 38: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/38.jpg)
Unlike local multiplayer, each client has a unique but similar game state
Mostly synched game states
![Page 39: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/39.jpg)
Each player’s game must simulate the actions of the other players
Mostly synched game states
![Page 40: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/40.jpg)
Sometimes these simulations are wrong
Mostly synched game states
![Page 41: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/41.jpg)
Life on the Internet == Latency (Lag)
![Page 42: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/42.jpg)
The difficulty of keeping all the various clients synched up is directly related to the time sensitivity of your game.
Time sensitivity
![Page 43: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/43.jpg)
The difficulty of keeping all the various clients synched up is directly related to the time sensitivity of your game.
Time sensitivity
Async TurnBased Game
Twitch FPS
Egads, are you daft?
A worthy challenge my lad
RTS Diablo / Torchlight
Tactical FPSMMORPG
Parlor games, chess, poker
I doff my hat do thee
![Page 44: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/44.jpg)
A tale of two game statesPart 1
This seems pretty straightforward
![Page 45: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/45.jpg)
A tale of two game states
![Page 46: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/46.jpg)
A tale of two game states
![Page 47: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/47.jpg)
A tale of two game states
![Page 48: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/48.jpg)
A tale of two game states
![Page 49: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/49.jpg)
A tale of two game states
![Page 50: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/50.jpg)
A tale of two game states
![Page 51: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/51.jpg)
A tale of two game statesPart 2
Or so I thought
![Page 52: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/52.jpg)
A tale of two game states
![Page 53: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/53.jpg)
A tale of two game states
![Page 54: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/54.jpg)
A tale of two game states
![Page 55: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/55.jpg)
A tale of two game states
Character moved, shot missed
Character was shot, movement is ignored
![Page 56: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/56.jpg)
A tale of two game statesPart 3
A wild solution appears(It’s super effective)
![Page 57: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/57.jpg)
A tale of two game states
![Page 58: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/58.jpg)
A tale of two game states
![Page 59: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/59.jpg)
A tale of two game states
![Page 60: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/60.jpg)
A tale of two game states
![Page 61: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/61.jpg)
A tale of two game states
![Page 62: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/62.jpg)
A tale of two game statesFin
Ok, maybe not super effective
![Page 63: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/63.jpg)
A tale of two game states
60ms
![Page 64: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/64.jpg)
A tale of two game states
60ms
60ms
![Page 65: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/65.jpg)
A tale of two game states
![Page 66: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/66.jpg)
Waiting 120ms for your key press to be registered is a bad user experience
People expect immediate response times, especially in an action oriented game
Delayed input
![Page 67: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/67.jpg)
Extrapolation
![Page 68: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/68.jpg)
Extrapolation
![Page 69: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/69.jpg)
Extrapolation
![Page 70: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/70.jpg)
This technique allows the local machine to feel responsive, while still allowing the server to be authoritative
It may lead to snapping or “rubber banding” if the server’s version of the player’s position is different from what the local simulation predicted
Extrapolation
![Page 71: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/71.jpg)
Interpolation
![Page 72: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/72.jpg)
Interpolation
![Page 73: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/73.jpg)
Interpolation
![Page 74: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/74.jpg)
Allows the client to fix errors over a short time, largely hiding the error
When combined with extrapolation, can result in very smooth looking gameplay, even under higher lag conditions
Interpolation
![Page 75: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/75.jpg)
Extrapolating other clients
![Page 76: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/76.jpg)
Extrapolating other clients
![Page 77: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/77.jpg)
Extrapolating other clients
![Page 78: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/78.jpg)
Extrapolating other clients
![Page 79: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/79.jpg)
Extrapolating other clients
![Page 80: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/80.jpg)
Extrapolating other clients
![Page 81: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/81.jpg)
Extrapolating other clients
![Page 82: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/82.jpg)
Example videos
![Page 83: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/83.jpg)
ClientImmediate processing of input
Easy to cheat
Can result in inconsistent states
ServerMust wait for server to acknowledge input
Client are told the result of their own input
Server must be able to simulate the game
Client vs server authority
![Page 84: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/84.jpg)
● This means you can not trust ANYTHING the client sends you
● Clients are generally not allowed to communicate directly
● Clients make requests to the server to perform an action which the server carries out if that is ok○ Is it ok for this client to be requesting this action?○ Client A using item owned by Client B
The authoritative server
![Page 85: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/85.jpg)
Keep the server game logic isolated from the server “network” logic.
Allows you to upgrade these parts in isolation from each other
Suggestion
![Page 86: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/86.jpg)
One approach to server logic
Server network logic
A
B
C
Server game logic
byte[]
Player “Ub3r1337”
wants to jump
![Page 87: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/87.jpg)
One approach to server logic
Server network logic
A
B
C
Server game logic
Ok
OkPlayer “Ub3r1337”
jumped
Player “Ub3r1337”
jumped
![Page 88: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/88.jpg)
Depending on your game’s needs, that server might be a web server (http get/post), a socket server (real time communication) or some mixture of the two
It all depends
![Page 89: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/89.jpg)
Depending on your game’s needs, that server might be a web server (http get/post), a socket server (real time communication) or some mixture of the two
It all depends
Async TurnBased Game
Twitch FPS
UDP, socket server
HTTP over TCPPHP, Ruby on Rails, MVC.NET
RTS Diablo / Torchlight
Tactical FPSMMORPG
Parlor games, chess, poker
Socket server over TCP or UDP
![Page 90: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/90.jpg)
Depending on your game’s needs, that server might be a web server (http GET/POST), a socket server (real time communication) or some mixture of the two
It all depends
Async TurnBased Game
Twitch FPS
UDP, socket server
HTTP over TCPPHP, Ruby on Rails, MVC.NET
RTS Diablo / Torchlight
Tactical FPSMMORPG
Parlor games, chess, poker
Socket server over TCP or UDP
More off the shelf solutions Need custom solution
![Page 91: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/91.jpg)
How the Internet worksSpecial considerations for gamesUsing a library vs writing your ownExisting tools for Flash, C#, HTMLQuestions
Content Packet Header
![Page 92: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/92.jpg)
● Structure!
What does a library do for you?
![Page 93: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/93.jpg)
● Structure!● Message protocol
What does a library do for you?
![Page 94: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/94.jpg)
● Structure!● Message protocol● Serialization & deserialization
What does a library do for you?
![Page 95: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/95.jpg)
● Structure!● Message protocol● Serialization & deserialization● A structure for client lifecycle events
What does a library do for you?
![Page 96: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/96.jpg)
● Structure!● Message protocol● Serialization & deserialization● A structure for client lifecycle events
○ Connection / disconnection○ Authentication○ Chat○ Saving / retrieving user data○ Payments
What does a library do for you?
![Page 97: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/97.jpg)
● Structure!● Message protocol● Serialization & deserialization● A structure for client lifecycle events
○ Connection / disconnection○ Authentication○ Chat○ Saving / retrieving user data○ Payments
● Can provide a tie-in to hosting solutions
What does a library do for you?
![Page 98: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/98.jpg)
● You need to use their server and client libraries○ Both ends must be able to speak the same
protocol
What does a library impose on you?
![Page 99: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/99.jpg)
● You need to use their server and client libraries○ Both ends must be able to speak the same
protocol● May only be available for certain
languages or platforms
What does a library impose on you?
![Page 100: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/100.jpg)
● You need to use their server and client libraries○ Both ends must be able to speak the same
protocol● May only be available for certain
languages or platforms● May be closed source and / or commercial
What does a library impose on you?
![Page 101: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/101.jpg)
● You need to use their server and client libraries○ Both ends must be able to speak the same
protocol● May only be available for certain
languages or platforms● May be closed source and / or commercial● May impose limitations on how you deploy
or structure your server
What does a library impose on you?
![Page 102: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/102.jpg)
● Requires more familiarity with lower level network concepts (sockets, etc.)
Rolling your own
![Page 103: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/103.jpg)
● Requires more familiarity with lower level network concepts (sockets, etc.)
● Requires you to put in place a structure for your server and client
Rolling your own
![Page 104: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/104.jpg)
● Requires more familiarity with lower level network concepts (sockets, etc.)
● Requires you to put in place a structure for your server and client
● Requires you to develop your own message protocol and serialization / deserialization procedures
Rolling your own
![Page 105: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/105.jpg)
It depends!
So which is better?
![Page 106: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/106.jpg)
It depends!
No really, that’s my entire answer
So which is better?
![Page 107: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/107.jpg)
How the Internet worksSpecial considerations for gamesUsing a library vs writing your ownExisting tools for Flash, C#, HTMLQuestions
Content Packet Header
![Page 108: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/108.jpg)
Server as standalone
SmartFox (Java)Photon (C#)ElectroServer (Java)Player.IO (C#)Lidgren (C#)Flash Media ServerRed5 (Java)
Server as special client
uLink (Unity)Built in UnityBadumna (Unity)
Two types of solutions
![Page 109: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/109.jpg)
● Can be written in a language more appropriate for writing a server
Standalone server
![Page 110: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/110.jpg)
● Can be written in a language more appropriate for writing a server
● Can be used with any language / platform there is a client library for (or that you’re willing to develop a client library for)
Standalone server
![Page 111: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/111.jpg)
● Can be written in a language more appropriate for writing a server
● Can be used with any language / platform there is a client library for (or that you’re willing to develop a client library for)
● Needs to implement all the important logic of your game, and may not be able to reuse the same code from your client
Standalone server
![Page 112: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/112.jpg)
● Can be written in a language more appropriate for writing a server
● Can be used with any language / platform there is a client library for (or that you’re willing to develop a client library for)
● Needs to implement all the important logic of your game, and may not be able to reuse the same code from your client
● Can be as light or heavy weight as you need
Standalone server
![Page 113: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/113.jpg)
● Only one place to put the logic
Client as server
![Page 114: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/114.jpg)
● Only one place to put the logic● Both client and server are the same app
and can share logic
Client as server
![Page 115: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/115.jpg)
● Only one place to put the logic● Both client and server are the same app
and can share logic● Allows players to host games easily as
well as running dedicated hosts
Client as server
![Page 116: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/116.jpg)
● Only one place to put the logic● Both client and server are the same app
and can share logic● Allows players to host games easily as
well as running dedicated hosts● Must interface with some sort of front end
to manage user sessions
Client as server
![Page 117: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/117.jpg)
● Only one place to put the logic● Both client and server are the same app
and can share logic● Allows players to host games easily as
well as running dedicated hosts● Must interface with some sort of front end
to manage user sessions● Might have high overhead of running your
game client when not all of it is needed
Client as server
![Page 118: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/118.jpg)
● Only one place to put the logic● Both client and server are the same app
and can share logic● Allows players to host games easily as
well as running dedicated hosts● Must interface with some sort of front end
to manage user sessions● Might have high overhead of running your
game client when not all of it is needed● Keeping client and server code separate
can be tricky
Client as server
![Page 119: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/119.jpg)
Family Guy Online
Hybrid
A
B
C
Photon
Unity
Unity
D
![Page 120: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/120.jpg)
● The Internet is a modern marvel, but is not a panacea
● Internet multiplayer is a good way to make your game 10x more complex
● There are no general solutions, only specific answers to specific problems
Summary
![Page 121: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/121.jpg)
How the Internet worksSpecial considerations for gamesUsing a library vs writing your ownExisting tools for Flash, C#, HTMLQuestions
Content Packet Header
![Page 122: Programming Multiplayer Game - WordPress.com · 2013-10-10 · Phoenix area game developer since 2001 Teacher at Art Institute since 2006 Worked on a variety of educational and commercial](https://reader036.vdocument.in/reader036/viewer/2022070716/5eda1f5db3745412b570ce0d/html5/thumbnails/122.jpg)
David Koontz@[email protected]://dkoontz.wordpress.comhttp://happycamperstudios.com
Send complaints to: