Links to my final project:
Code: https://glitch.com/edit/#!/wentao-final-game
Site: player: https://wentao-final-game.glitch.me
host: https://wentao-final-game.glitch.me/host/
Presentation slide: https://docs.google.com/presentation/d/1mS7ja9S7THymeDbdkVV4OLB1vaAkA-9SB1xMJyPg2jA/edit#slide=id.p
My final project is a multi-player game. For each player, there will be four questions with three options each. The players will earn or lose points when choosing different options. The questions and options are designed based on game theory. (Game theory studies interactive decision-making, where the outcome for each participant or “player” depends on the actions of all.)
Here are the steps I took to complete this project:
Step 1: I did some research on game theory and designed several questions and options.
Step 2: I referred to the trivia example and made the function of showing the questions and options to the players. I created two namespaces, one for the host to push questions, and one for the players to receive questions and options.
Step 3: I added the first receive result function. All the players’ choices will be sent to the server then emit to the host namespace. After clicking on the show result button, the host can see a long list of {player name, question number, option number}. The player could not see their final points.
Step 4: I added a data visualization function using the d3 client side library. This data visualization aims to show the number of players choosing each options. Based on the data received in the last step, I used for loops to count the number of players choosing options and put the data into an array. Then I used d3 to created four circle, each circle represent a question.
Step 5: The greatest challenge of this project was to calculate the points for each player. The four questions all have different rules for adding and losing points, I had to write different point counting functions for each option. After getting the result of all the players on the host namespace, I added another function that would push the result to the player side and show if a player wins or loses. I also made other modifications based on the user testing feedbacks. I added an introduction page for the player to get a better idea of this game. I altered the language use in the questions and options to make them easy to understand. I also added a timer for the users to keep track of the time.
Further development:
- Use the timer to control the question changing, instead of pushing each question manually.
- Add a waiting room, let players know how many players are joining the game and start the game when all the players are ready.
- Design more question for this game.
- Maybe add a communicating function so that players can communicate with each other while making decisions.
This is the result I record from the final presentation testing: