Interactive Plinko game driven by Twitch chat comments.
Plinko is easily the best game played on American daytime pricing game show The Price is Right. Have a look: Plinko on the Price is Right
This application is built on these key libraries:
- Matter.js is used for the rigid body physics and gravity simulation.
- p5.js is used for display and animation.
- Twitch Messaging Interface (tmi) is used for receiving chat input from Twitch.
- socket.io is used for relaying Twitch chat meassages to the browser in real-time using websockets.
Streams of Twitch Plinko will appear on my twitch channel. By all means, feel free to raid the channel, haha.
- Clone the repo:
git clone git@github.com:waterjump/twitch-plinko.git
- Navigate to the directory you clone the code into:
cd twitch-plinko
- Install npm packages:
npm install
- Add necessary environment variables. These are needed to connect to the tmi.
export BOT_USERNAME=<your twitch user (or bot user) here>
export OAUTH_TOKEN=<the OAuth token provided by Twitch>
export CHANNEL_NAME=<the name of the channel you will stream to>
NOTE: You can get a Twitch OAuth token here.
- Start the server:
npm start
. - Visit the page running plinko in a browser:
http://localhost:8081
. - Drop a chip. There are two ways to drop a chip:
- Make a comment of a slot number on the Twitch chat you are connected to:
1
,2
,3
, etc. up through9
. - On the page running the game, pressing keys 1 through 9 will drop a chip in the respective slot as a dummy user.
- In the page running the game, pressing the
n
key will reset the game, starting a new round.
- Dan Shiffman for his great Express/p5/websockets tutorials.
- Deha for helping me QA and giving me some insights to Twitch features. Give him a follow!