The Black Key Guild
“Your word is negotiated. Pacts are kept.”
- Forest green, parchment, wax seals and brass
- Cinzel + Libre Baskerville type
- Pacts with two wax seals, “CONFIDENTIAL” orders
- The ship is a ship; the rain is rain






A barter party game for phones. Local, free and open source.
“Your word is negotiated. Pacts are kept.”
The two worlds of the same game, with original music. Press play.
Trailer music made with Suno (paid plan).
A barter game for phones, made for a room full of people shouting offers. One PC runs a tiny server, the TV shows a QR code, and everyone joins from their phone browser over the WiFi. No apps, no accounts.
Scan the QR, type your name, and you get a bag of ingredients (4 + 3 + 2 of three types) and a secret order: forge an artifact that needs ingredients you do not have.
Type another player's 4-letter code. Each side builds an offer and both accept: TRATO HECHO (“deal done”). Any change breaks the acceptances. The swap is atomic on the server, so nobody can cheat the trade itself.
With everything in your bag, forge: you earn points (level 1 = 1, level 2 = 2, level 3+ = 3), get reward ingredients and a harder order. Lying about what you hold is allowed.








8 ingredients · 24 artifacts
While it is closed you can join and look at your bag, but not trade or forge. The judge panel opens the market, launches events and runs the game.
Rain gives 1 item to every active player. The ship shows a giant code on the TV for 90 seconds: the first 5 people to type it loot 3 items. Everyone runs to the TV.
They pop up on every phone and on the TV. They give no points. Three are social: trade with 5, 10 and 15 different people.
Mercado Negro was built in one night for a birthday party: about 30 teens who study game development, a home WiFi and a TV. It was built with Claude Code, and the art was generated with Codex (OpenAI image generation).
The plan was a calm, all-night mode: drops every so often, a running leaderboard, people chatting. In the end about 23 people played and what came out was 20 minutes of pure shouting.
The whole thing was streamed on Twitch.
“It felt like the closing bell on Wall Street.”
Every time a ship showed up on the TV, everyone ran to the screen. It was the best part of the night. Two things came out of it: a very interesting balance problem (below) and a plan for an online version.
Same logic, same economy, with their own texts, look, sounds and art. Each skin lives in its own folder and is played on its own.
“Your word is negotiated. Pacts are kept.”






“Your word is your firewall. Deals are kept.”











The live game was far more intense than planned, and something no simulation had shown appeared: two players ran away with it. Here is what we found.
The symptom. Two players forged again and again with their own rewards: about 5 forges per trade, against roughly 1 for most others (70 forges with 14 trades, vs 17 forges with 16 trades). They also traded mostly with each other.
The root cause, found by analyzing the saved game. Once a bag holds 6 or more ingredient types, the order generator stopped excluding what you already had, so new orders came out already covered. In simulation, 1 in 3 new orders could be forged instantly, almost all with a single trade.
Ships fed the leaders. Whoever was fastest and closest to the TV looted most of them, and the judge launching extra ships to help everyone else made it worse.
What it was NOT. Trading among the same pair was only 5–6% of trades; forcing partner diversity changed nothing.
A simulator replays a 20-minute game with 23 players and a ship every minute. 30 seeds per variant, about 12 variants tested. Metrics: forges per trade, the top-2 share of points, the Gini coefficient and who loots the ships.
MIN_FALTA = 2). If not, the quantity of the least abundant ingredient goes up.| Variant | Forges | Trades | Forges/trade | Top 2 % | Gini | Ship loots top 2 vs median |
|---|---|---|---|---|---|---|
| No fix (as played) | 253 | 169 | 1.50 | 28.9 | 0.44 | 15.7 vs 1.4 |
| Only: orders lack ≥ 2 | 169 | 170 | 1.00 | 17.3 | 0.27 | 14.5 vs 1.5 |
| Only: no ship twice in a row | 240 | 171 | 1.40 | 20.3 | 0.33 | 9.0 vs 3.9 |
| Both fixes (applied) | 170 | 168 | 1.01 | 15.8 | 0.24 | 8.9 vs 3.9 |
| Hidden: harder orders for leaders | 265 | 168 | 1.58 | 32.9 | 0.48 | 15.7 vs 1.1 |
| Mild hidden: ship loot 4→2 items by rank | 219 | 170 | 1.29 | 24.7 | 0.39 | 15.9 vs 1.1 |
| Ship loot never fits your own order | 215 | 168 | 1.28 | 26.0 | 0.39 | 15.3 vs 1.7 |
Simulation of 20 min, 23 players, one ship per minute, average of 30 seeds. Lower “Forges/trade”, “Top 2 %” and “Gini” = more even. “Ship loots” = how many ships the top 2 loot vs. a median player (out of 100).
MIN_FALTA = 1 is the knob.The simulator ships in the repo: dnd/tools/sim-balance/. Run node run-all.js i5 30.
You need Node.js 18 or newer on the PC that will host. Phones only need a browser and the same WiFi.
or with git:
git clone https://github.com/m4cgregor/mercado-negro.gitcd mercado-negro/dnd
npm install
npm startcd mercado-negro/cyber
npm install
npm startdnd or cyber./), TV (/tv) and judge (/juez?key=…). The judge key is generated on first run into clave-juez.txt, or set it with ADMIN_KEY./tv on the TV or projector and press “Activar sonido” (browsers require a click before playing audio).PORT variable. Do not run both skins on the same port at once.partida.json; “Nueva partida” in the judge panel resets it.ROADMAP · NOT IMPLEMENTED
Today you need a PC hosting on the same network. The idea is a Jackbox-style party game: rooms with a code, the TV in any browser and nobody hosting. It does not exist yet; this is the plan.
Cloudflare Durable Objects or PartyKit: one object per room, WebSockets instead of polling, timers via alarms. The server.js logic (in-memory state, atomic actions) ports almost 1:1. Static assets on Pages/CDN.
One codebase; the skin (D&D, Cyber, whatever comes next) is chosen when creating the room: texts in JSON, a CSS theme and a batch of art.
Viewers play: trade by Twitch username, chat votes the next event (🚢 Ship, 🌧️ Rain, 📈 Gold rush, 🚫 Embargo, ⚡ Happy hour, 🎲 Wandering merchant) and the overlay is the TV view. Watch out for stream delay and code sniping.
Designed fake breaches with small rewards, while the real backend stays hardened. People who open DevTools find a game, not a vulnerability.
Rough cost: on the order of USD 5/month on Cloudflare Workers Paid (the free plan is enough for the MVP).
Read the full plan (ONLINE.md)
Contributions welcome. If you want to build it, port the logic, make a new skin (pirates, western, space…) or test the balance, open an issue or a pull request.
The source code is published under the MIT license. Use it, modify it, share it.
The images and the trailer music (made with Suno) are published under Creative Commons Attribution 4.0. You may reuse them with credit to m4cgregor.
The illustrations (artifacts, icons, backgrounds) were generated with AI image generation tools (Codex, by OpenAI) from prompts written by the author. Game sounds are synthesized in the browser with WebAudio.
The logic, the interfaces, the simulator and this website were developed with Claude Code, by Anthropic.