# Renderoo, for AI agents

Renderoo is a free Discord bot by Quarterturn that draws Minecraft builds. Send it a `.litematic`,
`.schem` or `.nbt` file and it replies with a picture made from the game's own block textures,
lit like a shader pack, with buttons to turn it, zoom in and count every block.

- Website: https://renderoo.qturn.dev/
- This page as HTML: https://renderoo.qturn.dev/agents
- Short index: https://renderoo.qturn.dev/llms.txt

## Set it up

Renderoo runs as a hosted bot. Setting it up means adding it to a Discord server; there is no
API key, account or install.

1. Open the invite link while signed in to Discord as someone with **Manage Server** on the server:
   https://discord.com/oauth2/authorize?client_id=1556078318548164668&scope=bot+applications.commands&permissions=117760
2. Pick the server and approve.
3. In any channel the bot can see, type `/render` and attach a build file.

Permissions asked for (`117760`): View Channels, Send Messages, Embed Links, Attach Files, Read
Message History. It asks for no privileged intents and never reads ordinary messages: it only
answers its own slash commands and buttons.

## Commands

| Command | What it does |
| --- | --- |
| `/render file:` or `/render id:` | Draws the build. Buttons: **← →** turn it a quarter, **🔍 🔎** zoom in up to 4x, **☀️ Shaders** switches the lighting off for the game's plain look, **Material List** counts it. |
| `/materials file:` or `/materials id:` | Every block in the build, the most used first, in stacks and shulkers, with the whole list as `.txt` and `.csv`. No picture, so it takes builds of any size. |
| `/craft result:` | An item's recipe drawn on a crafting table, e.g. `result: iron_axe`. Fill `item1` to `item9` (row by row, empty is air) to draw your own grid. |
| `/help` | What it does and how to use it. |
| `/invite` | A button to add Renderoo to another server. |

## Files and limits

| | |
| --- | --- |
| Formats | Litematica `.litematic` (every region), Sponge `.schem`, vanilla structure `.nbt` |
| File size | Up to 8 MB |
| Render size | Up to 8,000,000 blocks of space (width × height × length). `/materials` takes any size. |
| Buttons | A render stays turnable and zoomable for 30 minutes |
| `id:` | A build sent from the Spawner Sync website's **Send to Discord**, by its id or page link, for a week after it was sent |

Each upload is read in a process of its own (unzipped with a 128 MB cap, a 2 GB heap, stopped
after 60 seconds, two at once and sixteen waiting), so a broken or hostile file can only stop its
own read, never the bot.

## Running your own copy

The source is private for now. With access to `Joystiick/renderoo`, on Node 18 or newer:

```
git clone https://github.com/Joystiick/renderoo
cd renderoo
npm install
cp .env.example .env    # TOKEN and CLIENT_ID from the Discord developer portal; SITE_URL for /render id:
npm start
npm test
```

## Under the hood

Measured from the code, not estimated.

| | |
| --- | --- |
| Language | Plain JavaScript (Node 18+, ES modules). No TypeScript, no build step. |
| Code | 32 files, 4,064 lines: 22 files (2,943 lines) of bot and renderer, 10 files (1,121 lines) of tests |
| Renderer and file reader | 8 files, 1,749 lines (render.js 655, schematic.js 350, nbt.js 298, models.js 182, shapes.js 83, textures.js 82, png.js 57, kinds.js 42) |
| How it draws | A software rasteriser on the CPU, written for Renderoo. No GPU, no canvas, no image library. The PNG is written by hand; Node's built-in zlib does the compression. |
| Lighting | Sunlight traced through the block grid for soft shadows, a sky, and a filmic colour grade |
| Runtime dependencies | 2: discord.js (Discord), dotenv (settings) |
| Third-party code in the renderer | None. The NBT reader (nbt.js) is our own too. |
| Game assets | Taken from the Minecraft client (data version 5023): 3,022 blocks, 794 with block states, 2,102 models, 3,090 distinct 16×16 textures |
| Recipes | Every crafting table recipe, from the same client |
| Tests | 10 test files, plain `assert`, run by `npm test` |

Speed has not been benchmarked against other renderers, so Renderoo makes no claim about being
faster than any of them.

Renderoo is not affiliated with Mojang or Microsoft. Minecraft's textures and models belong to
Mojang.
