Tombstone
ZenConsoleProc
Jun 2001 – Jul 2001 · age 19
What it was
A two-week prototype of the in-game console Jeff wanted for a future engine, built as a plain Win32 console program in C++. A processor class held two fixed tables: commands, each a name and a function pointer, and variables, each a name, pointers aimed at live engine values, and an optional callback that fired on change. After registration both tables were quicksorted by name and searched with a home-made jump search. Typing a name ran the command or echoed the variable; typing a name and a value assigned it and fired the callback. Underneath sat a wrapping buffer of 80 lines, meant to be drawn in OpenGL someday. The demo registered two commands and two variables, one of them sv_gravity, and looped until Escape. It never met an engine.
Wins, for the age
- At nineteen, Jeff rediscovered the Quake cvar model of 1996: variables as pointers into the running engine plus a callback, so typing
sv_gravity 800would change the game. The shape was right, found by an ape who wanted a console and simply built one. - Sorted once at startup so every lookup was sublinear, the right instinct for something meant to run every frame, even if four names hardly needed it.
- Chose fixed capacities on purpose and said so in a comment: "I don't really like dynamic data." A decision, written down.
What it taught
- The boring parts, registration, lookup and echo, are most of a console.
- A sort and a search over a handful of strings is more machinery than the problem deserves. Enjoying writing it anyway is allowed, once.
- Polling the keyboard in a tight loop burns a core. A real console has to be driven by the game's input system.
- A text surface that writes through raw pointers into engine memory needs bounds and type checks, and that matters more once something other than a human is typing.
Genealogy
Ancestors: none on record. The first data-driven command surface. Descendants: Adama Tooling: a devbox REPL poking at live state, twenty-odd years on.
Epitaph
Here lies ZenConsoleProc, which sorted four names so it could find them faster, and knew how to change gravity in a game that did not exist.