<html>

<head>
<title>loonygames presents: Game Networking 101</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
a { text-decoration: none; }
a:hover { color:000000;  text-decoration: underline; }


</style>
</head>

<body bgcolor="#FFF4D0" link="#3333FF" vlink="#000000" alink="#000000">
<center>
</center>
<table width="100%" border="0" bgcolor="#3596B3" height="58">
  <tr> 
    <td height="69" width="29%" align="left" valign="top"> 
      <div align="left"> <font face="Arial, Helvetica, sans-serif" color="#FFFFFF"><b><i><img src="../../images/logo_new.jpg" width="182" height="63" border="0" usemap="#logoa"> 
        </i></b></font></div>
    </td>
    <td height="69" width="29%" align="center" valign="top"> <center>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-2373963192914918";
/* 468x60 */
google_ad_slot = "3417104156";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>
    </td>
  </tr>
</table>
<table width="100%" border="0" bgcolor="#3596B3" height="29">
  <tr> 
    <td height="20" width="25%" align="center" valign="middle" bgcolor="#86531A"> 
      <a href="../../../about.1"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF"><b><font size="2">about</font></b></font></a></td>
    <td height="20" width="25%" align="center" valign="middle" bgcolor="#86531A"> 
      <a href="../../../feedback.1"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><b>feedback</b></font></a></td>
    <td height="20" width="25%" align="center" valign="middle" bgcolor="#86531A"> 
      <a href="../../../archives/index.html"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><b>archives</b></font></a></td>
    <td height="20" width="25%" align="center" valign="middle" bgcolor="#86531A"> 
      <b><a href="../../../submissions/index.html"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif" size="2">submissions</font></a></b></td>
  </tr>
</table>
<div align="center"> <br>
</div>
<table width="100%" border="0">
  <tr> 
    <td width="72%"> 
      <h5><b><font face="Arial, Helvetica, sans-serif">//<a href="../../../index.html"><font color="#7C420E">loonygames</font></a>://<a href="../index.html"><font color="#7C420E">issue 
        2.10</font></a>://<a href="index.html"><font color="#7C420E">Game Networking 
        101</font></a>://<a href="index.php"><font color="#7C420E">1</font></a>, 
        <a href="index2.php"><font color="#7C420E">2</font></a>, <a href="index4.php"><font color="#7C420E">3</font></a>, 
        <a href="index4.php"><font color="#7C420E">4</font></a>, <a href="index5.php"><font color="#7C420E">5</font></a>, 
        <a href="index6.php"><font color="#7C420E">6</font></a>, 7, <a href="index8.php"><font color="#7C420E">8</font></a></font></b></h5>
    </td>
    <td align="right" valign="middle" width="28%"> 
      <div align="right"> 
        <h5><a href="../../cgi/printme.pl?url=%252F2.10%252Ffeat%252F"><img src="../../images/icons/print01.gif" width="27" height="27" align="baseline" border="0" alt="switch to printer-friendly version"></a></h5>
      </div>
    </td>
  </tr>
</table>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top" width="25%"> 
      <table border="0" width="99%" bgcolor="#D7B582" align="center" bordercolor="#E0E0E0">
        <tr> 
          <td align="LEFT" valign="TOP" width="100%"> <font color="#000000" face="Arial, Helvetica, sans-serif" size="2"> 
             </font> <p><webdog><font face="Arial, Helvetica, sans-serif" size="2" color="#0022A8"><b><font color="#693A0C">What's 
           new today:</font></b></font> 
          
<p><b><font face="Arial, Helvetica, sans-serif" size="2"><a href="../../../index.html" target=""><b><font color="#00025E">New!!!</font></b></a><br></b>
  The archives have been cleaned up, dead links fixed, and the printable versions restored! Also, don't miss the new comments on the main page!</font></p>

 
<p><b><font face="Arial, Helvetica, sans-serif" size="2"><a href="../../2.15/feat/index.html" target=""><b><font color="#00025E">Livin' 
  With The Sims</font></b></a><br></b>
  theAntiELVIS explores the wild and wacky world that is Will Wright's <b>The Sims</b>, 
  asking the inevitable quesiton, &quot;is <b>The Sims</b> the first step toward a virtual 
  life where everyone is Swedish?&quot;</font></p>
<p><font color="#000000" face="Arial, Helvetica, sans-serif" size="2"><a href="../../2.15/pixel/index.html" target=""><b><font color="#00025E">Pixel 
  Obscura </font></b></a></font><font face="Arial, Helvetica, sans-serif" size="2"><br>
  Josh Vasquez on <b>Omikron: The Nomad Soul</b>.</font></p>
<p><font color="#000000" face="Arial, Helvetica, sans-serif" size="2"><a href="../../rl/index.html" target=""><b><font color="#00025E">Real 
  Life </font></b></a></font><font face="Arial, Helvetica, sans-serif" size="2"><br>
  Check out our newest comic strip, <b>Real Life</b>! Updated daily!</font></p>
<p><font color="#000000" face="Arial, Helvetica, sans-serif" size="2"><a href="../../uf.1" target=""><b><font color="#00025E">User 
  Friendly</font></b></a></font><font face="Arial, Helvetica, sans-serif" size="2"><br>
  Updated daily!</font></p>
<p></webdog> </p>
 
            <p></p>
            <p> </p>
            <p></p>
             
            </td>
        </tr>
      </table>
      <br>
      <table width="100%" border="0" bgcolor="#D7B582">
        <tr bgcolor="#D7B582"> 
          <td> 
            <div align="center"> 
              <p align="left"><font size="-1"><font face="Arial, Helvetica, sans-serif" size="2" color="#0022A8"><b><font color="#00025E">Random 
                Feature:</font></b></font> </font> </p>
              <p><p align="CENTER"><img src="../../images/thumbs/pixel.jpg" width="92" height="117" align="MIDDLE" border="0"></p><p><font face="Arial, Helvetica, sans-serif" size="-1"><a href="../../2.15/pixel/index.html">Pixel Obscura</a>: Josh Vasquez's regular look at the convergence of film and videogames.</font></p>
<i><font face="Arial, Helvetica, sans-serif" size="-2"> 
                </font> </i></p>
            </div>
          </td>
        </tr>
      </table>
      <br>
      <table width="99%" border="0" bgcolor="#D7B582">
        <tr> 
          <td> 
            <div align="center"> 
              <form method="get" action="http://www.google.com/custom" name="">
                <font face="Arial, Helvetica, sans-serif" size="-1"><b><font color="#339900">Search 
                the Archives!</font></b></font> 
               
                 <INPUT TYPE=text name=q size=12 maxlength=255 value="">
 <INPUT type=submit name=sa VALUE="Google Search">
 <INPUT type=hidden name=cof 
VALUE="LW:216;L:http:/home/loonygames/loony.timedoctor.org/content/images/logo1.jpg;LH:55;AH:center;S:http://www.loonygames.com;AWFID:13a298c7abe84fd0;">
<input type=hidden name=domains value="loonygames.com"> 
<input type=hidden name=sitesearch value="loonygames.com">               
</div>
              </form>

              <p align="left"><i> </i></p>
            </div>
          </td>
        </tr>
      </table>
    </td>
    <td width="75%" align="center" valign="top"> 
      <table width="90%" border="0" cellpadding="0" align="center">
        <tr> 
          <td width="50%" valign="top"> 
            <div align="center"> 
              <table width="98%" border="0">
                <tr> 
                  <td width="55%"> 
                    <div align="left"> 
                      <p><b><font face="Arial, Helvetica, sans-serif" color="#0000FF"><i><font color="#904C10" size="3">Game 

                        Networking 101</font></i></font></b><br>
                      
                      <div align="right"> <font face="Arial, Helvetica, sans-serif" size="-1">By 
                        <a href="mailto:jsimpson@ravensoft.com">Jake Simpson</a></font></div>
                    </div>
                  </td>
                  <td width="45%" align="right" valign="top"> 
                    <h5 align="right"><b><font face="Arial, Helvetica, sans-serif" color="#00025E">Vol. 
                      2, Issue 10 <br>
                      January 31, 2000&nbsp; </font></b></h5>
                  </td>
                </tr>
              </table>
              <loonystart> 
              
              <p align="right">&nbsp;</p>
              <p align="left"> <font face="Arial, Helvetica, sans-serif">Something 
                else worth considering is reducing the complexity of floating 
                point data. Traditional floating point is 32 bits long - 4 bytes. 
                The question is, do you really need that degree of accuracy? Reducing 
                32 bits to 16 of floating point is not out of the question; many 
                games do this, but I'll bet you haven't noticed. While we are 
                on that subject, being very sure of the size of the data you need 
                to transmit is also a necessity here. If you are sending a value 
                of between 0 and 170, do you really need a long word to do it? 
                It would fit in a byte, and you've just saved 3 bytes. Obvious 
                when you think about it, but you'd be surprised at how much it 
                gets forgotten about when you are just getting the game working.</font></p>
              <p align="left"></p>
              <p align="left"><font face="Arial, Helvetica, sans-serif">Only sending 
                objects that have relevance to the scene you are displaying is 
                helpful. Remember, the client is dumb, and doesn't need to know 
                about what's out of the view or hearing threshold. Who cares? 
                They aren't being rendered or heard, so what difference does it 
                make? The server knows about them, and it's running the game, 
                not you. This sucks of course if you are out in the open, or in 
                a space sim, since everything is visible, but that's a game design 
                decision that you make based on your technical abilities.</font></p>
              <p align="left"><font face="Arial, Helvetica, sans-serif">Further 
                to that, offload special effects. Remember the client is pretty 
                dumb, but it's smart enough to do clever effects for you. There 
                is no reason for the server to be sending all the info on effects 
                to the client, wasting both server time and network space. It's 
                enough that the server says &quot;an explosion happens here&quot; 
                and the client does the rest, superimposing that effect on the 
                main display. We did this in Heretic II, which was the major reason 
                it ran so well on the lower end machines.</font></p>
              <p align="left"></p>
              <p align="left"><font face="Arial, Helvetica, sans-serif">Of course 
                the biggest thing you can do to help packet size is to delta-compress 
                info. Without giving away all of our (game developers that is, 
                not just Raven) technical secrets, the idea here is to only transmit 
                data that has changed from one frame to the next. Simply keep 
                a copy of what you sent last time, and on an object-by-object 
                basis, compare what you want to send this frame with what you 
                sent last, and only transmit that which has changed. Of course 
                this doesn't work when you have a new object to transmit, since 
                it all has to go across. But then if you figure out the percentage 
                amount of this happening, it comes out to about between 5% and 
                10% of the time. That&#146;s some savings.</font></p>
              <p align="left"></p>
              <p align="left"><font face="Arial, Helvetica, sans-serif">If you 
                want to, you can implement some compression schemes on the resulting 
                packet to make it even smaller, but in these cases the trade off 
                of time to compress on the server and decompress on the client 
                can be worse than having a slightly large packet.</font></p>
              <p align="left"></p>
              <p align="left"><font face="Arial, Helvetica, sans-serif">Frequency 
                - control over this is a must. <b>Quake</b> has a server that 
                runs at 10 frames per second, transmitting data over the net at 
                that rate. Actually, it does transmit faster than that when it's 
                doing stuff like downloading client requested files, or responding 
                to server info requests, but during game time, the client expects 
                data at a 10fps rate. It runs at 10fps a) because of the amount 
                of data it is processing for each client. And b) because this 
                is a nice easy network packet rate to sustain.</font></p>
              <p align="left"></p>
              <p align="left"><font face="Arial, Helvetica, sans-serif">There, 
                that one was easy.</font></p>
              <p align="left"></p>
              <p align="left"><font face="Arial, Helvetica, sans-serif">Out of 
                order and missing packets. The trick here is to only treat one 
                symptom and ignore the other. If you number your game packets 
                (when we talk about packets here, I mean game server frame packets 
                - IE the packet that contains a complete frame update from the 
                server) as they go out to the client, the client can know if it 
                gets an out of order packet. The simplest solution is to dump 
                it, and treat it as a missed packet entirely. Doing this is a 
                must if you are dealing with delta-ed packets, since the delta 
                values in the packet refer to the frame that came before.</font></p>
              <p align="left"></p>
              <p align="left"><font face="Arial, Helvetica, sans-serif">If you 
                keep a copy of the last packet you received from the server on 
                the client, you can compare the latest one you got to it and see 
                if an object has been dropped. At that point, you can either just 
                dump the object immediately, or store it off into a list and check 
                a few packets down to be sure it's still gone, and then dump it. 
                The beauty here is that you never actually have to send a 'remove' 
                function to the client from the server, since by omission from 
                the game packet from the server, the object is gone. Even if you 
                have some dropped packets, it doesn't matter since eventually 
                you will get one and that object will still be missing in the 
                latest packet, and thus it will get deleted. Cool eh?</font></p>
              <p align="left"></p>
              <p align="left"></p>
              <p align="left"></p>
              <p align="left"></p>
              <p align="left"></p>
              <p align="left"></p>
              <p align="left"></p>
              <p align="left"><font face="Arial, Helvetica, sans-serif"><br></loonystart> 
                </font> </p>
            </DIV>
            <div align="center">
                <p align="left"><font face="Arial, Helvetica, sans-serif"> </font><font face="Arial, Helvetica, sans-serif"> 
                  </font></p>
              </div>
              
            <table width="100%" border="0">
              <tr> 
                <td width="50%"><font face="Arial, Helvetica, sans-serif"><a href="index6.php"><font color="#7C420E"><b><font size="+1">&lt;&lt;Prev</font></b></font> 
                  </a></font></td>
                <td width="50%"> 
                  <div align="center"> 
                    <p align="left"></p>
                    <p align="left"></p>
                  </div>
                  <p align="right"><font face="Arial, Helvetica, sans-serif"><a href="index8.php"><font color="#7C420E"><b><font size="+1">Next 
                    &gt;&gt;</font></b></font> </a></font> 
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<br>
<table width="100%" border="0" bgcolor="#3596B3" height="29">
  <tr> 
    <td height="20" width="25%" align="center" valign="middle" bgcolor="#86531A"> 
      <a href="../../../about.1"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><b>about</b></font></a></td>
    <td height="20" width="25%" align="center" valign="middle" bgcolor="#86531A"> 
      <a href="../../../feedback.1"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><b>feedback</b></font></a></td>
    <td height="20" width="25%" align="center" valign="middle" bgcolor="#86531A"> 
      <a href="../../../archives/index.html"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><b>archives</b></font></a></td>
    <td height="20" width="25%" align="center" valign="middle" bgcolor="#86531A"> 
      <b><a href="../../../submissions/index.html"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif" size="2">submissions</font></a></b></td>
  </tr>
</table>
<table width="100%" border="0" bgcolor="#3596B3" height="29">
  <tr> 
    <td height="20" width="35%"><a href="../../../index.html"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF"><b><i>loonygames</i></b></font></a></td>
    <td height="20" width="65%"> 
      <div align="right"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF">  </font></div>
    </td>
  </tr>
</table>
<p><i><font face="Arial, Helvetica, sans-serif" size="-2">Credits: Illustration 
  &copy; 2000 Costas (<a href="http://www.freespeech.org/darkpathimages/dpathmain.htm">Darkpath 
  Images</a>) and Andy, This article is &copy; 2000 Jake Simpson. All other content 
  is &copy; 2000 loonyboi productions. Unauthorized reproduction is prohibited. 
  So don't do it, or we'll give you really, really, bad lag.</font></i></p>
 <map name="logoa">
  <area shape="rect" coords="52,47,112,59" href="http://www.bluesnews.com">
  <area shape="rect" coords="3,3,179,46" href="../../../index.html">
</map>
</body>
</html>
