Retrobot is a Discord bot that allows you to play NES/SNES/GB/GBA games with your friends over chat! Think "TwitchPlaysPokemon", but with GIFs. It accepts button presses, emulates the result, and encodes a GIF to view.
Once the bot has joined your Discord server, drop an ROM file into a channel. You can also use ZIP
, TAR.GZ
, TAR.BZ2
, or BZ2
archives. The bot will automatically find the ROM file, and begin emulation. Note: only server "administrators" can start new games.
Retrobot simplifies control by auto-forwarding through idle parts of games, such as conversations or battle animations.
Additionally, numbered buttons are added to automatically repeat button presses. This is useful for walking in a specific direction for a long period.
You can configure how input assist works, how often input assist activates, and how directional button presses are repeated with the /settings
command.
Create a bot in the Discord Developer Portal, and obtain a token for your bot. Also, ensure "Message Content Intent" is enabled for your bot.
Create a file name exactly .env
in your clone of this repository with the following contents:
DISCORD_TOKEN=YOUR DISCORD TOKEN HERE
Run these commands:
yarn install
yarn start
Then invite the bot to a server with the following URL. Be sure to update the OAuth Client ID.
https://discord.com/api/oauth2/authorize?client_id=YOUR_OAUTH_CLIENT_ID_HERE&permissions=68608&scope=bot
There are additional configuration options you can to your .env
file to tweak performance:
By default, Retrobot will create a worker thread for each CPU core on the host system. These workers are use parrallelize multiple games, and to split the work for input assist detection. If you're low on RAM, tweaking this number to something small (i.e., 2
) will reduce memory usage at the cost of total emulation time.
By default, Retrobot will use 3 input assist worker threads to emulate the result of a button press for a game. Raising this number for faster systems will speed up input assist for games with lots of uninterupptable scenes (conversations, cinematics, etc). Raising this number above MAX_WORKERS
does not have an effect.
By default, Retrobot will encode GIFs at max of 30 FPS. You can configure this to be between 1 and 60 FPS.
DISCORD_TOKEN=YOUR DISCORD TOKEN HERE
MAX_WORKERS=2
RECORDING_FRAMERATE=60
If you'd like a simple way to run the bot as a background service, there's a helper yarn
script. It will fire up the bot as a background service, and record logs to ./forever/retrobot.log
yarn service:start
And to stop:
yarn service:stop
Create a file name exactly .env
in your clone of this repository with the following contents:
DISCORD_TOKEN=YOUR DISCORD TOKEN HERE
Run the official Docker image:
docker run -d -v ./data:/retrobot/data --env-file .env rossimo/retrobot
Requires Docker and Docker Compose is installed on the machine.
- Rename
docker-compose.yml.example
todocker-compose.yml
- Edit
docker-compose.yml
and your Discord bot token. - Run
docker-compose build
- Run
docker-compose up -d
Retrobot is built on libretro
, the code that powers RetroArch. Several libretro
cores have been cross-compiled to WASM to be used in Node.js. Since WASM modules have independent memory spaces, it means several cores of the same type can be instanced. This allows parallelism.
The bot source code here is licensed as MIT. The libretro
core each have their own licenses.