Games

Janken - Twitch Chat Game

Download
Documentation for the Janken Twitch game.

Introduction

Description

The Janken chat game is a rock-paper-scissors game that your chat viewers can play either via command or through channel point rewards.

Once the challenge is launched and accepted, players must choose a game mode to define the number of points needed to win the match. The game comes pre-configured with 3 modes:

  • Sudden Death (first to win one point wins)
  • Best of 3 (first player to 3 points wins)
  • Best of 5 (first player to 5 points wins)

Once the game has started, players must send a Twitch whisper to the broadcaster's bot account with their choice for that round (rock, paper or scissors).

During the game, the bot will send messages in the stream chat to notify everyone of the game's progress, winners and scores.

At the end of the game, points are awarded to each player. If an achievement has been unlocked, the player will also be notified directly in the Twitch chat.

Planned Updates

  • Game interface for overlay
  • Viewer leaderboard
  • Graphical design improvements

Installation and Configuration

Prerequisites

To install this game on your stream, you need the following tools:

  • Streamer.bot v1.0 or higher
  • OBS Studio
  • A Twitch bot account

Import the actions into Streamer.bot.

Streamer.bot disables imported commands by default. Re-enable the following commands:
  • !janken (if you want to trigger games with the command, otherwise use only the channel point reward)
  • !jankenAchievements to receive the list of unlocked achievements in chat
  • resetJanken to reset the game

Start the WebSocket server

  • Servers > WebSocket Server > Start
The widget uses the SendMessage() request which requires authentication to work! If you don't want to authenticate, the widget will use the Send Achievements action as a fallback.

Connect your bot account to Streamer.bot

The bot account is used to receive messages outside of Twitch chat, to prevent players from knowing what the other player has sent. It is also used to send notification messages throughout the game.

Create a new Twitch channel point reward (optional)

If you want your viewers to trigger a new game with channel point rewards.

  • Create your new reward with the parameters you want.
  • Click on the 1.0 Setup - Initiate Game action
  • Double-click on the Reward Redemption trigger and choose your new reward.

Open the configuration interface

  • Open the janken-achievements-editor.html file in your browser.
  • Click on "Load File".
  • Navigate to the JSON file included in the widget folder and select it.

Fill in your WebSocket connection information

  • Click on the Settings tab.
  • In WebSocket settings, enter your WebSocket connection information.
If you have changed the command name, actions or filename, you must update this information on this page

Customise the achievements

  • Click on the Achievements tab
  • Modify the achievement texts
  • Add/Remove rows as you wish.
The "threshold" column evaluates the value of the global variable received via Streamer.bot and triggers the achievement when the values are equal. More options will be included in a future update.

Customise the messages

Achievement messages

  • Click on the Messages tab
  • Edit the value of messages sent by the widget. Available variables are listed for each field.

Game messages Game messages are customisable in the Streamer.bot actions. Each action has Set Bot Messages folders that include the arguments used in the action for messages. Open the actions one after another and edit the arguments in these folders.

Save your new configuration

  • Click "Save" at the top of the page.
  • Overwrite the old configuration file with yours.

Add a new browser source to OBS

  • Add a new browser source to OBS.
  • Enter the path to the janken-achievements-widget.html file with the absolute protocol like this: http://absolute/C:/your/path/to/janken-achievements-widget.html
  • Dimensions don't matter: this source is not visible, it acts as a backend.
  • Make sure the source remains active throughout your stream or it won't be able to communicate with Streamer.bot.
If you don't enter the file path with the absolute protocol, there will be errors!

That's it. You can test a new game to confirm that everything works as expected.


Available Commands & Controls

All game controls are done via commands sent in Twitch chat except for the rock, paper and scissors commands which are sent via private message to the bot account connected in Streamer.bot. You can see here the complete list of configured commands.

These commands are accessible at specific moments when launching a game.

CommandDescriptionAvailability
!janken [username]Challenge a viewer to Janken (optional)Between games
!acceptJankenThe challenged player accepts the Janken gameAfter a viewer has started a game
!refuseJankenThe challenged player refuses the Janken gameAfter a viewer has started a game
!modeMode choice for the game by player 1 or 2After a player has accepted a Janken game

Integrated Scoring and Achievement System

The game includes a customisable scoring and achievement system via the interface provided in the widget. You will find here the information for the default configuration.

Player Scores

Throughout the game, scores are recorded for viewers in user global variables. The following points are tracked:

  • Number of games
  • Number of victories
  • Number of lost games
  • Number of abandoned games
  • Number of uses of rock / paper / scissors

Unlockable Achievements

The game is pre-configured with 20 unlockable achievements for viewers based on points accumulated during games. Achievements are of course customisable, you can add and modify whatever you want!

AchievementMessageGroupVariableCondition
Played 10 gamesJanken Novice.Achievement - Janken 10 GamesjankenGamesWhen jankenGames equals 10
Played 25 gamesJanken Regular.Achievement - Janken 25 GamesjankenGamesWhen jankenGames equals 25
Played 50 gamesJanken Pro Player.Achievement - Janken 50 GamesjankenGamesWhen jankenGames equals 50
Played 100 gamesJanken Addict.Achievement - Janken 100 GamesjankenGamesWhen jankenGames equals 100

Troubleshooting

The widget won't connect

  • Check that the WebSocket server is started
  • If you're using authentication, confirm that your password is correct in the editor, and that you've saved your configuration.
  • Confirm that the .json file is present in the folder and that its name matches the one in the editor.
  • Check that the URL was entered correctly in the OBS browser source preceded by http://absolute/.

Achievements aren't unlocking

  • Check that the OBS source is active during your stream.
  • Confirm that the configured variables are correct in the editor and that you've saved your configuration.