Technology - relaysketchgame/relaysketch GitHub Wiki
Used technology for implementation
* Store and send pictures():
The game is started, the “wait” picture is displayed until the picture drawn by the person in front comes. The client draws a picture and stores it in client_paint.png. Client send the picture that he/she drawn to the server and the server stored in server_get.png. Pass the picture named server_get.png to the client and stores named as client_get.png. The client draws a picture while seeing client_get.png. the drawing is saved as an update in client_paint.png.
* Paint():
Paint has six functions. There are thickness, eraser, pencil, all clean, color selection and send the picture. THICKNESS is in menu using JMenu and there are four thicknesses which is 2, 4, 6 and 10. ERASER is a function to erase a picture and PENCIL is a function to draw a picture. ALL CLEAN erases all pictures that you drawn using reset. Color is a function to select the desired color. It is made using JColorChooser. When client press the save button, the drawing is saved in the client’s file.
* Timer():
The time given to each team to play a game is 100 seconds. Team A and team B play the same game for 100 seconds. For 100 seconds, the first user of each team draws a picture seeing the given word, second user sees the pictures drawn by the front person and draws and the last user guess the word.
* GUI swing():
In the login window, buttons are visible when information is entered. The panels are made using images. If the chat window is beyond the visible portion of the screen, set all chats to be visible with JScrollPane and setLineWrap. In addition, we also implemented right GUI for each situation.
* Restart():
When the game is over after 100 seconds, ask all clients whether to restart the game. The client responds by pressing the “YES” or “NO” button. If clients answer “No”, the game doen’t restart. All the clients response “YES”, the game would be restart.
* Namelist update():
There are two hash map. One is for team A and the other is for team B. Whenever a user enter, insert the user’s name into a user team’s hash map. When the user out, the name of the user in the hash map is deleted. Thus, the name in the hash map immediately update the current user’s input and output.
* Distinguish correct answer():
Provide a popup panel to the last person on each team to answer the word. When the client writes the answer to the pop-up, it sends to the server and confirms that it matches with the given word. If the client matches the answer, the panel pops up with “The answer is correct!”. If the client doesn’t match the answer, the panel pops up with the correct answer.
* Score():
If the client says the answer and the answer is correct, give a one point. The server updates the scores for all users on each team using PrintWriter.
* Result():
Compares the scores obtained by each team, showing the “WIN” panel to the winning team, and the “LOSE” panel to the losing team. If two teams are drawn, show “DRAW” panel to all clients.