author | saiam |
Mon, 08 Dec 2008 23:49:48 +0000 | |
changeset 333 | 50ec1ab32d2d |
parent 331 | 65e104a2db8f |
child 340 | 7cbd6395038f |
permissions | -rw-r--r-- |
333 | 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 | 5 |
\usepackage{amsmath} |
238
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
6 |
\usepackage{listings} % For listing code |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
7 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
8 |
% Fancy headers |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
9 |
\usepackage{fancyhdr} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
10 |
\fancypagestyle{plain} { |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
11 |
\fancyhf{} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
12 |
\renewcommand{\headrulewidth}{0.4pt} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
13 |
\lhead{\textbf{Group 66}} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
14 |
\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
|
15 |
\rhead{\textsl{AS-0.1102}} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
16 |
\cfoot{\thepage} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
17 |
} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
18 |
\pagestyle{plain} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
19 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
20 |
% Paragraph formatting |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
21 |
\frenchspacing |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
22 |
\setlength{\parindent}{0pt} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
23 |
\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
|
24 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
25 |
% Title information |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
26 |
\title{Kishna Glista - Liero Clone} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
27 |
\author{\normalsize{\begin{tabular}{lll} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
28 |
Atle Kivelä & 79171V & atle.kivela@tkk.fi \\ |
269 | 29 |
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
|
30 |
Tero Marttila & & \\ |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
31 |
Marko Rasa & & \\ |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
32 |
\end{tabular}}} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
33 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
34 |
% The document begins |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
35 |
\begin{document} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
36 |
\maketitle |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
37 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
38 |
\section{Instructions for compiling and use} |
293 | 39 |
|
40 |
You can compile the program by going trough the following procedure: |
|
41 |
\begin{itemize} |
|
42 |
\item \textsl{cd build} |
|
43 |
\item \textsl{./mkcmake.sh} |
|
44 |
\item \textsl{make install} |
|
45 |
\end{itemize} |
|
46 |
||
238
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
47 |
\subsection{Basic usage} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
48 |
Starting. Default Keys. Starting the server. Connecting. etc. |
293 | 49 |
|
50 |
Controls are currently liero default controls. |
|
51 |
\begin{center} |
|
52 |
\begin{tabular}{l|l} |
|
53 |
\textbf{Action} & \textbf{Default key(s)} \\ |
|
54 |
\hline |
|
55 |
Move left & Arrow left \\ |
|
56 |
Move right & Arrow right \\ |
|
57 |
Aim up & Arrow up \\ |
|
58 |
Aim down & Arror down \\ |
|
59 |
Shoot & Right CTRL \\ |
|
60 |
Jump & Right shift \\ |
|
61 |
Change weapon & Enter \\ |
|
62 |
Shoot rope & Change weapon + jump \\ |
|
63 |
Change rope length & Change weapon + aim up/down \\ |
|
64 |
\end{tabular} |
|
65 |
\end{center} |
|
66 |
||
67 |
\subsubsection*{Starting the game} |
|
68 |
Somekind of intstuctions on starting the server, connecting etc... |
|
69 |
||
238
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
70 |
\subsection{Configuration} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
71 |
How to make configuration changes. |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
72 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
73 |
\section{Program architecture} |
301 | 74 |
|
75 |
TODO: A nice image here would probably do the job. |
|
76 |
||
238
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
77 |
A brief description of the program architecture. |
278
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
78 |
\begin{itemize} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
79 |
\item Network |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
80 |
\item Graphics |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
81 |
\item Input etc. |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
82 |
\item Physics |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
83 |
\end{itemize} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
84 |
|
238
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
85 |
\section{Data structures and algorithms} |
269 | 86 |
|
301 | 87 |
|
278
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
88 |
\subsection{Basic data structures} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
89 |
|
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
90 |
\begin{itemize} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
91 |
\item Vector |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
92 |
\item List |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
93 |
\end{itemize} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
94 |
|
269 | 95 |
\subsection{World and Objects} |
96 |
||
301 | 97 |
% COMMENT: I think these should be in a very basic level and they |
98 |
% shouldn't discuss too much about the game itself. The idea is just |
|
99 |
% to explain different kinds of structures and algorithms. |
|
269 | 100 |
|
301 | 101 |
% Terrain |
102 |
The terrain is an important part of our game. We represent our terrain |
|
103 |
as a large array. Each shell of the array has a type that tells what |
|
104 |
is in that position. Currently, possible terrain types are EMPTY, DIRT |
|
105 |
and ROCK. |
|
106 |
||
107 |
% Usually, in side view 2D-games, the terrain is representated as a |
|
108 |
% polygon. This allows us to implement collision detection and |
|
109 |
% bouncing rather easily, and it is also a very compact way of storing |
|
110 |
% the map. In our opinion Liero, however, is fundamentally a pixel |
|
111 |
% based game and therefore we represent the terrain as a large array |
|
112 |
% of pixels. These pixels are, however, abstract pixels, i.e. they are |
|
113 |
% not necessarily in the same scale than the physical resolution. In |
|
114 |
% other words, the server has an abstract resolution, which is the |
|
115 |
% same for all clients, and the clients can visualize this abstract |
|
116 |
% array of pixels in any resolution they wish. |
|
117 |
||
118 |
% Objects |
|
119 |
In our physics simulation the shapes of the different elements in the |
|
120 |
game are represented as polygons. A polygon is a vector of points that |
|
121 |
define the edges of the shape. |
|
122 |
||
123 |
% On top of the terrain, the world also includes a list of all objects |
|
124 |
% in it (players, projectiles and ropes). The objects have a polygon |
|
125 |
% shape which is used in the collision detection between the objects |
|
126 |
% and the terrain and the objects with each other. |
|
269 | 127 |
|
128 |
\subsection{Collision Detection} |
|
129 |
||
278
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
130 |
\begin{itemize} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
131 |
\item Polygon collision detection |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
132 |
\item Pixel collision detection |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
133 |
\end{itemize} |
269 | 134 |
|
301 | 135 |
Collision detection algorithms check if objects in the physics |
136 |
simulation are colliding with eachother. Because our terrain is |
|
137 |
represented as an array and objects are represented as polygons we |
|
138 |
have two different kinds collision detection algorithms. |
|
139 |
||
140 |
The pixel based collision detection used to check collisions with the |
|
141 |
terrain is quite simple. It ``draws'' a line between two points A and |
|
142 |
B. The algorithm iterates over the line from point A to B and on each |
|
143 |
iteration it checks if theres a collision (i.e. the type of the |
|
144 |
current point is ROCK or DIRT). |
|
145 |
||
324 | 146 |
In order to implement bouncing from the terrain we have to have a way |
147 |
of calculating a normal for the slope of the terrain in the collision |
|
148 |
point. We came up with the following algorithm for calculating the |
|
278
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
149 |
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
|
150 |
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
|
151 |
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
|
152 |
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
|
153 |
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
|
154 |
vectors. The resulting vector will point approximately along the |
324 | 155 |
normal. % Picture would explain this a lot. |
269 | 156 |
|
157 |
\subsection{Physics} |
|
310 | 158 |
|
159 |
The fourth-order Runge-Kutta method is a numerical method for |
|
160 |
approximating the solution of an ordinary differential equation. In |
|
161 |
our game the Runge-Kutta method is used to calculate positions and |
|
162 |
velocities of physics objects when we apply forces to them. |
|
163 |
||
331 | 164 |
The mathematical formulation of the Runge-Kutta method: |
165 |
If we have an initial value problem of the form |
|
333 | 166 |
\begin{equation*} |
331 | 167 |
y' = f(t, y), \quad y(t_0) = y_0. |
333 | 168 |
\end{equation*} |
331 | 169 |
The we can describe the RK4 method for this problem by equations |
333 | 170 |
\begin{align*} |
331 | 171 |
y_{n+1} &= y_n + \tfrac{1}{6}h\left(k_1 + 2k_2 + 2k_3 + k_4 \right) \\ |
172 |
t_{n+1} &= t_n + h \\ |
|
333 | 173 |
\end{align*} |
331 | 174 |
where $y_{n+1}$ is the RK4 approximation of $y(t_{n+1})$, and |
333 | 175 |
\begin{align*} |
331 | 176 |
k_1 &= f(t_n, y_n) \\ |
177 |
k_2 &= f(t_n + \tfrac{1}{2}h, y_n + \tfrac{1}{2}h k_1) \\ |
|
178 |
k_3 &= f(t_n + \tfrac{1}{2}h, y_n + \tfrac{1}{2}h k_2) \\ |
|
179 |
k_4 &= f(t_n + h, y_n + h k_3) \\ |
|
333 | 180 |
\end{align*} |
331 | 181 |
The next value $(y_n+1)$ is determined by the present value $(y_n)$, |
182 |
the product of the interval $(h)$ and an estimated slope that is |
|
183 |
defined as $\frac{1}{6}h\left(k_1+2k_2+2k_3+k_4\right)$. |
|
310 | 184 |
|
333 | 185 |
% TODO: something network related? |
238
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
186 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
187 |
\section{Known bugs} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
188 |
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
|
189 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
190 |
\section{Tasks sharing and schedule} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
191 |
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
|
192 |
as we should have been. |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
193 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
194 |
\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
|
195 |
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
|
196 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
197 |
% References |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
198 |
\begin{thebibliography}{99} |
310 | 199 |
\bibitem{gaffer} Gaffer on games. Game |
200 |
Physics. 2006. http://gafferongames.wordpress.com/game-physics/ |
|
201 |
(read: 2008-12-08) |
|
323 | 202 |
\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
|
203 |
\end{thebibliography} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
204 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
205 |
\end{document} |