OOTetris Design
Contents |
Introduction
During my Bachelor studies in Germany I had to implement a network based Tetris. It is possible to run the game with many players on different computers in a network. The game works quite well but the design in general is quite messy. The Design we came up with was more or less guided by our progress on programming different parts of the game. So we started out with the Server-Client Communication. After the basic communication was achieved we started implementing the tetris game itself with its graphical user interface and the gamestructure (gamecontrol).
The old Design
Class-Diagram (package overview)
The old design consists out of 5 different packages as you can see in the UML-Diagram above:
- The green package in the UML-Diagram is responsible for the Server-Client communication.
- The pink package controls the game. Thats where the game intelligence is implemented.
- The blue package is obviously the graphical user interface.
- The red package contains the different stones of the tetris game.
- The yellow package is a customized list which is used to the store the stones of every client.
State-of-the-art Class-Diagram
To be able to understand the whole Design, I think it makes sense to have a look at the more detailed version of the Class-Diagram:
This diagram shows the whole structure of all classes and their relationships a bit more in detail. As I said before this is a multi player tetris which can be played over the network. To be able to do that a client-server structure is necessary. As you can see in the diagram there is a GUI for the Client as well as for the Server. The Server GUI (S_GUI) gets started. Here the player chooses either to setup his/her computer as server or just as client. In case it is setup as server, the server structure as well as the client structure are built. In case it is just a client, only the client (C_GUI) is started. To understand the server-client communication I attached a diagram, which describes the essentials of the network communication.