author | saiam |
Mon, 08 Dec 2008 21:15:52 +0000 | |
changeset 310 | 7e0cfc5f0944 |
parent 301 | 02ad02d28245 |
child 323 | a17043af6995 |
permissions | -rw-r--r-- |
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 | 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 | 38 |
|
39 |
You can compile the program by going trough the following procedure: |
|
40 |
\begin{itemize} |
|
41 |
\item \textsl{cd build} |
|
42 |
\item \textsl{./mkcmake.sh} |
|
43 |
\item \textsl{make install} |
|
44 |
\end{itemize} |
|
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 | 48 |
|
49 |
Controls are currently liero default controls. |
|
50 |
\begin{center} |
|
51 |
\begin{tabular}{l|l} |
|
52 |
\textbf{Action} & \textbf{Default key(s)} \\ |
|
53 |
\hline |
|
54 |
Move left & Arrow left \\ |
|
55 |
Move right & Arrow right \\ |
|
56 |
Aim up & Arrow up \\ |
|
57 |
Aim down & Arror down \\ |
|
58 |
Shoot & Right CTRL \\ |
|
59 |
Jump & Right shift \\ |
|
60 |
Change weapon & Enter \\ |
|
61 |
Shoot rope & Change weapon + jump \\ |
|
62 |
Change rope length & Change weapon + aim up/down \\ |
|
63 |
\end{tabular} |
|
64 |
\end{center} |
|
65 |
||
66 |
\subsubsection*{Starting the game} |
|
67 |
Somekind of intstuctions on starting the server, connecting etc... |
|
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} |
301 | 73 |
|
74 |
TODO: A nice image here would probably do the job. |
|
75 |
||
238
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
76 |
A brief description of the program architecture. |
278
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
77 |
\begin{itemize} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
78 |
\item Network |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
79 |
\item Graphics |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
80 |
\item Input etc. |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
81 |
\item Physics |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
82 |
\end{itemize} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
83 |
|
238
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
84 |
\section{Data structures and algorithms} |
269 | 85 |
|
301 | 86 |
|
278
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
87 |
\subsection{Basic data structures} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
88 |
|
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
89 |
\begin{itemize} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
90 |
\item Vector |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
91 |
\item List |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
92 |
\end{itemize} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
93 |
|
269 | 94 |
\subsection{World and Objects} |
95 |
||
301 | 96 |
% COMMENT: I think these should be in a very basic level and they |
97 |
% shouldn't discuss too much about the game itself. The idea is just |
|
98 |
% to explain different kinds of structures and algorithms. |
|
269 | 99 |
|
301 | 100 |
% Terrain |
101 |
The terrain is an important part of our game. We represent our terrain |
|
102 |
as a large array. Each shell of the array has a type that tells what |
|
103 |
is in that position. Currently, possible terrain types are EMPTY, DIRT |
|
104 |
and ROCK. |
|
105 |
||
106 |
% Usually, in side view 2D-games, the terrain is representated as a |
|
107 |
% polygon. This allows us to implement collision detection and |
|
108 |
% bouncing rather easily, and it is also a very compact way of storing |
|
109 |
% the map. In our opinion Liero, however, is fundamentally a pixel |
|
110 |
% based game and therefore we represent the terrain as a large array |
|
111 |
% of pixels. These pixels are, however, abstract pixels, i.e. they are |
|
112 |
% not necessarily in the same scale than the physical resolution. In |
|
113 |
% other words, the server has an abstract resolution, which is the |
|
114 |
% same for all clients, and the clients can visualize this abstract |
|
115 |
% array of pixels in any resolution they wish. |
|
116 |
||
117 |
% Objects |
|
118 |
In our physics simulation the shapes of the different elements in the |
|
119 |
game are represented as polygons. A polygon is a vector of points that |
|
120 |
define the edges of the shape. |
|
121 |
||
122 |
% On top of the terrain, the world also includes a list of all objects |
|
123 |
% in it (players, projectiles and ropes). The objects have a polygon |
|
124 |
% shape which is used in the collision detection between the objects |
|
125 |
% and the terrain and the objects with each other. |
|
269 | 126 |
|
127 |
\subsection{Collision Detection} |
|
128 |
||
278
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
129 |
\begin{itemize} |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
130 |
\item Polygon collision detection |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
131 |
\item Pixel collision detection |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
132 |
\end{itemize} |
269 | 133 |
|
301 | 134 |
Collision detection algorithms check if objects in the physics |
135 |
simulation are colliding with eachother. Because our terrain is |
|
136 |
represented as an array and objects are represented as polygons we |
|
137 |
have two different kinds collision detection algorithms. |
|
138 |
||
139 |
The pixel based collision detection used to check collisions with the |
|
140 |
terrain is quite simple. It ``draws'' a line between two points A and |
|
141 |
B. The algorithm iterates over the line from point A to B and on each |
|
142 |
iteration it checks if theres a collision (i.e. the type of the |
|
143 |
current point is ROCK or DIRT). |
|
144 |
||
145 |
In the |
|
278
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
146 |
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
|
147 |
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
|
148 |
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
|
149 |
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
|
150 |
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
|
151 |
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
|
152 |
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
|
153 |
little bit different. |
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
154 |
|
2b856bc88e6d
Added random stuff to documentation. Time to go to sleep.
saiam
parents:
269
diff
changeset
|
155 |
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
|
156 |
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
|
157 |
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
|
158 |
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
|
159 |
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
|
160 |
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
|
161 |
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
|
162 |
normal. Picture explains this a lot. |
269 | 163 |
|
164 |
\subsection{Physics} |
|
310 | 165 |
|
166 |
The fourth-order Runge-Kutta method is a numerical method for |
|
167 |
approximating the solution of an ordinary differential equation. In |
|
168 |
our game the Runge-Kutta method is used to calculate positions and |
|
169 |
velocities of physics objects when we apply forces to them. |
|
170 |
||
171 |
% TODO: Here we could write the runge kutta method mathematically |
|
172 |
% (copy paste from wikipedia or something) |
|
173 |
||
174 |
something network related? |
|
238
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
175 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
176 |
\section{Known bugs} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
177 |
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
|
178 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
179 |
\section{Tasks sharing and schedule} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
180 |
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
|
181 |
as we should have been. |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
182 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
183 |
\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
|
184 |
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
|
185 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
186 |
% References |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
187 |
\begin{thebibliography}{99} |
310 | 188 |
\bibitem{gaffer} Gaffer on games. Game |
189 |
Physics. 2006. http://gafferongames.wordpress.com/game-physics/ |
|
190 |
(read: 2008-12-08) |
|
238
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
191 |
\end{thebibliography} |
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
192 |
|
15193c2bbe2f
Added documentation draft. It is done in tex. Hopefully everyone is okay with that.
saiam
parents:
diff
changeset
|
193 |
\end{document} |