reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
authorterom
Tue, 09 Dec 2008 02:00:19 +0000
changeset 344 a1ac08c37f0f
parent 343 6675e370b377
child 345 bea1c1513692
reorganize section 1 of documentation, and write a lot of really hard-to-read text in section 2
doc/kishna.tex
--- a/doc/kishna.tex	Tue Dec 09 01:55:04 2008 +0000
+++ b/doc/kishna.tex	Tue Dec 09 02:00:19 2008 +0000
@@ -27,8 +27,8 @@
 \author{\normalsize{\begin{tabular}{lll}
 Atle Kivelä & 79171V & atle.kivela@tkk.fi \\
 Eric Malmi & 80351A & eric.malmi@tkk.fi \\
-Tero Marttila & & \\
-Marko Rasa & & \\
+Tero Marttila & 79849E & tjmartti@cc.hut.fi \\
+Marko Rasa & 78726L & morasa@cc.hut.fi \\
 \end{tabular}}}
 
 % The document begins
@@ -37,50 +37,114 @@
 
 \section{Instructions for compiling and use}
 
-You can compile the program by going trough the following procedure:
+\subsection{Configuring CMake}
+You must first generate the project's CMake configuration inside of \textsl{build}. A simple script is provided to do
+so with some default settings. It will configure the install path as \textsl{~/opt}.
+
 \begin{itemize}
 \item \textsl{cd build}
 \item \textsl{./mkcmake.sh}
+\end{itemize}
+
+\subsection{Compiling and Installing}
+Once you have the CMake scripts in place, compiling should be as simple as running make:
+\begin{itemize}
+\item \textsl{make}
 \item \textsl{make install}
 \end{itemize}
 
-\subsection{Basic usage}
-Starting. Default Keys. Starting the server. Connecting. etc.
+This will build the binary, and then copy the binary and data files to the install path configured above.
 
-Controls are currently liero default controls.
+\subsection{Command-line Arguments}
+Running the game is done using command-line arguments to the executable
+\begin{center}
+\begin{tabular}{l|l|l|l|l}
+\textbf{Short} & \textbf{Long} & \textbf{Value} & \textbf{Description} & \textbf{Default} \\
+\hline
+-p & \verb|--port| & PORT & Set server TCP/UDP port & 9338 \\
+-s & \verb|--server| &  & Run as a network server & false \\
+-c & \verb|--client| & SERVERHOST & Run as a network client on given server & false \\
+-g & \verb|--graphics| & & Enable graphics rendering & * \\
+\end{tabular}
+\end{center}
+
+* = true, except false when --server is given
+
+The options \verb|--server| and \verb|--client| are mutually exclusive, and both cannot be selected at the same time.
+
+\subsection{Keyboard Controls}
+The default controls are identical to the origional Liero default controls, with some additions.
+
 \begin{center}
 \begin{tabular}{l|l}
 \textbf{Action} & \textbf{Default key(s)} \\
 \hline
-Move left & Arrow left \\
-Move right & Arrow right \\
-Aim up & Arrow up \\
-Aim down & Arror down \\
-Shoot & Right CTRL \\
-Jump & Right shift \\
-Change weapon & Enter \\
-Shoot rope & Change weapon + jump \\
-Change rope length & Change weapon + aim up/down \\
+Move Left & Arrow Left \\
+Move Right & Arrow Right \\
+Aim Up & Arrow Up \\
+Aim Down & Arror Down \\
+Dig & Move Left + Move Right \\
+Shoot & Right Control \\
+Jump & Right Shift \\
+Change Weapon & Enter + Arrow Left / Arrow Right \\
+Throw Rope & Change Weapon + Jump \\
+Release Rope & Jump \\
+Change Rope Length & Change Weapon + Aim Up / Aim Down \\
+Suicide & Left Control + K \\
+Exit Game & Esc \\
 \end{tabular}
 \end{center}
 
-\subsubsection*{Starting the game}
-Somekind of intstuctions on starting the server, connecting etc...
+\subsection{Running the game}
+To simple start a local singleplayer game, just run `kg` without any arguments.
+
+To start a network server on the default port, run `kg --server` (`kg -s`). You may optionally also specify the
+`--graphics` argument to have the server passively draw the graphics.
+
+To start a network client, connecting to a server running on the default port, run
+`kg --client=ADDRESS` (`kg -c ADDRESS`).
+
+To use a non-default port, simply specify `--port=PORT` (`-p <port>`) on both client and server.
 
 \subsection{Configuration}
-How to make configuration changes.
+All global game constants are defined in `src/Config.hh`, and may be experimented with. Weapon parameters are defined
+in `src/Weapons.cc`.
 
 \section{Program architecture}
-
-TODO: A nice image here would probably do the job.
+Execution starts in Application, which parses the command-line arguments, and then invokes methods in Engine. Engine
+creates the GameState, and then Graphics, SinglePlayer, NetworkServer or NetworkClient objects.
 
-A brief description of the program architecture.
-\begin{itemize}
-\item Network
-\item Graphics
-\item Input etc.
-\item Physics
-\end{itemize}
+GameState contains PhysicsWorld, which inherits from Terrain and contains a list of PhysicsObjects.
+
+GameState then contains Player objects and Projectile objects, both of which inherit from PhysicsObject.
+
+Player objects have a list of Weapon objects, and can use these to create Projectiles. Every Player also has a Rope
+object, which is in itself a separate PhysicsObject, and is either folded away, being thrown, or attached to the
+terrain.
+
+The network code is a bit more complicated, with several layers.
+
+NetworkAddress and NetworkSocket are ClanLib's Socket/IPAddress types. NetworkPackets provide a mechanism to read/write values from/to a byte buffer, and NetworkBuffer is used for buffering socket I/O.
+
+NetworkUDP is an UDP socket. NetworkTCPServer is a listen() socket, which spawns NetworkTCPTransports when clients connect. NetworkTCPClient is itself a NetworkTCPTransport with a connect()'d socket.
+
+NetworkSession can have a NetworkTCPServer socket, and both client and server NetworkUDP sockets. Connected clients are
+represented as NetworkNodes.
+
+NetworkObjectControllers can be attached to a NetworkSession on a specific NetworkChannelID, and they then manage
+instances of NetworkObjects, which have NetworkObjectIDs that can be sent across the network. NetworkObjects can be
+used to send messages with a specific NetworkMessageID.
+
+NetworkServer then has a NetworkSession and NetworkObject\_ServerController, and then creates NetworkServerPlayer and
+NetworkServerProjectile objects (that are NetworkObject\_Server's).
+
+NetworkClient then has a NetworkSession and a specialized NetworkClientController (NetworkObject\_ClientController) that
+creates NetworkClientLocalPlayer/NetworkClientRemotePlayer/NetworkClientProjectile objects when they are received from
+the server.
+
+Graphics has an Input object, which contains InputHandler objects for various classes of input, such as PlayerInput (which affects the GameState's LocalPlayer), and GuiInput (which just modifies what the GUI looks like on the client side).
+
+TODO: Replace the above with some nice diagram, and make the text more brief
 
 \section{Data structures and algorithms}