GitHub - chad/ascii-royale: Terminal battle royale — p2p over iroh, no central server. Play instantly: ssh -p 48958 play@royale.boxd.sh · or play.royale.boxd.sh · or 'ascii-royale play'.

11 min read Original article ↗

A battle royale you play in your terminal. Pure text, peer-to-peer over iroh — no game server, no accounts, one binary.

▶ Play right now

ssh -p 48958 play@royale.boxd.sh

That's it — no install, no account. Pick a call sign and you're dropping onto the island with whoever's online. (Blank password — just press Enter. Prefer a browser? play.royale.boxd.sh.)

Up to 16 combatants drop onto a procedurally generated ASCII island. Scavenge weapons, dodge bullets you can actually see coming, and outrun the storm. Last one standing wins. Bots fill empty slots, so it's playable solo too.

gameplay — a full bot match from drop to victory royale

An actual match (sped up ~2x): the drop and first loot, a mid-game scrap, and the finale as the storm swallows the island. Rendered headlessly through the real game code — see examples/capture_gif.rs.

Static frame, for the full glyph detail
┌ the island ────────────────────────────────────────────────────────────┐┌ status ────────────────┐
│.........................................o........~~~~~~~~..........~~~~││alive 8   kills 2       │
│.........................................o........~~~~~~~~~.........~~~~││                        │
│.........................................oo.......~~~~~~~~~........~~~~~││HP  ########------  64  │
│..........................................o.......~~~~~~~~~~......~~~~~~││ARM ####----------  31  │
│..........................................o........~~~~~~~~~~~....~~~~~~││                        │
│..........................................o........~~~~~~~~~~~...~~~~~~~││Rifle  ammo 23          │
│......................................####oo########..~~~..~~~~~.~~~~~~~││trigger ....  aim v     │
│......................................#,,,,o,,,,,,,#.........~~~~~~~~~~~││medkits 0  [h]          │
│...........=.............)...........]#,,,)o,,,,,,,#.........~~~~...~~~~││                        │
│........###,###.......................#,,,)oo,,,,,,#..........~~~~.~~~~~││storm holds 9s          │
│........#),+,,#.......................#,,,),o,,,,,,#...........~~~~~~~~~││                        │
│....+...#,,,,,#+......................#,,,,,o,,,,,,#...........~~~~~~~~~││-- feed --              │
│........#,,,,,#.......................#######)######...........~~~~~~~~~││Zone closing: 20s       │
│.....@..##,####...@..........................o...................~~~~...││bot3 eliminated bot5    │
│.....|.......................................oo..................~~~....││(Shotgun)               │
│.....|........................................o.........................││                        │
│.....|........................................oo........................││                        │
│.....|.......................+.................o........................││                        │
│...............................................oo.......................││                        │
│........................................T..T...To..T....................││                        │
│.........................................T....TTToTT....................││                        │
│:::::::::::::::::::::::::::::::::::::::::::::::::oo:::::::::::::::::::::││                        │
│::::::::::::::::::::::::::::::::::::::::::::::::::o:::::::::::::::::::::││                        │
│......................]................T........TToo....................││                        │
│........................................TTT......T.oo...................││                        │
│.............+.........................T............o...................││                        │
└────────────────────────────────────────────────────────────────────────┘└────────────────────────┘
             wasd/arrows move+aim · f / space fire · e / g pickup · h / m heal · q quit

A rifle tracer (|) streaking away from your @, an enemy @ closing in, loot scattered through a building, the o ring marking where the storm settles next, and water/forest/road terrain. In your terminal it's all in color, with 8-bit sound.

Features

  • One-command matchmakingascii-royale play drops you into the public arena with whoever's around; no ticket, no account. Or host your own and share a ticket. iroh handles NAT holepunching; connections are direct QUIC.
  • Dropship lobby — the match leaves on a countdown that shortens as more humans board; ready up to launch early; bots fill the empty seats so the island is always full. Nobody waits on a half-empty lobby.
  • Real projectiles — bullets fly cell by cell, leave tracer trails, and can be sidestepped. Walls and trees block shots; water blocks you.
  • Auto-aim that keeps the skill — fire snaps to the nearest enemy lined up with you in any direction. Getting lined up (and not being lined up) is the game.
  • The storm — a shrinking circle through 7 escalating phases, with the next safe ring drawn on the map.
  • Six weapons, grenades, and airdrops — throwables that burst for area damage, plus periodic supply crates that drop a full loadout into the zone and make a hotspot worth fighting over.
  • Juice — explosions and death bursts, hit sparks, screen-shake when you take fire, multi-kill callouts, a live minimap, and spectate-your-killer after you go down.
  • Bots with a survival brain (flee storm > fight > loot > wander), so a lobby of two is still a match of sixteen.
  • Procedural 8-bit sound — synthesized square-wave chiptune effects, no audio files. Mute with M. Silent automatically over SSH.
  • Persistent identity — pick a call sign and a hex-color skin; it renders on the map, minimap, and roster, and sticks across sessions (a profile dotfile locally, localStorage for browser players).
  • Rebindable keys with a built-in config screen, saved to a dotfile.
  • Fog of war for free — snapshots only contain what's near you (~1 KB, 10/sec), so it's light enough to play over a phone hotspot.

Install

Needs Rust 1.91+.

git clone https://github.com/chad/ascii-royale
cd ascii-royale
cargo install --path .

(or cargo build --release and grab target/release/ascii-royale)

Play

Over SSH — nothing to install, no account:

ssh -p 48958 play@royale.boxd.sh

Pick a call sign and you're in. (If prompted for a password, just press Enter — it's blank.) On first connect SSH will ask you to trust the host key; it should be SHA256:MksQnpeWoT09c/zZGXGRDxNySe7wIoeWS1A542xxU/o.

In your browser — also nothing to install: open play.royale.boxd.sh (or the play in your browser button on royale.boxd.sh, which also has the live leaderboard). Pick a call sign and you're in the dropship.

From the terminal — one command, no ticket:

ascii-royale play       # drop straight into the public arena
ascii-royale browse     # or browse all open games and pick one

browse shows a live, decentralized list of open games discovered over an iroh-gossip topic (hosts advertise themselves; no central match registry) — arrow-keys to pick, or a to auto-join the best open one. Host your own discoverable game with ascii-royale host --announce.

It fetches the live arena ticket over HTTP and joins peer-to-peer. You land in the dropship: a countdown that shortens as more humans board, bots filling the empty seats. Hit r to ready up — when everyone aboard is ready, the drop leaves early. (The ticket fetch is the only thing that touches a server; the match itself is direct iroh p2p.)

Host a match — you play too; the lobby shows a ticket to share:

ascii-royale host                    # name defaults to $USER, 7 bots
ascii-royale host --bots 3 --name chad
┌ ascii-royale · lobby ────────────────────────────────────────────────┐
│                          _ _                        _                │
│            __ _ ___  ___(_|_)  _ __ ___  _   _  __ _| | ___          │
│           / _` / __|/ __| | | | '__/ _ \| | | |/ _` | |/ _ \         │
│          | (_| \__ \ (__| | | | | | (_) | |_| | (_| | |  __/         │
│           \__,_|___/\___|_|_| |_|  \___/ \__, |\__,_|_|\___|         │
│                                          |___/                       │
│                                                                      │
│                         ticket  abc123ticket                         │
│             friends join with: ascii-royale join <ticket>            │
│                                                                      │
│                            combatants (3)                            │
│                                 @ chad                               │
│                               @ wanderer                             │
│                                  @ kex                               │
│                                                                      │
│     [enter] drop in (bots fill empty slots) · [k] keys · [q] quit    │
└──────────────────────────────────────────────────────────────────────┘

Join a match:

ascii-royale join <ticket>

Play offline against bots:

ascii-royale solo --bots 9

Controls

key action
wasd / arrows move — this also sets your aim
f / space fire — auto-aims at the nearest lined-up enemy, else along your ^ v < > crosshair; pressing during cooldown fires the moment the weapon is ready
e / g pick up the item under you
h / m use a medkit (+40 HP)
t throw a grenade (arcs where you face, bursts with area damage)
M mute / unmute sound
n name & skin editor (in the lobby)
k key bindings screen (in the lobby)
r ready up in the dropship lobby (all ready → drop early)
Enter start the match (host, in lobby)
q / Esc quit

Rebinding keys

Press k in the lobby. Pick an action, press Enter, press the new key. Prefer sdfc to wasd? Bind each one — a key you assign is automatically stolen from whatever it used to do, and arrows always work as a fallback.

┌ key bindings (arrows always move) ───────┐
│                                          │
│  move up    w                            │
│> move down  s                            │
│  move left  a                            │
│  move right d                            │
│  fire       f / space                    │
│  pick up    e / g                        │
│  heal       h / m                        │
│  mute       M                            │
│                                          │
│up/down select · enter rebind · r reset · │
└──────────────────────────────────────────┘

Bindings persist in ~/.config/ascii-royale/keys.conf, a plain text file you can also edit by hand (fire = j space). r resets the defaults.

How to win

  • Get a gun first. You spawn with fists. Buildings (# boxes) hold most of the loot — walk onto a ) and press e. Guns come loaded; = ammo packs keep them fed. The sidebar points at the nearest gun while you're unarmed.
  • To hit someone they must share your row or column when you pull the trigger. Auto-aim picks the direction; your job is positioning.
  • Bullets draw tracers (- |) and a * where they land. You hear nearby impacts — louder means closer.
  • Loot: ) weapon · = ammo · + medkit · ] vest (absorbs half of each hit until it breaks).
  • The blue % wash is the storm: damage every half-second, ignores armor, escalates each phase. The o ring is the next safe circle.
  • Weapons, roughly: fists < pistol < shotgun < SMG < rifle < sniper. The sniper hits like a truck but fires once per 1.5 s; shotgun and sniper burn 2 ammo per shot.
  • Dying drops all your gear where you fall. Placement is decided the moment you die.

Run an arena

ascii-royale serve runs a headless arena: no local player, the dropship countdown starts when the first human boards, bots fill the seats, and the lobby reopens after every match. Players arriving mid-match are queued for the next island. Publish the ticket over HTTP so ascii-royale play can find it:

ascii-royale serve --bots 7 --http-port 8000 --ticket-file /run/royale/ticket

Put that behind any HTTPS reverse proxy (the reference arena uses a boxd VM, whose *.boxd.sh proxy serves the ticket at https://<vm>.boxd.sh/). Point play at it with --arena https://your-host/, or bake your host in as the default. Gameplay never touches the proxy — it's direct iroh p2p — so the proxy only ever serves a 64-character string.

Web front door (landing page, leaderboard, browser play)

--http-port serves a designed landing page at /, the join ticket at /ticket, and live arena state + leaderboard as JSON at /stats (the page polls it). --stats-file persists the per-call-sign leaderboard across restarts; --browser-play-url adds a "play in your browser" button.

ascii-royale serve --bots 7 --http-port 8000 \
  --ticket-file /run/royale/ticket \
  --stats-file /var/lib/royale/stats.json \
  --browser-play-url https://play.your-host/

Browser play itself is ttyd running ascii-royale play per visitor, exposed on its own subdomain (it speaks WebSocket, which sails through an HTTPS proxy). deploy/royale-ttyd.service

  • deploy/royale-web-launcher are the recipe. Leaderboard call signs aren't authenticated — it's a wall of fame, not a ranked ladder.

Optional: zero-install play over SSH

Pair the arena with a locked-down SSH guest account and anyone with a terminal can play with zero installationssh play@your-arena drops them straight into the name prompt. deploy/ has the complete recipe:

  • royale-launcher — forced command: pick a call sign, join, play again
  • royale-arena.service — systemd unit for the arena process
  • sshd-play.conf — guest user: no shell, no forwarding, empty password (with OpenSSH this even skips the password prompt entirely)
  • sshd-hardening.conf — everything else stays key-only

The host just needs a public TCP port pointed at the guest sshd. The reference arena runs on a boxd VM and exposes it with boxd expose royale 2222royale.boxd.sh:48958; a plain VPS works too. Tell players the host-key fingerprint so they can trust it on first connect.

How it works

host process                                   joiners
┌───────────────────────────────┐
│ authoritative sim @ 10 Hz     │   QUIC (iroh, holepunched)
│  inputs → move/fire/loot      │◄──── inputs ───────  terminal client
│  bullets, storm, bots, deaths │───── snapshots ───►  (ratatui)
│  + the host's own terminal    │
└───────────────────────────────┘

One player hosts; their process runs the only simulation. Clients send discrete inputs and receive personalized, visibility-filtered snapshots — which is also the fog of war. The host's own player goes through the same protocol over an in-process channel, so solo is just a host without a listener. The ticket is the host's iroh public key.

Honest caveat: there's no central game server, but iroh's default discovery and relay infrastructure (run by n0) is used to find and reach the host; traffic falls back to a relay only when holepunching fails. And the match dies if the host quits — host migration is on the wishlist.

Sound never touches the network: effects are synthesized client-side (square waves + noise) and triggered by diffing consecutive snapshots.

Development

cargo test                                          # sim, protocol, render, binding tests
cargo test --test e2e -- --ignored                  # real two-peer match over iroh
cargo test --lib preview -- --ignored --nocapture   # print rendered frames
cargo test --lib audible_demo -- --ignored --nocapture  # hear every sound effect
cargo run --example capture_gif                     # re-render assets/gameplay.gif

The gameplay GIF is generated, not screen-recorded: capture_gif simulates a deterministic bot match twice with the same seed (pass one learns who wins, pass two records from the winner's POV), draws each tick through the real ratatui render path into a headless buffer, rasterizes cells with an 8×8 bitmap font, and encodes a frame-differenced GIF.

The simulation is fully headless: full_bot_match_produces_a_winner runs an entire 8-bot match to completion in milliseconds. See DESIGN.md for the design document and PLAN.md for implementation status.

License

MIT