doc/kishna.tex
changeset 362 6c7b4deefdfb
parent 361 1b87b1e0ae1d
child 363 971769b5f8c7
equal deleted inserted replaced
361:1b87b1e0ae1d 362:6c7b4deefdfb
   146 
   146 
   147 The network code is a bit complicated and has several layers. There
   147 The network code is a bit complicated and has several layers. There
   148 are some nice diagrams about the program structure in the doxygen
   148 are some nice diagrams about the program structure in the doxygen
   149 documentation.
   149 documentation.
   150 
   150 
       
   151 \begin{figure}[!ht]
       
   152  \centering \includegraphics[width=\textwidth]{images/class_Player_inherit_graph.png}
       
   153  \caption{Player class inheritance graph. \label{class_Player_inheritance}}
       
   154 \end{figure}
       
   155 
       
   156 \begin{figure}[!ht]
       
   157  \centering \includegraphics[width=\textwidth]{images/class_GameState_collaboration_graph.png}
       
   158  \caption{Relationships of core GameState class. \label{class_GameState_collaboration}}
       
   159 \end{figure}
       
   160 
   151 \subsection{Network}
   161 \subsection{Network}
   152 
   162 
   153 The network code is implemented as separate NetworkServer and NetworkClient modules, which use a common high-level
   163 The network code is implemented as separate NetworkServer and NetworkClient modules, which use a common high-level
   154 network interface, NetworkSession and NetworkObject.
   164 network interface, NetworkSession and NetworkObject.
   155 
   165 
   197 When the player first connects to the server, the server sends a large packet containing the terrain array to the
   207 When the player first connects to the server, the server sends a large packet containing the terrain array to the
   198 client, which updates its own GameState world's terrain array with the received data.
   208 client, which updates its own GameState world's terrain array with the received data.
   199 
   209 
   200 Currently, the client only sends handleInput using unreliable UDP messages, and the server only sends position updates
   210 Currently, the client only sends handleInput using unreliable UDP messages, and the server only sends position updates
   201 (as sent in response to handleInput events) unreliably. All other events are sent using reliable TCP.
   211 (as sent in response to handleInput events) unreliably. All other events are sent using reliable TCP.
       
   212 
       
   213 \begin{figure}[!ht]
       
   214  \centering \includegraphics[width=\textwidth]{images/class_NetworkObject_inherit_graph.png}
       
   215  \caption{Use of NetworkObject in network code. \label{class_NetworkObject_inherit}}
       
   216 \end{figure}
   202 
   217 
   203 \section{Data structures and algorithms}
   218 \section{Data structures and algorithms}
   204 
   219 
   205 \subsection{Basic data structures}
   220 \subsection{Basic data structures}
   206 
   221 
   275 \end{enumerate}
   290 \end{enumerate}
   276 
   291 
   277 Picture \ref{algo} explains the algorithm a lot. In the middle of the pictured we have zoomed to the collision point. The red arrow is the sum of the black arrows and thus it is our approximation for the normal.
   292 Picture \ref{algo} explains the algorithm a lot. In the middle of the pictured we have zoomed to the collision point. The red arrow is the sum of the black arrows and thus it is our approximation for the normal.
   278 
   293 
   279 \begin{figure}[!ht]
   294 \begin{figure}[!ht]
   280  \centering \includegraphics[width=0.7\textwidth]{normaali_algo.png}
   295  \centering \includegraphics[width=0.7\textwidth]{images/normaali_algo.png}
   281  \caption{Visualizing the algorithm for approximating the normal. \label{algo}}
   296  \caption{Visualizing the algorithm for approximating the normal. \label{algo}}
   282 \end{figure}
   297 \end{figure}
   283 
   298 
   284 \subsection{Physics}
   299 \subsection{Physics}
   285 
   300 
   318 
   333 
   319 We use the two dimensional version of the algorithm. It needs step for point's between
   334 We use the two dimensional version of the algorithm. It needs step for point's between
   320 last density and step diagonal to last density's points -- otherwise it is quite similar
   335 last density and step diagonal to last density's points -- otherwise it is quite similar
   321 to the one dimensional version. We decide to implement the algorithm as iterative instead of recursion.
   336 to the one dimensional version. We decide to implement the algorithm as iterative instead of recursion.
   322 
   337 
   323 % TODO: something network related?
       
   324 
       
   325 \subsection{Input}
   338 \subsection{Input}
   326 
   339 
   327 All input is represented as a bitmask, composed of bits from \textsl{enum PlayerInputBits}. Additionally, the Graphics
   340 All input is represented as a bitmask, composed of bits from \textsl{enum PlayerInputBits}. Additionally, the Graphics
   328 code uses some local-only flags defined in \textsl{enum GuiInputBits}. These bitmasks are built using the
   341 code uses some local-only flags defined in \textsl{enum GuiInputBits}. These bitmasks are built using the
   329 \textsl{InputHandler} class, which is defined as a generic template. On every update, it goes through its keymap,
   342 \textsl{InputHandler} class, which is defined as a generic template. On every update, it goes through its keymap,