BP2019 Jupiter Hall Pong Exhibit
Many game and display parameters can be set by modifying
First Time Installation
Here's a demo installation video:
Prerequisites to install
Note: these instructions presume you are using a Unix-y system like Linux or MacOS. These instructions are tested on MacOS Mojave. You CAN run on Windows 10 WSL or via Scoop, but the serial port commands currently don't work.
You will need to have NodeJS and Git installed. To program the Arduino board, you'll need the Arduino IDE but the client/server will run without connected hardware.
Get the Repo:
- open a terminal window
- cd to the folder you want to store the repo
git clone email@example.com:daveseah/bp2019-pong.git
Configure the web client software:
- if you are using nvm, type
Run the Game Server
If you have functioning hardware, you can change the source code to match your Arduino configuration. The game server will gracefully fail if no hardware is detected. The following instructions assume you have working hardware.
Program your Arduino with the contents of
arduino/serial-encoder with the Arduino IDE if you haven't already, then modify the server code:
- Make sure you are in the
- In the terminal,
npm run list:portsto see the list of available serial ports (note: this code does not work on Windows using either WSL or Scoop)
- Find the serial port path for your arduino board and copy it to the clipboard.
CONFIGsection at top, adding
COM2paths to your serial ports.
Now to run the SERVER itself:
- Open terminal window, and make sure you are in the
npm run server
- You will see some text appear describing what the server is doing. If you have compatible hardware plugged into the USB port and you have configured
server/serial.js, you should see a successful connection message.
- Next you will run the Game Client to see if the data is being received
Run the Game Client
Open a SECOND TERMINAL WINDOW, then:
- Make sure you are in the
npm run client
- Open Chrome and browse to
- Twiddle the encoder knob to see if the paddle moves
- Click on the play field to enable sound (this is a browser-enforced requirement)
The game runs in an attract mode, AI players that take turns beating each other. If an Arduino paddle controller is moved, however, it will take over the player. When a player reachers 9 points, the game is over and the player reverts to AI control unless the Arduino paddle is again moved.
- To enter FULL SCREEN MODE, go to the Chrome browser's VIEW MENU and disable Always Show Toolbar and Always Show Bookmarks, then choose Full Screen Mode. The MacOS shortcut for full screen mode is
- You can change the screen size by editing
game/constants.jsand adjusting the WIDTH and HEIGHT. The game board and elements sizes are defined relative to WIDTH and HEIGHT.