Update of /cvsroot/moeng/Mamura/doc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8191
Added Files:
network.tex
Log Message:
Added initial network document draft.
--- NEW FILE: network.tex ---
\documentclass[10pt,english]{report}
\usepackage{graphics, bookman, geometry, verbatim, babel}
\geometry{a4paper}
\setlength \parskip{\bigskipamount}
\setlength \parindent{0pt}
\begin{document}
\title{The Network Model}
\author{Bj\o rn Lindeijer}
\maketitle
\tableofcontents
\chapter{Introduction}
\section{Problem Analysis}
The goal of the network model is to allow for a large number of
clients to be kept in sync with the server without using much
bandwidth. A second goal is to achieve playability with high (say
300ms) lag.
The bulk of the game will be scripted, with the engine only handling
the low level rendering tasks and resource management. We'll have to
decide if the engine will handle the networking aspect for the
scripts, or if the networking aspect is an integral part of the
scripts. I think the latter will be easier.
Three ways of reducing data transfer seem most effictive. First, use
small data primitives where possible. Second, send data from which a
lot of other things can be derived\footnote{Here I'm thinking about
sending destination instead of current position, for example.}. And
lastly, send only relevant data to the clients\footnote{Sending only
data about objects the client can see is both in the interest of
bandwidth and security, in that you can't modify the client to be
able to see more than others.}.
\section{Ruby}
Ruby\footnote{http://www.ruby-lang.org/} is currently the language of
choice. There is an extention module, Distributed
Ruby\footnote{http://www2a.biglobe.ne.jp/~seki/ruby/druby.en.html}
available to allow transparent remote method invocation similar to
Java RMI. This might be interesting to use.
Druby cannot be used for updating all the objects for each
client. Only a few direct functions calls can be issued each second,
and this will quickly become too few when more clients start
connecting. This is why next to this there needs to be another way in
which most of the objects will be kept up to date on the clients.
\section{Variable Synchronization}
ClanLib\footnote{http://www.clanlib.org/} has helper classes for
synchronizing objects on the client and server. These could form a
good base for object creation and removal and variable
synchronization.
\section{Some example code}
I haven't written any Ruby code yet, so this is pseudo code for
now. It should get the idea across.
Below is a fracment based on a bit of UnrealScript. It is just I don't
know if this is at all a convenient and efficient way to go about
things.
\begin{verbatim}
class Pawn
{
function ChangeWeapon(weapon)
function ServerChangeWeapon(weapon)
function Move(destination)
function ServerMove(destination)
var destX, destY;
var weapon;
client_to_server(:ServerChangeWeapon, :ServerMove)
server_to_client(:destX, :destY, :weapon)
}
\end{verbatim}
\chapter{Server in detail}
\chapter{Client in detail}
\end{document}
|