![]() |
||||
IntroductionThe lobby module is responsible for starting a network game between 2 chosen players. It also allows the other machines on the network to observe the game as it happens. Initially the lobby modules of each game machine will display a screen showing the names of the other players on the network. To start a game, any user should click on the name of their chosen opponent. The main game screen will then appear and play can commence. The other machines will display the game in real-time, but they will not be allowed to participate. InputsThe lobby module receives mouse clicks from the user, just like the input module. It uses these mouse_click messages to work out which opponent is chosen when the user clicks on a name in the lobby screen. Messages are also received from the lobby modules of the other game machines on the wireless network. These tell the lobby the names of the other machines on the network and instruct it to start a game with a particular player or observe a game between 2 other players. OutputsOnce the lobby module has started a game, it must forward any mouse_click messages from the user to the input module so that it can detect the user's moves and button presses. In addition, a player number must be passed to the core module (via the input module). As well as signalling the core to start the game, the player number tells each game core whether it is a player or an observer. Also, the player number is needed to identify the origin of move and button messages that are sent by each core when the game is in progress. The lobby module displays the names of the other players on the screen. This means that it needs to send PrintString messages to the graphics module. A clear_screen message is also sent just before the lobby hands control to the core module, because it assumes that the screen will initially be blank. As I have mentioned above, the lobby also sends control messages to the lobby modules of the other game machines on the network. Design DecisionsI have designed the lobby module to cope with any number of game machines on the bluetooth network. When the lobby first starts, it sends a message to all the other machines telling them its name. It then receives one of these name messages from the lobby module of every other computer and builds up a list of potential players. This list is then displayed on the screen. At present, the lobby modules of each game machine are directly connected rather than using the bluetooth module. This is because it doesn't work yet and has only been designed to provide communication between 2 game machines. Bugs and Future DevelopmentThe lobby module works correctly, however at the time of writing, the text drawing feature of the graphics module is not reliable. This may be solved by waiting a short time between sending print messages, so that the graphics module has time to write one name on the screen before it receives the next one. The lobby could be improved by asking users if they want to play a network game when their name is chosen by another player. At present the game is started immediately without giving them a choice. |
||||
![]() |
||||
|
||||
![]() |
![]() |
![]() |