<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=Game_Engines_2021W_Lecture_16</id>
	<title>Game Engines 2021W Lecture 16 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=Game_Engines_2021W_Lecture_16"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Game_Engines_2021W_Lecture_16&amp;action=history"/>
	<updated>2026-04-08T03:16:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Game_Engines_2021W_Lecture_16&amp;diff=23019&amp;oldid=prev</id>
		<title>Soma: Created page with &quot;&lt;pre&gt; MMO&#039;s ----- MMOs are probably the hardest distributed applications to build  What is hard when you do a distributed application?  - managing consistent state  - managing...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Game_Engines_2021W_Lecture_16&amp;diff=23019&amp;oldid=prev"/>
		<updated>2021-03-11T19:31:05Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; MMO&amp;#039;s ----- MMOs are probably the hardest distributed applications to build  What is hard when you do a distributed application?  - managing consistent state  - managing...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
MMO&amp;#039;s&lt;br /&gt;
-----&lt;br /&gt;
MMOs are probably the hardest distributed applications to build&lt;br /&gt;
&lt;br /&gt;
What is hard when you do a distributed application?&lt;br /&gt;
 - managing consistent state&lt;br /&gt;
 - managing latency&lt;br /&gt;
&lt;br /&gt;
Latency is always an issue in games&lt;br /&gt;
 - time from input to modifying output&lt;br /&gt;
   - e.g., how long for a keypress to be echoed in a&lt;br /&gt;
     terminal&lt;br /&gt;
 - we want them responsive&lt;br /&gt;
&lt;br /&gt;
But add in wide-area networking and it gets much harder&lt;br /&gt;
 - we&amp;#039;re always fighting the speed of light&lt;br /&gt;
 - and networking infrastructure adds additional slowdowns&lt;br /&gt;
 - add in packet loss &amp;amp; delay and it gets much worse&lt;br /&gt;
   - really bad for TCP streams&lt;br /&gt;
&lt;br /&gt;
TCP congestion control?&lt;br /&gt;
&lt;br /&gt;
Internet is based on TCP/IP&lt;br /&gt;
 - IP: packets, sent best effort&lt;br /&gt;
   - just a fixed-sized record of data with source and&lt;br /&gt;
     destination, i.e., a message&lt;br /&gt;
   - IP makes no guarantees whether packets will arrive or&lt;br /&gt;
     not, or what order&lt;br /&gt;
 - TCP layers atop IP to build connections&lt;br /&gt;
   - i.e., a pipe&lt;br /&gt;
   - continuous byte stream with guaranteed order,&lt;br /&gt;
     integrity&lt;br /&gt;
   - but, at the cost of arbitrary delays (i.e.,&lt;br /&gt;
     data has to be re-sent)&lt;br /&gt;
 - if you don&amp;#039;t need these guarantees, you use UDP&lt;br /&gt;
   on top of IP&lt;br /&gt;
&lt;br /&gt;
So, if we care about latency, TCP is a problem&lt;br /&gt;
 - no guarantees about data delivery&lt;br /&gt;
 - in fact, when packets are lost, TCP interprets&lt;br /&gt;
   this as congestion (i.e., too much data) and expotentially slows things down (throttles)&lt;br /&gt;
&lt;br /&gt;
Why is video streaming easier than gaming, from a distributed perspective?&lt;br /&gt;
 - you don&amp;#039;t care about latency with video so much&lt;br /&gt;
 - so you can buffer&lt;br /&gt;
   - this is why pause can take a while to work on some&lt;br /&gt;
     platforms&lt;br /&gt;
   - (what should happen is pause happens instantly&lt;br /&gt;
      even if the data keeps coming for a while longer)&lt;br /&gt;
   - you really see this when seeking&lt;br /&gt;
&lt;br /&gt;
You have to develop ways to hide latency in an MMO&lt;br /&gt;
 - but you can&amp;#039;t just cache&lt;br /&gt;
 - one major strategy&lt;br /&gt;
   - predict what the players will do (simulations)&lt;br /&gt;
     - originally just dead reckoning&lt;br /&gt;
   - build in undo (rollback) when simulation is wrong&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
You also try to reduce latency&lt;br /&gt;
 - localized servers&lt;br /&gt;
 - minimize communication&lt;br /&gt;
   - send as little data as possible back and forth&lt;br /&gt;
   - but this means the clients have to do more&lt;br /&gt;
   - and this enables cheating&lt;br /&gt;
   - because the world is resident on the client&lt;br /&gt;
     - so the client knows things the player shouldn&amp;#039;t&lt;br /&gt;
     - cheats can make this info available to the player&lt;br /&gt;
     - example: seeing through walls&lt;br /&gt;
   - this is why many online games are so strict about&lt;br /&gt;
     DRM or are restricted to consoles&lt;br /&gt;
&lt;br /&gt;
The other hard thing with MMOs is managing shared state&lt;br /&gt;
 - because it is so easy to get inconsistency&lt;br /&gt;
&lt;br /&gt;
This is really just the parallel programming problem&lt;br /&gt;
 - it is even hard on the client (i.e., multi-core&lt;br /&gt;
   programming)&lt;br /&gt;
&lt;br /&gt;
Parallel programming is hard because it isn&amp;#039;t easy&lt;br /&gt;
for two cores (connected in ANY way) to have consistent view of any shared state&lt;br /&gt;
 - really, the only data they manipulate are in their&lt;br /&gt;
   registers&lt;br /&gt;
 - data in registers is loaded from and stored to caches and then main memory (RAM), and from there sent over the network&lt;br /&gt;
   - at any place where data is stored, concurrent access&lt;br /&gt;
     is problematic&lt;br /&gt;
   - because all concurrent access is actually networking&lt;br /&gt;
     of some kind&lt;br /&gt;
&lt;br /&gt;
Cores A and B, data x&lt;br /&gt;
A set x=5&lt;br /&gt;
B checks if x=5, then sets it to 0&lt;br /&gt;
What&amp;#039;s the value of x?&lt;br /&gt;
 - could be 5, could be 0, depending on the order&lt;br /&gt;
 - this is a race condition&lt;br /&gt;
&lt;br /&gt;
To avoid non-deterministic behavior, we have locks&lt;br /&gt;
 - but locks are just a protocol for deciding&lt;br /&gt;
   who went first&lt;br /&gt;
 - they ALWAYS slow things down, sometimes&lt;br /&gt;
   exponentially&lt;br /&gt;
&lt;br /&gt;
So in the end, it is all messages&lt;br /&gt;
 - order of messages matter&lt;br /&gt;
&lt;br /&gt;
data is never consistent unless we make sure it is&lt;br /&gt;
&lt;br /&gt;
Player A shoots enemy, kill it&lt;br /&gt;
Player B sees enemy&lt;br /&gt;
 - is it dead?&lt;br /&gt;
&lt;br /&gt;
This is why development in teams is harder than&lt;br /&gt;
development on your own&lt;br /&gt;
 - coordination is hard, because communication&lt;br /&gt;
   is expensive&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Think about Fortnight&lt;br /&gt;
 - note the limit of 100 players, not too many,&lt;br /&gt;
   can be centralized in one server&lt;br /&gt;
 - matchmaking may use geographic location (ping times) to&lt;br /&gt;
   choose who should play whom&lt;br /&gt;
   - that&amp;#039;s latency tolerant&lt;br /&gt;
 - lots of opportunities for predicting player behavior&lt;br /&gt;
 - but if your connection is bad, you&amp;#039;re going to die&lt;br /&gt;
   and not even realize it&lt;br /&gt;
&lt;br /&gt;
Whether your MMO works or not really depends on&lt;br /&gt;
your game design&lt;br /&gt;
 - has to take into account limitations of medium&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
</feed>