Git Product home page Git Product logo

cs494-lab-1's Introduction

How to run the game

  • Clone this repository with the "Open with GitHub Desktop" or any other clone option suitable for you.
  • Open the project folder. I use Visual Studio Code IDE with Code Runner installed to make things easier.
  • Install Node.js. To check if you have installed Node.js successfully, go to Command Prompt and type node. This should be shown:
Welcome to Node.js v20.12.0.
Type ".help" for more information.
  • The folder node_modules and the files packages.json and packages-lock.json already has all the libraries you need. However, if for some reason it does not run correctly on your computer (maybe because it's outdated), do the following (no need to do these if it runs normally):
    • Delete the folder node_modules and the files packages.json and packages-lock.json.
    • Open Command Prompt in the root directory (must be the correct location, this contains the folder public and the file server.js).
    • In the Command Prompt, install Express.js and Socket.IO using the following command: npm install express socket.io. Express.js is used to create the HTTP server and serve static files (like HTML, CSS, and JavaScript), while Socket.IO is used for real-time communication between the server and clients.
  • If using Visual Studio Code with Code Runner extension, run server.js in the project. If not, open Command Prompt in the root directory and type node server.js. This should be displayed:
Server is running on port 3000
  • Find your IP address. Go to Command Prompt and type ipconfig, find the IPv4 Address. It looks like this:
Wireless LAN adapter Wi-Fi:
   Connection-specific DNS Suffix  . : itotolink.net
   IPv4 Address. . . . . . . . . . . : XXX.XXX.X.X
   Subnet Mask . . . . . . . . . . . : XXX.XXX.XXX.X
   Default Gateway . . . . . . . . . : XXX.XXX.X.X
  • Although the design of the web app is in index.html, if you go there, the game will not work. Instead, you have to go to the website of the following form (using any web browser, works on both PC and smartphones in the same local network): XXX.XXX.X.X:3000, with XXX.XXX.X.X being your IP address.
  • The host must keep their device and server running during the duration of the game. Other players in the same local network may access the game with their own PC or smartphone, using the exact same link as the host, but they are only allowed to join the game if no one has not started the game yet.

Game rules - project requirements

  • Each player has to enter a username to register. Their username must be 1-10 characters and consists of only the following characters: [A-Za-z0-9_]. Player usernames must be unique. Clicks on the "Submit" button to register, if successful, you will see the message "Registration completed successfully". Maximum number of players allowed to register is 10.
  • If there are at least 2 players, any registered player may click the "Start Game" button to start the game.
  • After a few seconds, an expression question is displayed on screen and players must enter the correct answer and submit it as fast as possible. Press "Enter" button or an equivalent button on mobile devices to lock in your answer.
  • Players answer incorrectly or fail to answer lose 1 point and get 1 strike. Players answer correctly, but not in the fastest time, receive 1 point and have their strikes cleared. Players answer correctly in the fastest time have their strikes cleared and receive 1 point, plus 1 point per player who got that question wrong.
  • Players who answer three consecutive questions incorrectly are out of the game, but they can still spectate and see the questions.
  • The game ends when:
    • All players are eliminated (no one wins)
    • All but one player are eliminated (last player standing wins)
    • First player to reach 25 points wins (if multiple players reach the goal in the same turn, only the highest scorer wins; if multiple players have the same highest score, they all win)
  • We were unable to program requirement #5 (server starts another set) in time. To restart the game, players must ask the host to restart the server.

cs494-lab-1's People

Contributors

random0617 avatar locopaly avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.