github

Dungeons & Desktops: Building a procedurally generated roguelike with GitHub Copilot CLI (opens in new tab)

GitHub Dungeons is a terminal-based roguelike that transforms a repository into a procedurally generated dungeon. Built in Go with GitHub Copilot CLI, it uses the latest commit SHA as a seed, making each commit produce a distinct but reproducible map. The project demonstrates how AI-assisted development can let developers focus more on game design and iteration than on implementation details.

Repository-Driven Procedural Generation

  • The game generates rooms, corridors, and enemies from the current codebase.
  • Each repository produces a structurally different dungeon.
  • The latest commit determines the random seed:
    • The same commit always creates the same map.
    • Code changes reshape the dungeon.
  • Procedural generation creates replayability by producing many layouts from a single set of rules.

Roguelike Design

  • GitHub Dungeons draws on classic games such as Rogue.
  • It combines:
    • Procedurally generated levels
    • Permadeath
    • A text-based terminal interface
  • Players navigate with arrow keys, fight bugs, collect items, and search for the exit.
  • When the player’s HP reaches zero, the run ends and they must start over.
  • The Copilot CLI /yolo command, an alias for /allow-all, reinforces the game’s one-life theme.

Building with GitHub Copilot CLI

  • The author began with a high-level prompt asking Copilot to build a Go-based GitHub CLI extension using BSP-generated dungeons.
  • The /delegate command sent feature requests to Copilot’s cloud-based coding agent.
  • Copilot worked asynchronously and returned changes through pull requests.
  • Example delegated work included progressively harder levels with:
    • More enemies
    • Additional health potions
  • The author reviewed and refined Copilot’s output, including cheat codes for invincibility.
  • Copilot also generated a “dungeon scribe” agent that created documentation and ASCII diagrams explaining dungeon generation.
  • This workflow allowed the author to concentrate on mechanics, balance, player experience, and easter eggs rather than boilerplate and scaffolding.

Binary Space Partitioning

  • Binary Space Partitioning (BSP) generates the dungeon by repeatedly dividing a large area into smaller regions.
  • The process begins with one rectangle representing the entire map.
  • That space is recursively split into smaller sections, which can then be used to place rooms and connect them.
  • BSP suits roguelikes because it balances:
    • Structure, avoiding chaotic layouts
    • Replayability through controlled randomness
    • Navigation, by supporting connected maps
  • The technique naturally produces clean rectangular rooms while retaining variation between generated levels.

GitHub Dungeons shows how repository data, classic roguelike mechanics, and AI-assisted coding can combine into a playful development experiment. Using Copilot as an implementation partner lets the developer iterate quickly while remaining focused on designing an enjoyable game.