This is the backend (a Docker stack) for the "Beat the Buzz" game created by Valtech for IAAPA 2022.
Feel your turn and slap the station as fast as you can before the buzz ends! Six players play from a podium console where they interpret signals to know when it is their turn to score as much as possible before the turn ends. If players score past their turn, they benefit the other player whose turn it is
Each player approaches a podium station and uses an RFID card to check into one of six stations. Each station has a feedback device to indicate their turn and a scoring button. Both devices as well as lights and other elements are connected to local hardware, which is in turn connected to show control.
The physical game elements are controlled by a central show control server, which is responsible for:
- Keeping track of the game modes: Loading, Playing, Idle, etc.
- Controlling sounds, lights, etc.
- Sending UDP signals to a game server.
In addition, a backend game server (this stack) is keeping track of player game state and a leaderboard.
Finally, a UNITY application monitors a message bus for game state changes and updates the game UI accordingly.
This project represents the backend game server component.
- A rules engine service that receives signals from the game show control system (implementing our Open-Source project Rule Harvester)
- A RabbitMQ message bus used to send signals to the game UI implemented in Unity.
- A MongoDB database to keep player state.
-
(OPTIONAL if you want to run tools locally) Yarn
ℹ️ NOTE: For Mac, if you installed Node via NVM and NVM via HomeBrew,
corepack
may not be installed for you automatically. You would then need to install it first before enabling it.
ℹ️ Note: The first time you run the project, it will take a while to download the images and build the containers. Subsequent runs will be much faster.
- Edit docker-compose.yml, scroll to the "rules-engine" service:
- change the
NODE_ENV
environment variable toproduction
. - Uncomment the line for the "Production Command".
- change the
- In Terminal, go to local directory root folder for the project.
- Run
docker compose up -d
to start the stack.
ℹ️ Note: In PROD mode, if you make code changes to the server stack code, you'll need to restart the docker stack.
- Edit docker-compose.yml, scroll to the "rules-engine" service:
- change the
NODE_ENV
environment variable todev
. - Uncomment the line for the "Dev Command".
- change the
- In Terminal, go to local directory root folder for the project.
- Run
docker compose up -d
to start the stack.
ℹ️ Note: In DEV mode, if you make code changes to the server stack code, nodemon will automatically restart the server.
With the server running, you can send UDP signals.
The rules-engine service includes a control console that can be used to run various tools. To run the control console:
$ ./docker-compose-run-control-console.sh
Once the console is running, you can pick from the following actions:
- Exit - to exit the console.
- Run a simulated game with generated data (random players)
- Display the Game Screen UI (shows game status as a game runs)
- Display the Leaderboard UI (shows leaderboard messages when received)
- Force a publishing of the current daily leaderboard
The rules-engine tools (in the simulator folder) allow you to send simulated signals to the stack and to display game information. This is useful for testing the stack and the rules engine or for seeing the status of a running game.
The tools can be run as follows:
$ ./docker-compose-run.sh simulator <yarn command>
See the YARN commands in the file simulator/package.json
for the available commands.
The process is:
- Copy the data file to the
mongoimport
folder. Be sure to use the structure of the provided example-import.csv - Run the
mongoimport
command (below). - Verify the data was imported correctly.
./docker-compose-mongoimport.sh <file name>
Notes:
- The
mongoimport
command will fail if the file is not in the./mongodb/mongoimport
folder.- The import will do an UPSERT, so if you run the command again, it will update the existing records based on the rfid field.
The process is...
-
Open
rules-engine/src/conc/excluded_players.ts
-
It should be a valid JSON array like the below
export default [ 'Player_123', 'Player_321' ]
-
Save the file
-
Restart the rules engine container:
docker compose restart rules-engine
- Download all needed tools from listed software requirements above.
- Clone the repository from GitHub.
- Open project files in any editor to update and save.
- Depending on the files changed, you might need to restart the server stack.
git status
to check file changed.git restore {file}
to unstage files that should not be commited.git add {file}
to stage files that should be commited.git commit -m "{change info}"
to commit the files.git push
to push changes to GitHub.
Alternatively, use a GUI tool like GitHub Desktop or Sourcetree to push changes to GitHub.
Game Design Jenny Lim, Erica McCay
Backend Development Daniel Morris, Le Cabrera, Eric Soto
Unity Development Natan Couture-Dumais, Le Cabrera
Project Leadership Victoria Gonzalez, Eric Soto
Game Show Control Joe Fox, Chris Large
- Add section on turning on logging (and describe the message_logs directory)
- Explain the examples in simulator/examples
- Add the data contract documentation for the UDP messages to be received
- Explain how different UDP messages control different parts of the game backend
- Add the data contract documentation for the RabbitMQ messages to be sent for the UI