Project

General

Profile

Revision 391

report

View differences:

proj/doc/report/report.tex
41 41
\newcommand\setrow[1]{\gdef\rowmac{#1}#1\ignorespaces}
42 42
\newcommand\clearrow{\global\let\rowmac\relax}
43 43
\clearrow
44
\usepackage{multirow}
44 45
% Math stuff
45 46
\usepackage[mathscr]{euscript}
46 47
\usepackage{amsmath,amssymb}
......
235 236
Collection of useful classes and functions. This module was developed with the goal of being as general and independent from \texttt{proj} as possible, although there are rare occasions where sub-modules of \texttt{libs} include sub-modules of \texttt{proj}.
236 237
\subsubsection{\texttt{classes}}
237 238
Provides classes \texttt{list\_t} and \texttt{queue\_t}. These classes achieve generality by storing pointers to \texttt{void}, which have as major disadvantage requiring the use of \texttt{free}. \par
238
Provides various classes to store information about entities (such as map, shooter, bullets)
239
as well as structs to store player information, key presses, text.\par
240
The class \texttt{keys\_t} holds information of the keys that are pressed, as well as if the left button of the mouse is pressed. This values are stored in 1 bit each, minimizing the space occupied in memory, and is updated on every KBC and Mouse interrupt.\par
241
The class \texttt{rectangle\_t}	provides ease on drawing rectangles on the screen with functions to change its position, color, line width, fill color, among others.\par
242
The class \texttt{glyph\_t} allows letters to be drawn, and is the base class to then represent text on screen.\par
243
The class \texttt{font\_t} is an extension of the previous one, allowing multiple letters to be drawn.\par
244
The class \texttt{text\_t} extends the previous class by creating an interface with strings, allowing to modify the string to be drawn, the size of each character, among other aspects.\par
245
The class \texttt{menu\_t} allows the creation of menus with multiple click-able boxes with text.
246
The class \texttt{basic\_sprite\_t} allows to load XPM maps and draw those onto the screen, it is the main class for all the entities, as it will hold the textures of each entity.\par
247
The class \texttt{sprite\_t} improves the previous class by adding the capability of rotating and scaling the image to be rendered.\par
248
The class \texttt{gunner\_t} represents an entity, this entity can assume melee or ranged form, and also can represent a person or a zombie. This entity also has other features for the game such as health bar and the team the entity is on.\par
249
The class \texttt{bullet\_t} represents a bullet, characterized by the source of bullet, this is who shot the bullet, its velocity and damage in case it collides with a person or zombie.\par
250
The class \texttt{map\_t} represents the map of the game, as well as being the interface for the path finding algorithm used for the autonomous opponents.\par
251
The class \texttt{score\_info\_t} is used to store information about a score, such as the value of the score, the time played to obtain the score and the date and time it happened.\par
252
The class \texttt{highscores\_t} uses the previous class to store information about the three best scores, and allows them to be drawn to the screen, similar to menu.\par
253
The classes \texttt{host\_info\_t}, \texttt{remote\_info\_t} and \texttt{bullet\_info\_t} represent information to be transmitted to the serial port containing information about the game.
254
\newpage
239
\subsubsection{\texttt{graph}}
240
Provides basic elements for screen drawing, like drawing pixels, rectangles, text. Manages screen buffering and VRAM.
241
\subsubsection{\texttt{uart}}
242
Provides basic functions and the NCTP protocol for communication between computers.
243
\subsubsection{\texttt{utils}}
244
Common functions, as well as functions for handling XPMs and XPM2 file format.
245
\subsubsection{others}
246
\begin{itemize}
247
	\item \texttt{kbc}: Manage mouse and keyboard
248
	\item \texttt{rtc}: Manage RTC, get current time
249
	\item \texttt{timer}: Manage timer 0 interrupts and subscriptions
250
\end{itemize}
255 251
\subsection{\texttt{proj}}
256
\textcolor{red}{MAKE PROJ MODULES}
252
\subsubsection{\texttt{campaign}}
253

  
254
\subsubsection{\texttt{chat}}
255

  
256
\subsubsection{\texttt{ent}}
257

  
258
\subsubsection{\texttt{hltp}}
259

  
260
\subsubsection{\texttt{proj\_func}}
261

  
262
\subsubsection{others}
263
\begin{itemize}
264
	\item \texttt{interrupts\_func}: group some interrupt handling functions together
265
	\item \texttt{makecode\_map}: map makecodes to chars
266
	\item \texttt{proj\_macros}: macros used throughout the project
267
	\item \texttt{proj\_structures}: mostly structures for transmission via HLTP
268
	\item \texttt{singplayer}: simple menu
269
\end{itemize}
270
\begin{center} \begin{tabular}{c | c | c | c | p{50mm} | p{50mm}}
271
	& & Weight & Resp. & Contribution DR & Contribution TB \\ \hline
272
	\multirow{7}{*}{libs}
273
		& classes & 13\% & DR & Everything & - \\ \cline{2-6}
274
		& graph   & 10\% & DR & Most part & Some contributions \\ \cline{2-6}
275
		& kbc     & 2\% & TB & In labs & In labs, adapted to project \\ \cline{2-6}
276
		& rtc     & 4\% & TB & - & Everything \\ \cline{2-6}
277
		& timer   & 2\% & TB & In labs & In labs, adapted to project \\ \cline{2-6}
278
		& uart    & 16\% & DR & Everything & - \\ \cline{2-6}
279
		& utils   & 3\% & DR & In labs, most part & In labs, some contributions \\ \hline
280
	\multirow{12}{*}{proj}
281
		& campaign			& 3\% & DR & Most part & Some contributions \\ \cline{2-6}
282
		& chat              & 7\% & DR & Everything & - \\ \cline{2-6}
283
		& ent               & 10\% & DR & Everything except TB & \texttt{bullet\_t} \\ \cline{2-6} 
284
		& hltp              & 4\% & DR & Most part & Some contributions \\ \cline{2-6}
285
		& interrupts\_func  & 3\% & TB & Small contribution & Most part \\ \cline{2-6}
286
		& makecode\_map     & 1\% & TB & - & Everything \\ \cline{2-6}
287
		& proj\_func        & 9\% & TB & $1/2$ & $1/2$ \\ \cline{2-6}
288
		& proj\_macros      & 1\% & TB & - & Everything \\ \cline{2-6}
289
		& proj\_structures  & 1\% & TB & - & Everything \\ \cline{2-6}
290
		& scoreboards       & 2\% & TB & - & Everything \\ \cline{2-6}
291
		& singleplayer      & 1\% & DR & Everything & - \\ \cline{2-6}
292
		& zombies           & 8\% & DR & Everything & -
293
\end{tabular} \end{center}
257 294
\section{Implementation details} \label{sec:details}
258 295
\subsection{Object-oriented programming}
296
Object-oriented programming was implemented to its greatest extent possible. Classes were declared using the \texttt{typedef struct} expression, and their public methods declared in the corresponding header file, always requiring as first argument a pointer/const pointer to that class. Classes were defined in the corresponding source file, and private member functions were defined as \texttt{static}.\par
297
The majority of entities were encapsulated in classes.
259 298
\subsection{XPM and XPM2}
260 299
The extensive use of large XPMs by simply including them with an \texttt{\#include} directive gives rise to large executable files, besides making it harder to change the used XPMs without recompiling the project.\par
261 300
The XPM2 file format is similar to XPM, except it is stripped from all the C syntax, making it a plain text file. This file format has the main advantage of being easy to load on runtime, unlike XPM that would require extensive parsing.\par

Also available in: Unified diff