For this blog to make any sense, you’re going to need a little bit of backstory and history. If you know what a roguelike game is, you can skip ahead two paragraphs. If you know what curses is, you can also skip ahead two paragraphs. But if not, a brief explanation of the two terms central to this story follows.

First, a roguelike game is any videogame where content is generated by an algorithm. That could mean the maps, items, monsters, and in some cases even the story are randomly generated. The name comes from the original game of this style, Rogue, a dungeon-crawling hack-and-slash game with ASCII graphics.

Curses, on the other hand, is a terminal control library. Originally written by Ken Arnold at UC Berkeley, the library was eventually released with BSD Unix. Using curses, developers can place arbitrary characters anywhere they’d like on the screen of a Unix terminal.

(Related: What Pokémon Go teaches about code recycling)

With the proper groundwork laid, we can now dive into our topic for the day: Why curses and Rogue are so intimately tied together.

Last weekend in San Francisco, the first Roguelike Celebration took place in San Francisco at Eventbrite’s headquarters. This event brought together the developers behind the biggest and most popular roguelike games of the past 20 years: Dungeon Crawl Stone Soup, Ancient Domains of Mystery, NetHack, Angband, Moria, and the granddaddy of them all, Rogue.

Today, there are thousands of roguelike games out there. They’re something unique to the medium of video games: The algorithms used to generate content for roguelike games are not possible anywhere else. You can’t build a board game big enough to accommodate the variance possible in a computer game, and interactive artistic endeavors typically eschew the blunt and straightforward narratives roguelikes favor.

You know the story: strong person in chainmail ventures into a dark dungeon to kill the evil beasts inside and vanquish some great monster at the bottom of it all. Along the way there will be unknown potions to quaff, magic scrolls to read, cursed armor to accidentally put on, and +4 Vorpal longswords with which to hack and slash.

The original Rogue was built at the UC Santa Cruz around 1978. Michael Toy and Glenn Wichman were students at the time, and they met while programming text-based games in the school’s computer lab. There were three terminals in there, and they connected to a PDP-11/70. When they noticed each other’s screens, they began discussing the games they were individually making, and then soon after joined projects.

Their original goal was to build something more interesting and exciting than Colossal Cave Adventure, the first text adventure game. Their efforts were somewhat stymied by the incredibly difficult task of drawing arbitrary ASCII characters on their terminal screens.

By 1980, Toy had transferred to UC Berkeley. He’d brought his code with him and was able to make the acquaintance of Ken Arnold. Arnold had been spending a good amount of his time in school writing the code needed to draw characters on terminal screens wherever you wanted.

“I find it hard to describe curses,” said Arnold at the Roguelike Celebration. “It was really quite simple. There were these cursor terminals, and the people around them were hacking up things for entertainment. I wrote one, then a second type of cursor-adjustable terminal. I didn’t want to do this a third time and fourth time. At that time someone had just written Vi. I said, ‘I am not writing this twice. I am going do this once, so everything could have cursor adjustments.’ ”

Thus, Arnold wrote curses, using some of the code from Vi. This library would eventually end up in BSD UNIX, and was remade in GNU form as ncurses.

“There would not be a Rogue without curses,” said Toy. “We had Ataris and Apples, but the thing we had access to was a dumb, nasty terminal. So we were trying to get as close to the graphic richness as we could on the Apple II. Curses let us think graphically and visually and come close to presenting an interactive experience.”

Wichman called Rogue “the Minesweeper of Unix. “We said it was the most popular game on college campuses in the early 1980s. It was strange because it was getting played everywhere, but nobody was sending us money.”

The game was even popular with the originators of Unix: Ken Thompson and Dennis Ritchie. Said Arnold: “By the time we got to Berkeley, Berkeley was node 10 on the ARPANET. There was a shared score file.” This meant people could conceivably cheat in Rogue, a game where if you died, the game was permanently over for that character. Cheating was of grave concern.

“That made us try to keep it as clean as we could, so we had save files that were secured in certain ways,” said Arnold. “I once heard Ken Thompson was cheating by making the save file and putting it on a mounted disk. Then he’d clone the disk and replay it again.”

Toy said that he once met Dennis Richie in person, and the first thing Ritchie said to him was, “You’re Michael Toy, the Rogue guy!” That was the biggest thrill of the project, said Toy.