Networking Tech Talk - Ohio State Computer Science and Engineering

Download Report

Transcript Networking Tech Talk - Ohio State Computer Science and Engineering

CSE 5912 Networking Tech Talk
Mike Alquist.2
Glen Gainer.25
Austin Neidert.13
Before Internet
□
□
□
□
Time-Sharing
Host-based
LAN / Ethernet
Peer-to-peer
Time-Sharing
□ PLATO
□ Empire
■Wargame
similar to Risk
■Text based
Host-Based
□ MUD
■ Roy Trubshaw
■ Text-based RPG
Adventure
■ Multiple users
on one network
Peer-to-Peer Networks
□Maze War
□https://youtu.be
/7chDIySXK2Q?t
=2m20s
□2:20
LAN / Ethernet
□ SGI Dogfight
■ Developed 1983
■ 1984 - Local
Network
capabilities
■ 1986 - UDP
broadcast
capability added
■ 1989 - IP Multicast
capability
(224.0.1.2)
Eventually, Internet
□
□
□
□
College → Industry
Burst of Multiplayer Games
Disks → Online Software
Facebook Games
Notable Games
□ Neverwinter
Nights
□ Doom
□ Quake
□ Command &
Conquer
□ Diablo
□ Counter Strike
Use Case: Counter Strike Updates
□ Problem: Updates, version
mismatches, cheating,
licensing
□ Solution: Steam
■ Buy games online
■ Scheduled updates
■ VAC
□ Downloads immediate data
■ Ability to rollback
□ Requires broadband
connection
With the Internet Came Risks
□ Piracy
□ Network Security Issues
■Technological Risks (Malware)
■Social Risks (Social Engineering)
□ Data Breaches
■PlayStation Network (2011)
■Steam (2015)
Data Breach Use Case:
PlayStation Network
□ External Intrusion (Anonymous?)
□ 77 Million Users Affected
□ Network down for 23 days
□ Sony releases patch 3.61 to fix
security issues
■Still didn’t go online
□ May 14th - Service restoration
Internet Layers
5 Layer Model
Application
Transport
Network
Link
Physical
Physical Layer
 How to send bits out over a cable
Twisted Pair Cable
Fiber Optic Cable
Link Layer
 How to make sure bits get across
safely between two machines
Ethernet frame
Preamble for
Synchronization
& Flow control
Data defined in
higher network
layer
CRC for
Error
checking
Network Layer
 How to make sure bits get to the
right machine in whole network
Transportation Layer
 TCP – Transmission Control Protocol
 UDP – User Datagram Protocol
UDP - User Datagram Protocol
 a.k.a Unreliable Datagram Protocol
 Connectionless / Datagram Based
TCP - Transmission Control Protocol
 Reliable
 Connection Oriented / Stream Based
TCP Details (3 Way Handshake)
TCP Details (Sending Data)
Request / Data
ACK
Alternating Bit
Sliding Window
TCP Details (Closing Connection)
Which protocol UDP/TCP to use?
Application Layer
 How to interpret the bits
Questions so far?
 Send us an ACKnowledgement of
understanding before we present the
next packet of information to you.
 Or help us stall for time, your choice.
Implementation in Games
□ Basic communication
□ Basic game models
□ Problems that arise as a result of
networking
□ Socket Libraries
Basic Communication
□ Players send messages
□ Players receive messages
■ need to be handled
□ Command Pattern used often
Basic Game Models
□ MMO
■Server/Client
□ Matchmade Game/First Person
Shooter
■Server/Client
■Some clients act as a server for their
game
Problems
□
□
□
□
□
□
Socket Exceptions
Threading Problems
Point Interpolation
Back to Back Messages
Port Forwarding
Cheating
Socket Exceptions
□ socket.accept()
■ server initialization
■ incorrect protocol
■ socket already bound
Socket Exceptions
□ socket.connect()
■ server can’t be reached
■ incorrect IP address
■ incorrect port
■ not port forwarded
■ server never started
Socket Exceptions
□
socket.send()
■ unexpected disconnection
Socket Exceptions
□
socket.receive()
■ unexpected disconnection
■ end of stream
□ null message
□ empty message
□ -1 returned
Threading Problems
□ Blocking I/O
□ Accessing resources with separate
threads
■ message buffer
■ semaphores
■ check for null
□ Game logic in Unity needs to be
handled in the main thread
Point Interpolation
□ Smooth look and feel
□ Continuous variables
■ location
□ State related problems
■ animation
Back to Back Messages
□ socket.send() gets called faster than
socket.receive() can be called and
handled
Port Forwarding
□
□
□
□
When hosting a server
Static internal IP address
Static external IP address
No-IP
Cheating
□ Let server handle important game play
□ Server verifies clients’ actions are valid
before telling other clients
□ Client uses necessary information for
display
Socket Libraries - .Net Sockets
□ Lower level
□ Sends and receives byte arrays
□ All message handling is left to the
programmer
□ All serialization is left to the
programmer
Socket Libraries - UNet
□ Higher level
□ Done for you
■ some
■ some
■ some
■ some
sending
receiving
handling
serialization
□ Also has classes that allow the
programmer to do manual sending
and handling
Socket Libraries - UNet
Socket Libraries - UNet
□ Important classes
■ NetworkBehaviour
□ [Server]
□ [Client]
□ [SyncVar]
■ NetworkTransform
■ NetworkProximityChecker
□ Authority properties
Socket Libraries - UNet
□ Attribute Examples
Final Questions?