Game Engine White Papers: Commander Keen
Posted by mfiguiere 1 day ago
Comments
Comment by turpentine 1 day ago
Comment by torh 1 day ago
Comment by evilturnip 1 day ago
Comment by _the_inflator 1 day ago
The underlying mechanics of Carmack's technique is very similar to the full screen smooth scrolling effect on C64 at any speed and distance. It is nowadays referred to as DMA delay.
ELIF: You trick the CPU to display screen data at a different starting point than as designed by the hardware. This is tricky and need to be executed cycle exact.
Here is the explanation in detail together with all major top notch effects. The article is a legend and kind of the bible of doing the most sophisticated effects on C64. Some effects have since then even more and better explained and exploited due to cross platform development possibilities and better tooling, but understanding all mechanics here is a necessity to play a role in the Champions League of C64 demos, besides and also being able to implement the techniques mentioned here: https://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt
Comment by lazystar 1 day ago
heh, is there a new meaning for ELIF? im not sure that there are many 5 year olds who would understand that ;-)
Comment by kevindamm 1 day ago
ELIF: explain like I'm forty.
Comment by zem 1 day ago
Comment by goodmythical 1 day ago
Comment by zem 1 day ago
Comment by bonzini 1 day ago
Comment by deaddodo 1 day ago
In fact, Carmack specifically states that packed pixels were the impetus for id’s side scrolling experiments that led to Commander Keen and its ilk.
Comment by hbn 1 day ago
I also think Doom Guy is worth a read because it gives a lot more insight into what happened at Ion Storm and how the Daikatana project fell apart. And some important context about the infamous "John Romero's about to make you his bitch" ad (mainly that he really didn't want to publish it at all). But I digress.
Comment by memsom 18 hours ago
I did feel that Romero skipped a load of stuff, at least int he audio version. There was no real mention of Stevie Case, just one passing name check. That was really odd. I was expecting him to at least mention her.
I've also both read and listened to Masters of Doom (read by Wil Wheaton no less) and it is a great book too. The audio version is really good.
Comment by vunderba 1 day ago
Comment by hbn 1 day ago
Comment by instagraham 23 hours ago
Also, the idea that it hadn't been done yet by 1990, when consoles were well in the game, suggests the PC market was behind popular gaming in a big way.
Comment by WorldMaker 13 hours ago
PCs were designed to be general hardware and it didn't seem to make sense to create a generic "PPU" for the PC, so instead game engines at the time (and many game engines to this day) had to emulate one entirely in software. The video RAM of EGA and VGA is just one big blob of pixels, or perhaps two if your system supported double-buffering. At the hardware level it doesn't have concepts like sprites or scrolling backgrounds.
Carmack was one of the first (if not the first; Commander Keen was also among the first commercially successful attempts) to get a software "PPU" renderer on the PC working reliably in real time. Another notable achievement for side scrollers on the PC in that era was Cliff Bleszinski managing to software render the parallax effects similar to Sega's "Blast processor" PPU (notable for "gotta go fast" Sonic games) for Jazz Jackrabbit (in 1994).
It has sort of long been the arc of PC development of eventually doing entirely in software what consoles and arcades were doing with dedicated and/or one-off hardware. (Right up until about the invention of the modern GPU when suddenly the PC was leading graphics hardware in a different way.)
Comment by rendaw 1 day ago
Comment by LarsDu88 1 day ago
Comment by mrob 1 day ago
To put it briefly, 4th generation and earlier games consoles saved on expensive RAM by not having frame buffers [0]. The CPU wrote a description of how to construct the scene using tiles and sprites to a smaller video ram, then dedicated video hardware converted this to the video signal one line at a time. The whole frame gets rendered from scratch every video refresh, so there's no need for tricks like Commander Keen's adaptive tile refresh. Scrolling at 60 fps (or 50 fps for PAL hardware) is as cheap as changing a single value in video memory. It's like the famous "racing the beam" of the Atari 2600, except less flexible and done by dedicated hardware so you don't tie up the CPU.
On the PC, the CPU writes the actual graphics to a frame buffer, then the graphics card outputs the contents of the frame buffer as the video signal. The naive approach to scrolling requires rewriting the entire frame buffer, so tricks to avoid redundant writes are highly beneficial.
[0] Except for the Atari Lynx, which was a portable system with a screen resolution of only 160×102. I can't think of any other exceptions, but maybe there are more.
Comment by wk_end 1 day ago
Comment by mrob 1 day ago
That's the same as the Atari 2600. It just occurred to me that the name "racing the beam" is misleading because you can't be too fast either. "Matching the beam" would be a better name. My point is the graphics hardware in both the 2600 and in tile+sprite consoles assembles the graphics just before it's sent to the video output without buffering the whole frame. The main difference is the 2600 graphics hardware is typically reconfigured every line while the later consoles' graphics hardware is typically reconfigured every frame (although re-configuring between lines is usually also possible, and some games left it unchanged on some screen refreshes to save CPU time at the expense of lowering frame rate).
>from the hardware's perspective it's not even one line at a time, it's one dot at a time.
Mostly true, but I tried to make the description generic to as many systems as possible, so "line" is IMO more broadly accurate because a line is composed of dots. The Neo Geo is a tile + sprite system too, and it renders to line buffers.
Comment by fredoralive 1 day ago
A traditional IBM PC has a "dumb" framebuffer, where everything is done by the PC. Simply scrolling the background by 1 pixel basically means redrawing a lot of the screen, and you have to keep track of what graphics behind sprite would need to be redrawn after they move etc. As a bonus, on early consumer level 386 and 486 machines you have a mighty processor, but the graphics card is often still on a 16 bit 8MHz(ish) ISA bus. The PC does have an advantage that it's more flexible, so stuff like 3D was easier to do than on a tile-and-sprite setup (especially once we had stuff like VESA and PCI).
Comment by matheusmoreira 1 day ago
https://www.youtube.com/playlist?list=PLHQ0utQyFw5KCcj1ljIhE...
Comment by rtpg 1 day ago
Comment by woutersf 1 day ago
Comment by snodes 1 day ago
Comment by basisword 1 day ago
Comment by LarsDu88 1 day ago
Comment by charlietran 1 day ago
"...I discovered Fabien Sanglard’s website and began reading his Game Engine Black Books on Wolfenstein 3D and Doom. Inspired by those works, I wondered whether I could do something similar for Commander Keen: open up the source code, explore the files, and piece together a picture of the overall architecture and the clever tricks used. The style, dimensions, and structure of this book are intentionally similar to Fabien’s Game Engine Black Books, as an homage to those masterpieces. To give it a personal twist, I inverted the title and cover to white."
Comment by fabiensanglard 1 day ago
That is a great idea.
Comment by sasas 1 day ago
[EDIT] - I see in the Keen book's source git commit logs that you reviewed and assisted with proof reading beforehand, so may we assume that this is all above board and sanctioned by you?
Comment by fabiensanglard 1 day ago
Comment by LarsDu88 1 day ago
I suppose there's still Quake 3 Arena and DOOM3 to complete the full "John Carmack" early 90s to early 2000s technical overview series.
Or maybe something with the Sega Saturn. I heard the Sonic X-treme team worked so hard to make a 3d Sonic game for that platform in the mid 90s that multiple team members had to go on medical leave!
Comment by dmit 1 day ago
"... that mediocrity can pay to greatness" is the rest of the quote.
Comment by spacechild1 22 hours ago
https://shkspr.mobi/blog/2024/01/no-oscar-wilde-did-not-say-...
Comment by _jackdk_ 1 day ago
Comment by fabiensanglard 1 day ago
I agree.
Comment by ndiddy 1 day ago
Comment by bel8 1 day ago
We consume his site for the content, not for the minimalistic design that exist since the inception of the universe.
Comment by sasas 1 day ago
If you didn't double check the author while skimming this Keen book, you may well be mistaken that it was written by Fabien.
I took a quick skim of the content, it looks great - tempted to purchase a copy to support the author for their efforts (and have it sit on the bookshelf next to two other very similar looking books...) but need to sit on this for a while.
Maybe I'm overthinking this. Would like to hear Fabien's take on the situation.
[EDIT] It looks that the Keen book author copied and pasted direct sections[1] out of Fabien's book's TeX[2].
[EDIT] The git commit history has comments that indicate that Fabien reviewed the book, e.g. "updated all chapters after feedback Fabien" and "Proofread Fabien Sanglard en hardcopy review", so perhaps this is all sanctioned.
[1] https://github.com/bsmits74/Keen_White_Papers/blob/master/sr...
[2] https://github.com/fabiensanglard/gebbdoom/blob/master/src/b...
Comment by fabiensanglard 1 day ago
In short, it is not.
I received early draft from bas. While I encouraged him to finish his book, I also told him, in no uncertain terms, that I had released the source code to inspire people and give them a kickstart, but not for them to copy the content.
As months passed, I asked repeatedly to remove whole paragraphs he had copy/pasted as is, and drawings he had also copy/pasted. Later, as A.I became more powerful, I used it to compare Wolfenstein 3D and Keen book and noticed a lot more that was verbatim. At which point I told him I no longer wanted to help him in his project.
It is cool that someone documented Keen thanks to my framework. But I have only myself to blame for opensourcing the code of my books/website and thinking people would use it as intended.
PS: I commented it was a "good idea" to change the cover because originally this was going to be the "Game Engine Black Book: Commander Keen". I did not like that his work could have been mistaken for mine (he also elected to use the same style as my website for his website which only adds to the confusion).
Comment by sasas 1 day ago
The author has clearly put quite some investment in writing their book, it's a shame and hard to understand that someone would self sabotage by plagiarising the work of others - Especially to someone donating their own free time to initially help out.
> But I have only myself to blame for opensourcing the code of my books/website and thinking people would use it as intended.
Even if you had not, perhaps this scenario would have still eventuated.
Keep up the good work. Any new books planned on the horizon?
Comment by fabiensanglard 18 hours ago
I always have projects :) ! Whether I can go all the way and actually ship it is another story.
Comment by markus_zhang 20 hours ago
(Going to do that in 10-15 years when I reach 50/55 to semi retire)
Comment by bombcar 1 day ago
Comment by pan69 1 day ago
Comment by bluedino 1 day ago
Comment by to11mtm 1 day ago
... Well, we do at least have OpenTyrian... (Edited to add; And OpenTyrian2000)
> Epic Pinball
Best I can find for Epic Pinball is an old thread on Pinball Fantasies [0] but I think it almost counts cause there was shared dev work between the two...
> Halloween Harry
TBH that one would be fairly interesting, especially compared to Duke Nukem 2 (Part of me thinks they might be similar/same engine)
> Jill of the Jungle
That one honestly WOULD be a fun one to look at... Best I can find is Xargon [1] but part of me always got a vibe that Xargon was some semi-upgraded Jill engine...
> Duke Nukem
TBH Duke Nukem '1' would not be that exciting to me. AFAIR it's mostly an adapted CK1-3 engine, letter-boxed with status window to make it easier to calc the redraw.
Duke Nukem 2, is far more interesting since it's a different, more powerful engine (VGA, digital audio support, but AFAIR only required a 286).
Comment by kridsdale1 1 day ago
Though the “hot babes stuck in alien pods” from Harry showed up as a central plot point in DN3D.
Comment by to11mtm 1 day ago
Although, mea culpa, DN1 engine is not necessarily CK but the programmer has credited Carmack in helping with the drawing assembly...
Comment by bananaboy 1 day ago
Comment by vunderba 1 day ago
Comment by 97-109-107 16 hours ago
Comment by ChrisRR 22 hours ago
Comment by ChrisArchitect 1 day ago
Reconstructed Commander Keen 1-3 Source Code
https://pckf.com/viewtopic.php?t=18248 (https://news.ycombinator.com/item?id=46321982)
Comment by jzelinskie 1 day ago
Comment by Waterluvian 1 day ago
Ie. Rendering to PDF or HTML would be pretty straightforward. Rendering to video, audio, or as a chocolate bar would require more authorship. Would epub be much more work?
Comment by ForHackernews 1 day ago
Comment by nnnnico 1 day ago
Comment by dang 1 day ago
"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something."
"Please respond to the strongest plausible interpretation of what someone says, not a weaker one that's easier to criticize. Assume good faith."
Comment by nnnnico 1 day ago
Comment by mrandish 1 day ago
On the first page this author credits Fabian's excellent analysis of Doom and Wolfenstein as the inspiration to attempt the same for Commander Keen.
> "Fast forward to 2021, I discovered Fabien Sanglard’s website and began reading his Game Engine Black Books on Wolfenstein 3D and Doom. Inspired by those works, I wondered whether I could do something similar for Commander Keen: open up the source code, ex plore the files, and piece together a picture of the overall architecture and the clever tricks used. The style, dimensions, and structure of this book are intentionally similar to Fabien’s Game Engine Black Books, as an homage to those masterpieces."
Just skimming so far, but this book looks like a valuable contribution to the genre of retro game code analysis. Obviously, it will build on the work of others who've done adjacent research. In a page 87 footnote the author refers readers to Fabien's site for detailed instructions on installing a DOSBox and Borland C++ dev environment.
Comment by lelandfe 1 day ago
This is trampolining on his "brand" as much as my text editor is
Comment by sasas 1 day ago
Comment by bel8 1 day ago
And I fail to make the connection. This content-heavy but minimal design is not unique.
Text inside a centered element, text-heavy but also packed with images, exists from the times of formatinng websites with `<table>` tags in DreamWeaver or Microsoft Frontpage 98.
If you're talking about the highly detailed article, can we not gatekeep this? I want more of that on the internet, not less.
Comment by BigTTYGothGF 1 day ago
Comment by wk_end 1 day ago
The work on the book itself looks fantastic, so it's a shame about the site design.
Comment by sasas 1 day ago
Comment by wk_end 1 day ago
Comment by sasas 1 day ago
Comment by sasas 1 day ago
Comment by doctorpangloss 1 day ago
Comment by LarsDu88 1 day ago
Imagine if you replaced "games engineering" with "political history" or "nuclear physics"
Comment by alberto-m 1 day ago
But the field still offers many mysteries that need human brains to be solved.
Whether LLMs are a net positive here depends if one is result-oriented (e.g. wants to rewrite an old game in a modern language) or process-oriented (is there for the investigation work and the intellectual challenges).
Comment by doctorpangloss 20 hours ago