doc/kishna.tex
author saiam
Mon, 08 Dec 2008 01:31:09 +0000
changeset 278 2b856bc88e6d
parent 269 9024e805b4e2
child 293 d40fbf8ba13b
permissions -rw-r--r--
Added random stuff to documentation. Time to go to sleep.
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}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    38
These should be pretty straightforward.
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    39
\subsection{Basic usage}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    40
Starting. Default Keys. Starting the server. Connecting. etc.
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    41
\subsection{Configuration}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    42
How to make configuration changes.
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    43
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    44
\section{Program architecture}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    45
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
    46
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    47
\begin{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    48
\item Network
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    49
\item Graphics
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    50
\item Input etc.
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    51
\item Physics
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    52
\end{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    53
238
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
    54
\section{Data structures and algorithms}
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    55
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    56
\subsection{Basic data structures}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    57
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    58
\begin{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    59
\item Vector
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    60
\item List
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    61
\end{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    62
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    63
\subsection{World and Objects}
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    64
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    65
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
    66
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
    67
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
    68
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
    69
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
    70
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
    71
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
    72
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
    73
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
    74
pixels in any resolution they wish.
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    75
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    76
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
    77
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
    78
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
    79
the terrain and the objects with each other.
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    80
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    81
\subsection{Collision Detection}
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    82
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    83
\begin{itemize}
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    84
\item Polygon collision detection
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    85
\item Pixel collision detection
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    86
\end{itemize}
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
    87
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    88
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
    89
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
    90
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
    91
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
    92
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
    93
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
    94
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
    95
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
    96
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
    97
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
    98
little bit different.
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
    99
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   100
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
   101
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
   102
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
   103
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
   104
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
   105
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
   106
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
   107
normal. Picture explains this a lot.
269
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   108
9024e805b4e2 Some algorithms.
ekku
parents: 238
diff changeset
   109
\subsection{Physics}
278
2b856bc88e6d Added random stuff to documentation. Time to go to sleep.
saiam
parents: 269
diff changeset
   110
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
   111
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   112
\section{Known bugs}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   113
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
   114
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   115
\section{Tasks sharing and schedule}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   116
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
   117
as we should have been.
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   118
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   119
\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
   120
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
   121
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   122
% References
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   123
\begin{thebibliography}{99}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   124
\bibitem{foo} Foo reference
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   125
\end{thebibliography}
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   126
15193c2bbe2f Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff changeset
   127
\end{document}