Networking CS 3152: Game Networking Issues

Networking CS 3152: Game Networking Issues

the gamedesigninitiative at cornell university Networking CS 3152: Game Networking Issues Consistency Security Do our games agree? What cheats are possible? Where do I see objects? View hidden data Where do you see them? Enter invalid states Who is authoritative? Improve player skill How to force agreement? How do we cheat proof? Do I wait for everyone? Technical solutions? Do I guess and fix errors? Community policing? CS 3152: Game Networking Issues Consistency Security Do our games agree? What cheats are possible? Where do I see objects? View hidden data Where do you see them? Enter invalid states Who is authoritative? Improve player skill Today’s Lecture Not going to cover How to force agreement? How do we cheat proof? Do I wait for everyone? Technical solutions? Do I guess and fix errors? Community policing? The Issue of Consistency Latency is root of all evil Player 1 Player 2 Local actions are instant Network actions are slow Fire Move Example: targeting Want “geometric fidelity” time Move Fire Fire a weapon along ray Hits first object on ray But movement is fast! How to tell these cases apart? World State vs. Local State State: all objects in game Local State: on a machine World State: “true” state World State Where is the world state? On a single machine? Union of local states? Local Local State State States may be inconsistent Local disagrees with world Is this really a problem? What can we do about it? The Question of Authority Centralized Authority Distributed Authority One computer is authority Authority is divided up Stores the full world state Each object has an owner Local states must match it Must match if not owner Often call this the “server” Classically call this “P2P” World State World State Local Local (Authority) State State Local Local Authority Authority Authority and Latency Client Authority Sample Input Process Input Render Screen Compute State Lack of authority enforces a delay Only draw what authority tells you Requires round trip from your input Round-trip time (RTT) can be > 200 ms This makes the game less responsive Need some way to compensate for this Authority and Latency Client Authority Sample Input Process Input Render Screen Compute State Lack of authority enforces a delay Only draw what authority tells you Requires round trip from your input Round-tripNeed to understand time (RTT) basics can bebefore > 200 solving ms this This makes the game less responsive Need some way to compensate for this Networking Breaks into Two Phases Matchmaking Game Session Service to find other players Service to run the core game Groups players in a session Synchronizes player state But does not run session Supports minor adds/drops Why make your own? Why make your own? Control user accounts Must tailor to your game Implement skill ladders You often have no choice 3rd party services common Limited 3rd party services Apple GameCenter Often just a networking API GooglePlay API For limited class of games Unity’s server classes Examples: Unity, Unreal Networking Breaks into Two Phases Matchmaking Game Session Service to find other players Service to run the core game Groups players in a session Synchronizes player state But does not run session Supports minor adds/drops Why make your own? Why make your own? SimplifyControl user if accountspossible MustOur tailor main to yourfocus game Implement skill ladders You often have no choice 3rd party services common Limited 3rd party services Apple GameCenter Often just a networking API GooglePlay API For limited class of games Unity’s server classes Examples: Unity, Unreal Matchmaking: Apple/iOS Uses the GameKit library Supports multiplayer games Also leaderboards/achievements Not a full game engine Very simple matchmaking Specify the number of players Invite anyone on friends list Invite anyone in BlueTooth range Or allow Apple to hook you up Can be simultaneous with session Add more players if slots available iOS Matchmaking Classes Real Time Turn Based You handle authority Apple handles authority Allows variety of strategies Stores state on Apple server Focus of rest of lecture GKTurnBasedMatchmaker- GKMatchmakerViewController ViewController Classic matchmaking UI Classic matchmaking UI You add a listener/delegate You add a listener/delegate GKMatchmaker GKTurnBasedMatch Controller with no UI Controller with no UI Allows a custom view Allows a custom view iOS Matchmaking Classes Real Time Turn Based You handle authority Apple handles authority Allows variety of strategies Stores state on Apple server Focus of rest of lecture GKTurnBasedMatchmaker- GKMatchmakerViewController ViewController Classic matchmaking UI Classic matchmaking-C++ UI Will require you to use Objective You add a listener/delegate You add a listener/delegate GKMatchmaker GKTurnBasedMatch Controller with no UI Controller with no UI Allows a custom view Allows a custom view Advantages of a Custom UI Key if mixing AI and multiplayer Android USED To Have This Too Part of the Google Play API Supported multiplayer games Also leaderboards/achievements Also some minor game analytics Worked exactly like GameKit Choose real-time or turn-based Use Google UI or a custom one Only differed in terminology Had a native C++ API No need for Java or JNI Plug it straight in CUGL Android USED To Have This Too Part of the Google Play API Supported multiplayer games Also leaderboards/achievements Also some minor game analytics Worked exactly like GameKit Choose real-timeGoogle or turn-based Killed It! Use Google UI or a custom one Only differed in terminology Had a native C++ API No need for Java or JNI Plug it straight in CUGL Modern Google Alternatives Firebase Open Match Restful, realtime database Open source matchmaker Simple syncing across apps Runs on Kubernetes Makes consistency easy Instance just for your game Can solve both issues No game session logic Groups players in matches You still have to do this Sync state during session But that is normally the case Used by Family Style Made by Google/Unity But server costs expensive! The future of Unity netcode Cheaper to just matchmake But is engine agnostic Custom Matchmaking You can make your own Hard part is the server Need a fixed IP address Matchmaker IP is coded into the game But can leverage cloud tech Write a Docker container Or just use Firebase Benefit: cross-platform play Must for iOS-Android play Reason for Open Match Custom Matchmaking Ask for Game Session Matchmaker Client Client Custom Matchmaking Respond with Group Matchmaker Client Client Custom Matchmaking Reconnect if Dropped Matchmaker Game Session Matchmaking in Family Style Why Not Just Direct IPs? Idea: Make one game “the server” Player starts up server instance Player writes down their IP address Everyone else types in that IP address Problem: Network Address Translation Most networks use NAT to attach many devices This means IP addresses on NAT are not real Mathmaker provides NAT punchthrough! Reason why you keep it open for reconnects Game Session: Part of Core Loop Client Authority Update Update Draw Decoupling the Network Loop Client Authority Local Update Network Update Update Draw Decoupling the Network Loop Client Authority Local Update Network Update Update Draw Possibly slower Should match Smooth local tick rate (10 fps) the client rate animation Decoupling Enables Latency Masking Animation is “buying time” Looks fast and responsive But no real change to state Animation done at update Examples: Players wait for elevator Teleportation takes time Many hits needed per kill Bullets have flying time Inertia limits movement Game Session: Dedicated Server Server developer provides Acts as central authority Client May be several servers Client Client May use cloud services Pros: Could be real computer Client Server Client More power/responsiveness No player has advantage Client Client Cons: Lag if players not nearby Client Expensive to maintain Game Session: AdHoc Server One client acts as host Host Acts as central authority Client Chosen by matchmaker But may change in session Client Client Pros: Cheap long-term solution Client Client Can group clients spatially Cons: Client Client Server is a mobile device Host often has advantages Client Must migrate if host is lost Game Session: AdHoc Server One client acts as host Host Acts as central authority Client Chosen by matchmaker But may change in session Client Client Pros: Predominant Cheap long-term solution commercial Client Client Can group clients spatially architecture Cons: Client Client Server is a mobile device Host often has advantages Client Must migrate if host is lost Game Session: True P2P Authority is distributed Coordinator Each client owns part of state Client Special algorithms for conflict Coordinator for adds/drops Client Client Pros: No lag on owned objects Client Client Lag limited to “attacks” Same advantages as adhoc Client Client Cons: Incredibly hard to implement Client High networking bandwidth Game Session: True P2P Authority is distributed Coordinator Each client owns part of state Client Special algorithms for conflict Coordinator for adds/drops Client Client Pros:Almost no-one No lag on owned objects does this outside Client Client Lag limited to “attacks” academia Same advantages as adhoc Client Client Cons: Incredibly hard to implement

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    48 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us