doc/kishna.tex
author terom
Mon, 08 Dec 2008 18:12:43 +0000
changeset 300 417183866f35
parent 293 d40fbf8ba13b
child 301 02ad02d28245
permissions -rw-r--r--
suicide key and respawning
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     1
\documentclass[a4papre,12pt]{article}
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}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     5
\usepackage{listings} % For listing code
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     6
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     7
% Fancy headers
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     8
\usepackage{fancyhdr}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
     9
\fancypagestyle{plain} {
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    10
    \fancyhf{}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    11
    \renewcommand{\headrulewidth}{0.4pt}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    12
    \lhead{\textbf{Group 66}}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    13
    \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
    14
    \rhead{\textsl{AS-0.1102}}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    15
    \cfoot{\thepage}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    16
}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    17
\pagestyle{plain}
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
% Paragraph formatting
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    20
\frenchspacing
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    21
\setlength{\parindent}{0pt} 
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    22
\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
    23
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    24
% Title information
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    25
\title{Kishna Glista - Liero Clone}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    26
\author{\normalsize{\begin{tabular}{lll}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    27
Atle Kivelä & 79171V & atle.kivela@tkk.fi \\
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    28
Eric Malmi & 80351A & eric.malmi@tkk.fi \\
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    29
Tero Marttila & & \\
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    30
Marko Rasa & & \\
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    31
\end{tabular}}}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    32
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    33
% The document begins
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    34
\begin{document}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    35
\maketitle
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    36
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    37
\section{Instructions for compiling and use}
293
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    38
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    39
You can compile the program by going trough the following procedure:
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    40
\begin{itemize}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    41
\item \textsl{cd build}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    42
\item \textsl{./mkcmake.sh}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    43
\item \textsl{make install}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    44
\end{itemize}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    45
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    46
\subsection{Basic usage}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    47
Starting. Default Keys. Starting the server. Connecting. etc.
293
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    48
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    49
Controls are currently liero default controls.
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    50
\begin{center}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    51
\begin{tabular}{l|l}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    52
\textbf{Action} & \textbf{Default key(s)} \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    53
\hline
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    54
Move left & Arrow left \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    55
Move right & Arrow right \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    56
Aim up & Arrow up \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    57
Aim down & Arror down \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    58
Shoot & Right CTRL \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    59
Jump & Right shift \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    60
Change weapon & Enter \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    61
Shoot rope & Change weapon + jump \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    62
Change rope length & Change weapon + aim up/down \\
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    63
\end{tabular}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    64
\end{center}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    65
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    66
\subsubsection*{Starting the game}
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    67
Somekind of intstuctions on starting the server, connecting etc...
d40fbf8ba13b Added some text to documentation.
saiam
parents: 278
diff changeset
    68
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    69
\subsection{Configuration}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    70
How to make configuration changes.
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    71
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    72
\section{Program architecture}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    73
A brief description of the program architecture.
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    74
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    75
\begin{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    76
\item Network
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    77
\item Graphics
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    78
\item Input etc.
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    79
\item Physics
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    80
\end{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    81
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    82
\section{Data structures and algorithms}
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    83
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    84
\subsection{Basic data structures}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    85
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    86
\begin{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    87
\item Vector
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    88
\item List
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    89
\end{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    90
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    91
\subsection{World and Objects}
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    92
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    93
Usually, in side view 2D-games, the terrain is representated as a
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    94
polygon. This allows us to implement collision detection and bouncing
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    95
rather easily, and it is also a very compact way of storing the
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    96
map. In our opinion Liero, however, is fundamentally a pixel based
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    97
game and therefore we represent the terrain as a large array of
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    98
pixels. These pixels are, however, abstract pixels, i.e. they are not
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    99
necessarily in the same scale than the physical resolution. In other
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   100
words, the server has an abstract resolution, which is the same for
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   101
all clients, and the clients can visualize this abstract array of
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   102
pixels in any resolution they wish.
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   103
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   104
On top of the terrain, the world also includes a list of all objects
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   105
in it (players, projectiles and ropes). The objects have a polygon
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   106
shape which is used in the collision detection between the objects and
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   107
the terrain and the objects with each other.
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   108
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   109
\subsection{Collision Detection}
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   110
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   111
\begin{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   112
\item Polygon collision detection
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   113
\item Pixel collision detection
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   114
\end{itemize}
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   115
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   116
Collision detection takes care of the objects not moving inside the
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   117
terrain nor inside each other. These two types of collision are
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   118
different since the data structures are not the same. In the
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   119
terrain-object collision the collision part is rather easy. When a
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   120
object is about to move point A to point B we draw a line between
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   121
those points. Then we iterate over that line and check that none of
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   122
the vertices of the object's shape are inside the terrain. However, we
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   123
have to be able to bounce the object from the terrain and in order to
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   124
do that, a normal for the collision point needs to be calculated. For
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   125
a polygon this would easy, but for a discrete array of pixels it's
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   126
little bit different.
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   127
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   128
We come up with the following algorithm for calculating an
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   129
approximation for the normal. Take the collision point and the point
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   130
before the collision and consider a 3x3 array of pixels which has the
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   131
collision point in the middle of it. Then, do sort of an bredth-first
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   132
search from the previous point to get all the empty pixels. Take the
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   133
vectors from the collision point to the empty point and sum these
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   134
vectors. The resulting vector will point approximately along the
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   135
normal. Picture explains this a lot.
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   136
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   137
\subsection{Physics}
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   138
runge kutta, something network related?
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   139
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   140
\section{Known bugs}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   141
A lots of them (or maybe not).
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   142
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   143
\section{Tasks sharing and schedule}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   144
Hectic ass hell. Communication worked pretty well but we weren't as systematic
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   145
as we should have been.
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   146
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   147
\section{Differences to the original plan}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   148
The plan was loose enough to let us make decisions during development. 
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   149
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   150
% References
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   151
\begin{thebibliography}{99}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   152
\bibitem{foo} Foo reference
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   153
\end{thebibliography}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   154
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   155
\end{document}