Dungeons & Desktops: Building a procedurally generated roguelike with GitHub Copilot CLI

“`html Dungeons & Desktops: Building a procedurally generated roguelike with GitHub Copilot CLI Building a Procedurally Generated Roguelike with GitHub Copilot CLI…

By AI Maestro May 12, 2026 4 min read
Dungeons & Desktops: Building a procedurally generated roguelike with GitHub Copilot CLI

“`html




Dungeons & Desktops: Building a procedurally generated roguelike with GitHub Copilot CLI

Building a Procedurally Generated Roguelike with GitHub Copilot CLI

GitHub Copilot CLI Challenge

Introduction

I got nerd-sniped into the GitHub Copilot CLI Challenge and made a questionable decision: I turned my codebase into a roguelike dungeon.

The result is GitHub Dungeons, a terminal game that generates a dungeon from your codebase. Rooms, corridors, and enemies are all built from your repo and rendered right in your terminal. You navigate with arrow keys, fight bugs, and hunt for the exit. Every repository produces a different map. Every commit reshapes the layout. And if your HP hits zero, you start over.

Screenshot of 'gh dungeons'

Fun fact: /yolo (you only live once) is a Copilot CLI command. Fitting, since roguelikes are built around permadeath. You really do only get one life.

What is procedural generation?

Roguelikes trace back to games like Rogue in the 1980s — terminal-based adventures where each run generated a new dungeon, and death meant starting over.

This combination of procedural generation, permadeath, and text-based interfaces (later formalized in things like the “Berlin Interpretation”) makes the genre feel surprisingly modern and a perfect fit for the command line. GitHub Dungeons leans into that tradition. It’s written in Go, which I don’t normally use, but working with Copilot meant I could focus on behavior instead of syntax.

GitHub Dungeons: How Does Your Repository Become a Dungeon?

The result is GitHub Dungeons, a terminal game that generates a dungeon from your codebase. Rooms, corridors, and enemies are all built from your repo and rendered right in your terminal.

At a high level, GitHub Dungeon layouts are generated using Binary Space Partitioning (BSP), seeded by your repository’s latest commit SHA. That means the same codebase produces a consistent layout, while still evolving as the code changes.

  • The same commit always generates the same map
  • Different repositories produce layouts that feel structurally distinct
  • As the code changes, the dungeon evolves with it

In practice:

  • The same commit always generates the same map
  • Different repositories produce layouts that feel structurally distinct
  • As the code changes, the dungeon evolves with it

Building GitHub Dungeons with Copilot CLI

Working with GitHub Copilot CLI meant describing behavior instead of writing everything from scratch. One command that made a big difference was /delegate. Instead of just generating code inline, /delegate hands the task off to GitHub’s Copilot coding agent running in the cloud.

I could describe what I wanted in plain English, kick it off, and then go do something else while it worked independently. When it finished, it opened a pull request with the results. For example:

/delegate Make each level progressively harder e.g. on level 2 there are extra baddies, but more health potions

Copilot generated a solid first pass asynchronously, and I reviewed and tweaked the PR from there until the balance felt right. I took the same approach to other features like adding cheat codes that make the player invincible (because why not). I even had Copilot generate a dungeon scribe agent, which added documentation and ASCII art diagrams to explain how dungeons were generated.

Using Copilot (especially with /delegate) is like having an army of NPCs available to do whatever I want them to do.

Lee Reilly, Dungeon Master

This approach meant spending less time on edge cases and boilerplate, and more time on the player experience, including adding easter eggs for players to discover. Iterating with Copilot let me stay in a game design mindset instead of constantly switching into implementation details.

Procedurally Generated Levels (with BSP)

At the heart of each dungeon design is a technique called Binary Space Partitioning (BSP), which is a great thing to casually mention alongside middle-out compression if you want to impress your friends and colleagues. It sounds intimidating, but the idea is surprisingly simple: keep splitting a space into smaller chunks until you have a bunch of rooms you can connect.

Roguelikes need maps that feel:

  • Structured (not completely random nonsense)
  • Replayable (different every run)
  • Navigable (no dead ends or impossible layouts)

BSP hits a sweet spot. It gives you:

  • Clean, rectangular rooms
  • Guaranteed connectivity
  • Just enough randomness to feel organic

Here’s how it works…

How BSP Works

  1. Start with a big empty space
  2. Split it recursively
  3. Stop when it gets too small
  4. Turn each region into a room
  5. Connect rooms with corridors

The end result is structured chaos, where every run feels different but reproducible with a seed.

Key Takeaways

  • Working with Copilot CLI allowed for faster development by focusing on behavior rather than syntax.
  • BSP is a powerful technique for generating procedural levels in a way that feels both structured and organic.
  • GitHub Dungeons provides an engaging and unique way to explore codebases through the lens of a terminal-based roguelike game.

© 2026 Lee Reilly. All rights reserved.

“`

Stay ahead of AI. Get the most important stories delivered to your inbox — no spam, no noise.

Name
Scroll to Top