This section contains an overview of the BattleTans system components, which will be integrated into the jTans system. We will show how each of the new components we are creating interacts with existing jTans components, and how the new components interact with each other.
The main function of the jTans code calls two distinct interface and functional components, which are the Display Figure Component and the Editable Figure Component.
The display figure component is represented on the interface as the region where the finished puzzle is displayed. In a structural sense, it is an object made for the application whose sole purpose is to display the puzzle pieces.
The editable figure component is the region of the board where the pieces are manipulated by the user in order to complete a puzzle. It is where the heart of the functionality of jTans is located.
Two modifications to the jTans classes will be necessary. New class guimain.NonEditableFigureComponent will extend EditableFigureComponent to display incoming network data for opponent's moves. Method guimain.EditableFigureComponent.obscure() will be implemented to cause the EditableFigureComponent to no longer be visible. Mouse input is still accepted.
Figure 1 - BattleTans Opening Screen
This can be achieved through a BorderLayout on the container panel, the logo being assigned to Center, with another panel containing the three options being assigned South. A Simple gridlayout of the three options will display the buttons. Clicking on each of the buttons will change the screen to that respective choice.The first button will be One Player BattleTans ("Training"), which when clicked will lead to the One Player configuration screen. The second button when clicked will lead to the Two Player Lounge ("Combat") screen, which will be discussed later.
Figure 3 - Two Player Lounge and Pop-up Challenge Window
The screen is divided into three basic panels, which have been diagramed by their Java/Java Swing components. The layout of the container pane will be set to Borderlayout, which is conducive to the design of the Lounge.The first panel, assigned to the Borderlayout.Center of the container pane, will house the Lounge chat functionality. The panel contains a multi-line text field, displaying the text from the chat conducted by users. The field itself is housed in a JScrollPane to allow users to scroll through the chat text.
Below the text field are two input elements. The first is a single-line text field, used to enter text to be entered into the chat text field. This is accomplished by typing in the desired text and pressing the submit button located to the right.
The second panel contains the information of the users participating in the lounge, and is assigned the Borderlayout.East attribute to the container pane. The first object in this panel, a multi-line text field, is housed in a JScrollPane much like the chat field. It, however, displays the user names and IP addresses of users on the network participating in the lounge. Below the text field is a button labelled "Challenge." By selecting a user name from the list of users and clicking on the challenge button, the selected user will be informed of the challenge via a small pop up window. The window contains the pertinent information of the challenge, including the user name of the challenger and the game type. The window also contains two buttons labeled "Accept" and "Decline" for either accepting or declining the challenge, naturally.
The third panel of the interface contains the input objects used to specify a type of game. The first is a radio select button associated with the label "Fastest Five," which when selected chooses the fastest five game type.
Below these two inputs are the ones associated with the "Best of Five" game. The first input is a radio button labeled "Best of Five" which when selected enables the best of five game play.
This describes the relationships of the objects in the lounge screen. Each node represents an object. Each line represents membership between objects, flowing top to bottom.
Figure 5 - Two Player Game Interface
The second change would be a display for the weapons. This display would allow the user to select a weapon to be used, and to know which weapons have already been used.The client machines, which will be operated by regular users, will have a Client Object instantiated. The Client Object's main duty will be to allow the BattleTans client to receive coordinates from the Lounge Server object during network game play. Figure 7, shows how the Lounge Server object resides in the server, and the Client Object resides in the BattleTans client machine. This figure also shows how the client communicates with the server when registering. The client will send the server name and network information to the Lounge Server object in order to maintain a list of available players.
Figure 8 - Object Roles In NetworkFig 8 shows the flow of data between two network players. The data flow occurs between Client #1 and Client #3, and the Lounge Server object acts as a network traffic controller between the two clients. The Lounge Server object receives the shape piece information from both clients, and then routes them to the appropriate opponent.
Figure 9 - Flow of Data During Networked Game
The classes in the figure above represent the design of the network implementation of BattleTans, which will use the Java RMI networking capabilities. The design of the network implementation takes into account concurrency issues as well as organizational problems such as how the system will keep track of matches between players across the network. The reason why RMI was chosen as a network communication tool is mainly due to RMI's ease of use and also because it lends itself well for book keeping purposes of players and matches. RMI can take a class, which resides on one end of the network, and allow it to be instantiated remotely across the network and have functions called.
This demonstrates the top level of the jTans class hierarchy. jTansApplication, the standalone program, and jTansWebstart, the Java Webstart version, both inherit from the AbstractApplication class. AbstractApplication takes care of the high-level game setup.
Figure 12 - guimain packageguimain contains the MainWindow class, which sets up the main window. DisplayFigureComponent displays the puzzle (solution) worked on, and EditableFigureComponent is the main puzzle workspace.
Figure 13 - calc packagecalc takes care of the most complex code: playing piece handling and calculations for solution checking. CalcPiece is the parent class for playing piece classes. CalcPieceT is the trapezoid, CalcPieceMT is the Medium Triangle, CalcPieceGT is the Large Triangle, CalcPiecePT is the Small Triangle, and CalcPieceC is the Square. CalcPolyPoints handles most of the calculations regarding playing pieces.
The Package Dependencies diagram gives a higher level view of the jTans source. This shows how the class diagrams above are related.