thecodingidiot.com

The TerminalNetHack

NetHack

You have a working terminal environment. You can navigate the filesystem, create and manipulate files, set permissions, search for content, build pipelines, control processes, manage your environment, write shell scripts, and survive Vim. The machine understands you now.

There is one thing left to do.

Install NetHack

On Ubuntu and Debian:

sudo apt install nethack-console

On other distributions, search for nethack-console or nethack in your package manager. Platform-specific installation instructions are in 00-setup.

Launch it

nethack

The terminal clears. A map appears in ASCII[1]. You are @. The level is generated fresh — no two runs are identical.

What you are looking at

----------
|........|
|..@.....|     @ — you
|........|     d — dog
-----+----     D — dragon
               $ — gold
               + — door

This is the terminal as a rendering engine. There is no sprite[2] sheet, no GPU[3], no draw call. The display is a text buffer. The game writes characters to it and your terminal emulator draws them. The same mechanism that displays your shell prompt renders the dungeon.

Rogue worked exactly this way in 1980. NetHack still does. You are standing inside the lineage that produced every procedurally generated game since.

Play for ten minutes

The controls are in ?. hjkl to move (the same keys Vim uses for navigation — not a coincidence). Pick up items with ,. Fight by moving into enemies. Go down stairs with >.

You will die. Probably quickly. That is not failure — it is the format. Every run teaches you something the previous one did not.

When you die, the game prints your cause of death and your score. Read it. Then run nethack again if you want. Or close the terminal.

Either way: you have closed the loop. The terminal ran Rogue in 1980. It runs NetHack now. It will run your raycaster in a few chapters, and eventually a 3D engine on Dreamcast hardware. The tool has not changed. What you do with it has.


This chapter's companion repo is at thecodingidiot-com/f01-the-terminal. The tester (test.sh) verifies the skills from pages 01 through 12. NetHack is the final check.

Footnotes

  1. ASCII - Wikipedia

  2. Sprite (computer graphics) - Wikipedia

  3. Graphics processing unit - Wikipedia

up next

Version Control

Version Control