111 \subsection{Configuration} |
111 \subsection{Configuration} |
112 All global game constants are defined in \textit{src/Config.hh}, and may be |
112 All global game constants are defined in \textit{src/Config.hh}, and may be |
113 experimented with. Weapon parameters are defined in \textit{src/Weapons.cc}. |
113 experimented with. Weapon parameters are defined in \textit{src/Weapons.cc}. |
114 |
114 |
115 \section{Program architecture} |
115 \section{Program architecture} |
116 Execution starts in Application, which parses the command-line |
116 The program consists of four main parts: Graphics\&Input, GameState, |
117 arguments, and then invokes methods in Engine. Engine creates the |
117 Network and Physics. Each part contains various classes the relations |
118 GameState, and then Graphics, SinglePlayer, NetworkServer or |
118 show up in the doxygen generated documentation of the program. |
119 NetworkClient objects. |
119 |
120 |
120 The program starts from Application class and it then starts Engine |
121 GameState contains PhysicsWorld, which inherits from Terrain and |
121 which creates GameState, Graphics and different network related |
122 contains a list of PhysicsObjects. |
122 things. Physics simulation is started when GameState is created. |
123 |
123 |
124 GameState then contains Player objects and Projectile objects, both of |
124 GameState contains PhysicsWorld which inherits from Terrain and |
125 which inherit from PhysicsObject. |
125 contains a list of PhysicsObjects. GameState also contains Player and |
126 |
126 Projectile objects which inherit from PhysicsObject (and are contained |
127 Player objects have a list of Weapon objects, and can use these to |
127 in PhysicsWorld). |
128 create Projectiles. Every Player also has a Rope object, which is in |
128 |
129 itself a separate PhysicsObject, and is either folded away, being |
129 Player objects have a list of Weapon objects which they can use to |
130 thrown, or attached to the terrain. |
130 create Projectiles. Every Player also has a Rope object, which is a |
131 |
131 separate PhysicsObject, and is either folded away, being thrown or |
132 The network code is a bit more complicated, with several layers. |
132 attached to the terrain. |
133 |
133 |
|
134 Graphics and input are handled in their own classes. Graphics has an |
|
135 Input object which contains InputHandler objects for various classes |
|
136 of input. One such object is PlayerInput which affects the GameState's |
|
137 LocalPlayer. Other object is GuiInput which just modifies what the GUI |
|
138 look like on the client side. |
|
139 |
|
140 The network code is a bit complicated and has several layers. |
|
141 |
|
142 % Are these necessary? Can they be simplified. |
134 NetworkAddress and NetworkSocket are ClanLib's Socket/IPAddress |
143 NetworkAddress and NetworkSocket are ClanLib's Socket/IPAddress |
135 types. NetworkPackets provide a mechanism to read/write values from/to |
144 types. NetworkPackets provide a mechanism to read/write values from/to |
136 a byte buffer, and NetworkBuffer is used for buffering socket I/O. |
145 a byte buffer, and NetworkBuffer is used for buffering socket I/O. |
137 |
146 |
138 NetworkUDP is an UDP socket. NetworkTCPServer is a listen() socket, |
147 NetworkUDP is an UDP socket. NetworkTCPServer is a listen() socket, |
158 NetworkClient then has a NetworkSession and a specialized |
167 NetworkClient then has a NetworkSession and a specialized |
159 NetworkClientController (NetworkObject\_ClientController) that creates |
168 NetworkClientController (NetworkObject\_ClientController) that creates |
160 NetworkClientLocalPlayer/NetworkClientRemotePlayer/NetworkClientProjectile |
169 NetworkClientLocalPlayer/NetworkClientRemotePlayer/NetworkClientProjectile |
161 objects when they are received from the server. |
170 objects when they are received from the server. |
162 |
171 |
163 Graphics has an Input object, which contains InputHandler objects for |
|
164 various classes of input, such as PlayerInput (which affects the |
|
165 GameState's LocalPlayer), and GuiInput (which just modifies what the |
|
166 GUI looks like on the client side). |
|
167 |
172 |
168 TODO: Replace the above with some nice diagram, and make the text more |
173 TODO: Replace the above with some nice diagram, and make the text more |
169 brief |
174 brief |
170 |
175 |
171 \section{Data structures and algorithms} |
176 \section{Data structures and algorithms} |