doc/kishna.tex
author ekku
Tue, 09 Dec 2008 04:22:30 +0000
changeset 361 1b87b1e0ae1d
parent 357 317fdf38790a
child 362 6c7b4deefdfb
permissions -rw-r--r--
network move
333
50ec1ab32d2d Minor fixes to documentation
saiam
parents: 331
diff changeset
     1
\documentclass[a4paper,12pt]{article}
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     2
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     3
\usepackage[utf8]{inputenc}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     4
\usepackage[english]{babel}
331
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
     5
\usepackage{amsmath}
349
ad6759185781 Collision and normal writing
ekku
parents: 348
diff changeset
     6
\usepackage[pdftex]{graphicx}
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     7
\usepackage{listings} % For listing code
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     8
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     9
% Fancy headers
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    10
\usepackage{fancyhdr}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    11
\fancypagestyle{plain} {
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    12
    \fancyhf{}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    13
    \renewcommand{\headrulewidth}{0.4pt}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    14
    \lhead{\textbf{Group 66}}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    15
    \chead{\textbf{Kishna Glista - liero clone}}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    16
    \rhead{\textsl{AS-0.1102}}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    17
    \cfoot{\thepage}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    18
}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    19
\pagestyle{plain}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    20
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    21
% Paragraph formatting
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    22
\frenchspacing
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    23
\setlength{\parindent}{0pt} 
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    24
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    25
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    26
% Title information
356
723ffc669c49 Titlepage and toc to documentation
saiam
parents: 355
diff changeset
    27
\title{Kishna Glista - Liero Clone\\Project Documentation}
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    28
\author{\normalsize{\begin{tabular}{lll}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    29
Atle Kivelä & 79171V & atle.kivela@tkk.fi \\
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    30
Eric Malmi & 80351A & eric.malmi@tkk.fi \\
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    31
Tero Marttila & 79849E & tjmartti@cc.hut.fi \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    32
Marko Rasa & 78726L & morasa@cc.hut.fi \\
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    33
\end{tabular}}}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    34
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    35
% The document begins
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    36
\begin{document}
356
723ffc669c49 Titlepage and toc to documentation
saiam
parents: 355
diff changeset
    37
\begin{titlepage}
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    38
\maketitle
356
723ffc669c49 Titlepage and toc to documentation
saiam
parents: 355
diff changeset
    39
\thispagestyle{empty}
723ffc669c49 Titlepage and toc to documentation
saiam
parents: 355
diff changeset
    40
\end{titlepage}
723ffc669c49 Titlepage and toc to documentation
saiam
parents: 355
diff changeset
    41
723ffc669c49 Titlepage and toc to documentation
saiam
parents: 355
diff changeset
    42
\tableofcontents
723ffc669c49 Titlepage and toc to documentation
saiam
parents: 355
diff changeset
    43
\newpage
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    44
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    45
\section{Instructions for compiling and use}
293
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    46
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    47
\subsection{Configuring CMake}
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    48
You must first generate the project's CMake configuration inside of \textsl{build}. A simple script is provided to do
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    49
so with some default settings. It will configure the install path as \textsl{~/opt}.
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    50
293
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    51
\begin{itemize}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    52
\item \textsl{cd build}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    53
\item \textsl{./mkcmake.sh}
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    54
\end{itemize}
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    55
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    56
\subsection{Compiling and Installing}
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    57
Once you have the CMake scripts in place, compiling should be as simple as running make:
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    58
\begin{itemize}
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    59
\item \textsl{make}
293
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    60
\item \textsl{make install}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    61
\end{itemize}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    62
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    63
This will build the binary, and then copy the binary and data files to the install path configured above.
293
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    64
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    65
\subsection{Command-line Arguments}
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    66
Running the game is done using command-line arguments to the executable
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    67
\begin{center}
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    68
\begin{tabular}{l|l|l|l|l}
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    69
\textbf{Short} & \textbf{Long} & \textbf{Value} & \textbf{Description} & \textbf{Default} \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    70
\hline
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    71
-p & \verb|--port| & PORT & Set server TCP/UDP port & 9338 \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    72
-s & \verb|--server| &  & Run as a network server & false \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    73
-c & \verb|--client| & SERVERHOST & Run as a network client on given server & false \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    74
-g & \verb|--graphics| & & Enable graphics rendering & * \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    75
\end{tabular}
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    76
\end{center}
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    77
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    78
* = true, except false when --server is given
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    79
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    80
The options \verb|--server| and \verb|--client| are mutually exclusive, and both cannot be selected at the same time.
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    81
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    82
\subsection{Keyboard Controls}
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    83
The default controls are identical to the origional Liero default controls, with some additions.
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    84
293
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    85
\begin{center}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    86
\begin{tabular}{l|l}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    87
\textbf{Action} & \textbf{Default key(s)} \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    88
\hline
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    89
Move Left & Arrow Left \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    90
Move Right & Arrow Right \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    91
Aim Up & Arrow Up \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    92
Aim Down & Arror Down \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    93
Dig & Move Left + Move Right \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    94
Shoot & Right Control \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    95
Jump & Right Shift \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    96
Change Weapon & Enter + Arrow Left / Arrow Right \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    97
Throw Rope & Change Weapon + Jump \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    98
Release Rope & Jump \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
    99
Change Rope Length & Change Weapon + Aim Up / Aim Down \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
   100
Suicide & Left Control + K \\
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
   101
Exit Game & Esc \\
293
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
   102
\end{tabular}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
   103
\end{center}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
   104
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
   105
\subsection{Running the game}
347
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   106
To simple start a local singleplayer game, just run \verb|kg| without any arguments.
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
   107
347
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   108
To start a network server on the default port, run \verb|kg --server|
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   109
(\verb|kg -s|). You may optionally also specify the \verb|--graphics|
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   110
argument to have the server passively draw the graphics.
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
   111
347
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   112
To start a network client, connecting to a server running on the
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   113
default port, run \verb|kg --client=ADDRESS| (\verb|kg -c <address>|).
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
   114
347
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   115
To use a non-default port, simply specify \verb|--port=PORT|
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   116
(\verb|-p <port>|) on both client and server.
293
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
   117
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   118
\subsection{Configuration}
347
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   119
All global game constants are defined in \textit{src/Config.hh}, and may be
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   120
experimented with. Weapon parameters are defined in \textit{src/Weapons.cc}.
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   121
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   122
\section{Program architecture}
348
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   123
The program consists of four main parts: Graphics\&Input, GameState,
352
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   124
Network and Physics. Each part contains various classes; the relations
348
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   125
show up in the doxygen generated documentation of the program.
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
   126
352
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   127
The program starts from the Application class, which then starts the Engine,
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   128
which creates GameState, Graphics and the Network Client/Server. Physics
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   129
simulation is started when GameState is created.
347
94fbc2bd6641 Minor fixes to documentation.
saiam
parents: 345
diff changeset
   130
348
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   131
GameState contains PhysicsWorld which inherits from Terrain and
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   132
contains a list of PhysicsObjects. GameState also contains Player and
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   133
Projectile objects which inherit from PhysicsObject (and are contained
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   134
in PhysicsWorld).
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
   135
348
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   136
Player objects have a list of Weapon objects which they can use to
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   137
create Projectiles. Every Player also has a Rope object, which is a
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   138
separate PhysicsObject, and is either folded away, being thrown or
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   139
attached to the terrain.
344
a1ac08c37f0f reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
terom
parents: 340
diff changeset
   140
352
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   141
Graphics and Input are handled in their own classes. Graphics has an
348
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   142
Input object which contains InputHandler objects for various classes
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   143
of input. One such object is PlayerInput which affects the GameState's
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   144
LocalPlayer. Other object is GuiInput which just modifies what the GUI
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   145
look like on the client side.
3ebcccc7ee44 Simplified the architecture description a bit
saiam
parents: 347
diff changeset
   146
350
4f90d2c2d221 Removed Network stuff from architecture part of documentation
saiam
parents: 349
diff changeset
   147
The network code is a bit complicated and has several layers. There
4f90d2c2d221 Removed Network stuff from architecture part of documentation
saiam
parents: 349
diff changeset
   148
are some nice diagrams about the program structure in the doxygen
4f90d2c2d221 Removed Network stuff from architecture part of documentation
saiam
parents: 349
diff changeset
   149
documentation.
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   150
361
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   151
\subsection{Network}
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   152
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   153
The network code is implemented as separate NetworkServer and NetworkClient modules, which use a common high-level
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   154
network interface, NetworkSession and NetworkObject.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   155
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   156
The low-level details are implemented using ClanLib's CL\_IPAddress (referred to as NetworkAddress) and CL\_Socket.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   157
NetworkUDP provides an interface to send and receive NetworkPackets to/from specific NetworkAddress's across a 
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   158
NetworkSocket. NetworkTCP provides a NetworkTCPTransport interface, which can send/receive NetworkPackets on a
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   159
NetworkSocket (using NetworkBuffer to buffer socket I/O). NetworkTCPServer is a listen() socket which accepts client
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   160
connections as NetworkTCPTransports, and NetworkTCPClient is a NetworkTCPTransport that's connect()'d to some address.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   161
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   162
NetworkSession encapsulates some simple application server/client behaviour, it can function as both a server, and
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   163
represents remote NetworkSessions (either clients or servers) as NetworkNode objects. These then provide an interface
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   164
to send and receive NetworkPackets on specific NetworkChannelDs, using either TCP or UDP as a reliable/unreliable
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   165
transport.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   166
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   167
NetworkObject then implements a kind of object-oriented network protocol. A NetworkObjectController (with specific
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   168
subclasses for server/client behaviour) uses a NetworkSession to send messages on a specific NetworkChannelID. This
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   169
controller then creates and looks up NetworkObjects (again, with specific subclasses for server/client behaviour).
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   170
Clients and servers can then communicate by having the server construct new NetworkObjects (which are allocated an
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   171
unique id), and then sending NetworkPackets with a specific NetworkMessageID type on a specific object. The message is
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   172
then delivered directly to the NetworkObject instance on the remote end of the connection, or a new NetworkObject is
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   173
constructed using the data in the NetworkPacket. This enables an easy way to send events for specific objects, and
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   174
referr to other objects in these messages.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   175
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   176
NetworkServer then implements a core NetworkServer class which has a NetworkSession and a
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   177
NetworkObject\_ServerController. Players that connect are represented as NetworkServerPlayers, which inherit from
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   178
LocalPlayer and NetworkObject\_Server. This class then overrides methods in Player to deliver messages on the Player
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   179
object to the clients, or to create new NetworkServerProjectiles. NetworkServerProjectile inherits from Projectile and
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   180
NetworkObject\_Server, and sends messages when constructed, upon hitting a player, and upon being destroyed.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   181
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   182
NetworkClient is a bit more complicated as it must handle both the LocalPlayer, and a number of RemotePlayers. Again,
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   183
NetworkClient has a NetworkSession and a specialized NetworkClientController, which then creates objects of various
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   184
other NetworkClientClasses upon receiving messages from the server.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   185
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   186
Two of these classes are NetworkClientLocalPlayer and NetworkClientRemotePlayer. Both inherit from
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   187
NetworkClientPlayerBase, which inherits Player (virtually) and NetworkObject\_Client. NetworkClientLocalPlayer and
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   188
NetworkClientRemotePlayer then also inherit LocalPlayer and Remote player virtually, respectively.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   189
NetworkClientPlayerBase contains the common methods that update the Player's state in response to messages received
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   190
from the server. NetworkClientLocalPlayer overrides handleInput to send the input mask to the server, and
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   191
NetworkClientRemotePlayer can handle remote clients disconnecting from the server.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   192
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   193
In addition, there is a NetworkClientProjectile class, which inherits from Projectile and NetworkObject\_Client.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   194
this is created when a Player fires a Weapon on the server, and handles events received from the server like the
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   195
projectile hitting a player (inflicting damage), or being destroyed (by hitting the terrain or something similar).
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   196
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   197
When the player first connects to the server, the server sends a large packet containing the terrain array to the
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   198
client, which updates its own GameState world's terrain array with the received data.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   199
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   200
Currently, the client only sends handleInput using unreliable UDP messages, and the server only sends position updates
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   201
(as sent in response to handleInput events) unreliably. All other events are sent using reliable TCP.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   202
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   203
\section{Data structures and algorithms}
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   204
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   205
\subsection{Basic data structures}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   206
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   207
\begin{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   208
\item Vector
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   209
\item List
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   210
\end{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   211
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   212
\subsection{World and Objects}
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   213
301
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   214
% COMMENT: I think these should be in a very basic level and they
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   215
% shouldn't discuss too much about the game itself. The idea is just
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   216
% to explain different kinds of structures and algorithms.
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   217
301
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   218
% Terrain
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   219
The terrain is an important part of our game. We represent our terrain
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   220
as a large array. Each shell of the array has a type that tells what
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   221
is in that position. Currently, possible terrain types are EMPTY, DIRT
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   222
and ROCK. 
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   223
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   224
% Usually, in side view 2D-games, the terrain is representated as a
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   225
% polygon. This allows us to implement collision detection and
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   226
% bouncing rather easily, and it is also a very compact way of storing
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   227
% the map. In our opinion Liero, however, is fundamentally a pixel
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   228
% based game and therefore we represent the terrain as a large array
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   229
% of pixels. These pixels are, however, abstract pixels, i.e. they are
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   230
% not necessarily in the same scale than the physical resolution. In
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   231
% other words, the server has an abstract resolution, which is the
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   232
% same for all clients, and the clients can visualize this abstract
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   233
% array of pixels in any resolution they wish.
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   234
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   235
% Objects
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   236
In our physics simulation the shapes of the different elements in the
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   237
game are represented as polygons. A polygon is a vector of points that
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   238
define the edges of the shape.
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   239
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   240
% On top of the terrain, the world also includes a list of all objects
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   241
% in it (players, projectiles and ropes). The objects have a polygon
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   242
% shape which is used in the collision detection between the objects
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   243
% and the terrain and the objects with each other.
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   244
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   245
\subsection{Collision Detection}
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   246
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   247
\begin{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   248
\item Polygon collision detection
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   249
\item Pixel collision detection
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   250
\end{itemize}
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   251
301
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   252
Collision detection algorithms check if objects in the physics
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   253
simulation are colliding with eachother. Because our terrain is
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   254
represented as an array and objects are represented as polygons we
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   255
have two different kinds collision detection algorithms.
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   256
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   257
The pixel based collision detection used to check collisions with the
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   258
terrain is quite simple. It ``draws'' a line between two points A and
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   259
B. The algorithm iterates over the line from point A to B and on each
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   260
iteration it checks if theres a collision (i.e. the type of the
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   261
current point is ROCK or DIRT).
02ad02d28245 Some documentation
saiam
parents: 293
diff changeset
   262
357
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   263
In order to implement the bouncing from the terrain we have to be able
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   264
to calculate a normal for the slope of the terrain in the collision
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   265
point. We came up with the following algorithm which gives us an
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   266
approximation of the normal
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   267
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   268
\begin{enumerate}
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   269
 \item Take the collision point ($p_1$) and the point
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   270
before the collision ($p_2$) and consider a 3x3 array of pixels which has the
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   271
collision point in the middle of it.
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   272
 \item Find the empty points that are connected to $p_2$ with bredth-first search algorithm
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   273
or something similar.
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   274
 \item Calculate the vectors pointing from the collision point to the empty points. Sum of these vectors gives us the approximation of the normal.
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   275
\end{enumerate}
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   276
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   277
Picture \ref{algo} explains the algorithm a lot. In the middle of the pictured we have zoomed to the collision point. The red arrow is the sum of the black arrows and thus it is our approximation for the normal.
349
ad6759185781 Collision and normal writing
ekku
parents: 348
diff changeset
   278
ad6759185781 Collision and normal writing
ekku
parents: 348
diff changeset
   279
\begin{figure}[!ht]
357
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   280
 \centering \includegraphics[width=0.7\textwidth]{normaali_algo.png}
349
ad6759185781 Collision and normal writing
ekku
parents: 348
diff changeset
   281
 \caption{Visualizing the algorithm for approximating the normal. \label{algo}}
ad6759185781 Collision and normal writing
ekku
parents: 348
diff changeset
   282
\end{figure}
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   283
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   284
\subsection{Physics}
310
7e0cfc5f0944 Wrote something to documentation
saiam
parents: 301
diff changeset
   285
7e0cfc5f0944 Wrote something to documentation
saiam
parents: 301
diff changeset
   286
The fourth-order Runge-Kutta method is a numerical method for
7e0cfc5f0944 Wrote something to documentation
saiam
parents: 301
diff changeset
   287
approximating the solution of an ordinary differential equation. In
7e0cfc5f0944 Wrote something to documentation
saiam
parents: 301
diff changeset
   288
our game the Runge-Kutta method is used to calculate positions and
7e0cfc5f0944 Wrote something to documentation
saiam
parents: 301
diff changeset
   289
velocities of physics objects when we apply forces to them.
7e0cfc5f0944 Wrote something to documentation
saiam
parents: 301
diff changeset
   290
331
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   291
The mathematical formulation of the Runge-Kutta method:
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   292
If we have an initial value problem of the form
333
50ec1ab32d2d Minor fixes to documentation
saiam
parents: 331
diff changeset
   293
\begin{equation*}
331
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   294
y' = f(t, y), \quad y(t_0) = y_0.
333
50ec1ab32d2d Minor fixes to documentation
saiam
parents: 331
diff changeset
   295
\end{equation*}
331
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   296
The we can describe the RK4 method for this problem by equations
333
50ec1ab32d2d Minor fixes to documentation
saiam
parents: 331
diff changeset
   297
\begin{align*}
331
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   298
y_{n+1} &= y_n + \tfrac{1}{6}h\left(k_1 + 2k_2 + 2k_3 + k_4 \right) \\
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   299
t_{n+1} &= t_n + h \\
333
50ec1ab32d2d Minor fixes to documentation
saiam
parents: 331
diff changeset
   300
\end{align*}
331
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   301
where $y_{n+1}$ is the RK4 approximation of $y(t_{n+1})$, and
333
50ec1ab32d2d Minor fixes to documentation
saiam
parents: 331
diff changeset
   302
\begin{align*}
331
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   303
k_1 &= f(t_n, y_n) \\
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   304
k_2 &= f(t_n + \tfrac{1}{2}h, y_n + \tfrac{1}{2}h k_1) \\
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   305
k_3 &= f(t_n + \tfrac{1}{2}h, y_n + \tfrac{1}{2}h k_2) \\
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   306
k_4 &= f(t_n + h, y_n + h k_3) \\
333
50ec1ab32d2d Minor fixes to documentation
saiam
parents: 331
diff changeset
   307
\end{align*}
331
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   308
The next value $(y_n+1)$ is determined by the present value $(y_n)$,
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   309
the product of the interval $(h)$ and an estimated slope that is
65e104a2db8f Added rungen kutta to documentation
saiam
parents: 324
diff changeset
   310
defined as $\frac{1}{6}h\left(k_1+2k_2+2k_3+k_4\right)$.
310
7e0cfc5f0944 Wrote something to documentation
saiam
parents: 301
diff changeset
   311
357
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   312
\subsection{Texture generation}
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   313
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   314
In texture generation we use random fractal terrain generation algorithm \cite{fractal}.
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   315
In one dimension algorithm starts with one straight line. Then it affects to that
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   316
line's midpoint with some random multiplied with H-value. After those first steps
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   317
it simply calls itself to both parts of line changing H-value smaller.
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   318
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   319
We use the two dimensional version of the algorithm. It needs step for point's between
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   320
last density and step diagonal to last density's points -- otherwise it is quite similar
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   321
to the one dimensional version. We decide to implement the algorithm as iterative instead of recursion.
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   322
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   323
% TODO: something network related?
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   324
352
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   325
\subsection{Input}
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   326
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   327
All input is represented as a bitmask, composed of bits from \textsl{enum PlayerInputBits}. Additionally, the Graphics
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   328
code uses some local-only flags defined in \textsl{enum GuiInputBits}. These bitmasks are built using the
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   329
\textsl{InputHandler} class, which is defined as a generic template. On every update, it goes through its keymap,
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   330
which is defined as an array of InputKeymapEntry structs. These contain the input bit, flags, and up to two keycodes.
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   331
The InputHandler then reads keycodes from the keyboard and sets bits in the current input mask based on the entry
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   332
keycodes (which may be negative to indicate the the specified key must NOT be pressed down) and any key-repetition
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   333
rules defined by flags.
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   334
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   335
Key repetition is implemented using InputKeyRepeatQueue, which contains a list of InputKeyRepeatEntry's. To rate-limit
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   336
keypresses, the input code is push()'d to the queue, and it eventually removed from the queue once it expires, or
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   337
the key is released.
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   338
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   339
The Graphics code then reads the input mask from time to time, resetting the InputHandler's mask to zero, and passes 
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   340
it on to LocalPlayer, which then either handles it locally, or sends it to the remote server.
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   341
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   342
Since some inputs like walking, aiming and moving up and down the rope are time-dependant, the InputHandler also tracks
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   343
how many milliseconds the input mask has been held, and this time delta is applied by LocalPlayer.
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   344
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   345
\section{Known bugs}
340
7cbd6395038f Something to the doc.
saiam
parents: 333
diff changeset
   346
\begin{enumerate}
7cbd6395038f Something to the doc.
saiam
parents: 333
diff changeset
   347
\item If player dies while rope is attached the rope will still be
352
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   348
    attached when the player spawns.
345
bea1c1513692 1 bug documented
nireco
parents: 344
diff changeset
   349
\item If rope is thrown without releasing it first, rope will pull worm
355
0fafdf0029c0 misc. touching up of doc and NetworkServer comments...
terom
parents: 352
diff changeset
   350
    while in mid-air
357
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   351
\item Collisions with the terrain are only tested for the vertices
317fdf38790a Some stuff
ekku
parents: 356
diff changeset
   352
    of the polygon. It is thus possible for the player to move through some pixels.
352
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   353
\item Existing Player ropes and Projectiles are not sent to the client when it connects, which can cause apparent
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   354
    glitches in what the terrain looks like and how players move.
340
7cbd6395038f Something to the doc.
saiam
parents: 333
diff changeset
   355
\end{enumerate}
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   356
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   357
\section{Tasks sharing and schedule}
352
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   358
We could have followed the schedule a lot better. We basically forgot the whole
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   359
schedule and had a lapse in activity during the middle weeks, which caused us
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   360
to be delayed in terms of the schedule. The positive side was that we almost
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   361
always had all the team members working on their own things in parralel and
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   362
communicating together; either at Maari or using our IRC channel.
340
7cbd6395038f Something to the doc.
saiam
parents: 333
diff changeset
   363
7cbd6395038f Something to the doc.
saiam
parents: 333
diff changeset
   364
Tasks sharing worked pretty much as planned. Tero did all the network
352
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   365
code and worked on keeping the rest of the code network-safe. Most of our
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   366
eye-candy (like terrain textures) was done by Marko, who was responsible for
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   367
the graphics. Marko, Eric and Atle worked on everything Physics related plus
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   368
the GameState/Player/Rope/etc code. Most of the time all team members were
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   369
working together, so the code was written using common agreement.
340
7cbd6395038f Something to the doc.
saiam
parents: 333
diff changeset
   370
352
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   371
We feel that the workload was shared reasonably evenly. % Or does someone disagree with this?
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   372
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   373
\section{Differences to the original plan}
340
7cbd6395038f Something to the doc.
saiam
parents: 333
diff changeset
   374
The original plan was quite loose and it let us make decisions during
352
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   375
development, which was a good thing. The basic structure of the program is
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   376
pretty much as the one we thought about while planning, although the Network
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   377
code ended up being a fair bit more simple-minded due to lack of time to
bbc30317fa6a tweaking documentation text, and added Input+Network subsections under arch... again, perhaps too verbose?
terom
parents: 350
diff changeset
   378
implement more UDP-based behaviour.
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   379
361
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   380
Currently, the program lacks an AI which was in the original plan and most of the optional features were also omitted. Liero clone proved to be, however, a very interesting software project and we are hoping to release Kishna Glista 2.0 one day.
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   381
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   382
% References
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   383
\begin{thebibliography}{99}
361
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   384
\bibitem{gaffer} Gaffer on games. Game Physics. 2006. \\
1b87b1e0ae1d network move
ekku
parents: 357
diff changeset
   385
 http://gafferongames.wordpress.com/game-physics/ (read: 2008-12-08)
323
a17043af6995 Moved one link from source to documentation.
saiam
parents: 310
diff changeset
   386
\bibitem{fractal} Terrain texture generation.  http://www.gameprogrammer.com/fractal.html
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   387
\end{thebibliography}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   388
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   389
\end{document}