DEV Community

depa panjie purnama
depa panjie purnama Subscriber

Posted on

I Built a Game Where GitHub Copilot CLI is the Game Master

GitHub Copilot CLI Challenge Submission

This is a submission for the GitHub Copilot CLI Challenge

What I Built

copilot-quest

What if your terminal was a portal to infinite worlds?

Copilot Quest is a text-based adventure game where GitHub Copilot CLI is the Game Master. There are no pre-written stories, no scripted encounters, no predetermined endings. Every single playthrough is dynamically generated by Copilot in real-time, the world, the characters, the puzzles, the plot twists, all of it.

You launch the game, enter your name, and Copilot picks a random genre (fantasy, sci-fi, cyberpunk, horror, steampunk, you never know what you'll get) and drops you into a completely unique adventure. Navigate through choices, type your own creative actions, manage your HP and inventory, and see how far you can survive.

The best part? No two playthroughs are ever the same. Play it five times, get five completely different worlds.

I built this because I wanted to showcase what Copilot CLI can really do, not just as a code assistant, but as a creative engine that powers an entire application at runtime. The game literally cannot exist without Copilot CLI. It's not a tool I used to write code (though I did that too), it's the beating heart of the experience.

Try it right now:

npx copilot-quest
Enter fullscreen mode Exit fullscreen mode

That's it. One command. No cloning, no setup. Just make sure you have GitHub Copilot CLI installed and authenticated.

Demo

🔗 GitHub Repo: github.com/depapp/copilot-quest
📦 npm: npmjs.com/package/copilot-quest

Title Screen

When you launch the game, you're greeted with a gorgeous ASCII art title screen:

copilot-quest

your name

Gameplay

Once you're in, Copilot generates your world. Here's what a typical scene looks like:

gameplay

Every scene features:

  • 📖 Vivid, atmospheric narrative text with a typing effect
  • 🎨 AI-generated ASCII art for each location
  • ❤️ HP bar, inventory, and location tracking
  • 🎯 3-4 contextual choices generated by Copilot
  • ⌨️ Free-form text input — type literally anything you want to do

My Experience with GitHub Copilot CLI

copilot session

This project has a delicious meta quality to it: I used GitHub Copilot CLI to build a game that IS powered by GitHub Copilot CLI.

How Copilot CLI Powers the Game at Runtime

The game uses Copilot CLI's programmatic mode (copilot -p "...") as its AI engine. Here's the flow:

  1. The game maintains a game state (player name, HP, inventory, location, story summary)
  2. When the player makes a choice, the app builds a structured prompt injecting the current game state
  3. The prompt is sent to copilot -p with a strict JSON response schema
  4. Copilot returns the next scene: narrative, choices, ASCII art, HP changes, inventory updates
  5. The app parses the JSON and renders it as a beautiful terminal UI

This means Copilot CLI isn't just generating text, it's acting as a full game engine, managing narrative continuity, inventing characters, creating puzzles, and even deciding combat outcomes. All in real-time, all dynamically.

How Copilot CLI Helped Me Build It

Beyond the runtime integration, Copilot CLI was my pair programmer throughout:

  • Architecture decisions. I brainstormed the entire project structure with Copilot, from the component hierarchy to the prompt engineering strategy
  • Ink/React components. Copilot helped me build the terminal UI components (title screen, narrative panel, choice menu, stats bar) using Ink's React-based API
  • Prompt engineering. Iterating on the prompts to get consistent, well-structured JSON responses was a collaborative process with Copilot
  • Error handling. Copilot helped me build robust JSON parsing with fallbacks for when the AI response isn't perfectly formatted

The Tech Stack

Layer Technology
Runtime Node.js + TypeScript
Terminal UI Ink (React for CLIs)
AI Engine GitHub Copilot CLI (programmatic mode)
ASCII Art Figlet + Copilot-generated scene art
Styling Chalk, Boxen

What Surprised Me

The thing that blew my mind was how good Copilot is at being a Game Master. It maintains narrative consistency across turns, creates callbacks to earlier events, and even builds toward climactic moments. I once played a cyberpunk run where an NPC I met in turn 2 betrayed me in turn 14 and Copilot remembered the setup it had created. That's not scripted. That's emergent storytelling.

Key Takeaway

GitHub Copilot CLI isn't just a coding assistant, it's a creative runtime engine. This project proves that Copilot can power interactive experiences, not just help you write code. The line between "tool that helps you build" and "engine that powers what you build" is beautifully blurred.


Give it a try:
npx copilot-quest and let me know what genre Copilot picks for you

Top comments (0)