top | item 8326883

Commander Keen source code released

545 points| vs2 | 11 years ago |github.com | reply

138 comments

order
[+] thristian|11 years ago|reply
Note that "Keen Dreams" is the game sometimes called "Commander Keen 3.5" or "The Lost Episode"; unlike episodes 1-3 and 4-6 which were made by ID for sale by Apogee, Keen Dreams was (I think) the last game ID made to fulfill their contractual obligations with SoftDisk. It's interesting in a number of ways - the engine and art is very clearly halfway between the first and second Keen trilogies, it's the only game where Keen doesn't have his iconic pogo-stick or his Neuralizer Ray gun.
[+] jenscow|11 years ago|reply
It looks like Crystal Caves.

ID and Apogee stole many hours of my childhood

[+] Arjuna|11 years ago|reply
A little slice of history regarding one of the technical foundations of Commander Keen, for those that aren't aware:

"Then, the first breakthrough. John Carmack devised a smooth, scrolling routine similar to that used for the background of Nintendo games but never before possible on the PC." [1]

The technique is called, adaptive tile refresh. [2]

[1] http://www.3drealms.com/keenhistory

[2] https://en.wikipedia.org/wiki/Adaptive_tile_refresh

[+] vidarh|11 years ago|reply
It's fascinating that this was something new on the PC that late.

This is roughly how most scrolling on the C64 happens (though it works by reducing the visible display by 8 hires pixels on either side of the screen, and scrolling at most 8 hires pixels before you need to shift "tiles" / characters). I'm not sure it was new with the C64 either. While most C64 games used sprites for the movable objects, there are absolutely exceptions that tracked damage.

On the Amiga, however, the method described is basically pretty much how you're expected to do scrolling from the outset(it has much more extensive support for it than EGA did). AmigaOS even came with built in support for managing damage lists for such objects ("bobs" for "blittable objects") and double buffering from 1985, though most games would have used their own code for it.

For these systems redrawing the whole screen was simply never seen as viable, or worthwhile. The Amiga hardware support for doing this kind of scrolling + the use of the blitter for moving game objects and replacing damaged sections made this method the obvious choice.

Even double-buffering was sometimes seen as too wasteful, with a solution being to sort damage lists and tie updates to the raster interrupt to update the screen before the raster beam reached it.

[+] sprokolopolis|11 years ago|reply
I remember reading in Masters of Doom that they had actually asked Nintendo if they could license games to get them on personal computers, Obviously, Nintendo declined. They were able to get the first level of Super Mario Bros running on personal computers and used that method in the Commander Keen series.
[+] caf|11 years ago|reply
That Wikipedia link claims that Commander Keen was the first PC sidescroller, but it was predated by (at least) Captain Comic.

I'm not sure if you'd call Sopwith a sidescroller but it managed to scroll sideways on CGA.

[+] antimagic|11 years ago|reply
When I read the description of how EGA worked, you can't help feeling that the engineers that created it had planned for exactly the use-case Carmack put it to. In particular, providing for a buffer that was larger than the screen, the ability to move the offset inside the buffer for the screen's origin, and wrapping of the buffer is exactly the feature set that you need to implement scrolling. I don't think it was blind luck that these features were all available on the card.

This is often cited as the first example of Carmack's genius when it came to computer graphics, and he certainly deserves credit for being one of the first/astest third-party developers to realise the potential of the EGA card. But if I was one of the engineers that had designed EGA, I would be rather miffed to see how much Carmack is praised for this when it seems relatively clear that he was just using the hardware as it was intended to be used.

[+] sillysaurus3|11 years ago|reply
Does anyone know where the "adaptive tile refresh" source code is in the codebase?
[+] ahomescu1|11 years ago|reply
https://github.com/keendreams/keen/blob/master/id_us_a.asm#L...

> baseRndArray dw 1,1,2,3,5,8,13,21,54,75,129,204

Hah he got the Fibonacci series wrong (it's supposed to be ...13, 21, 34, 55, 89, 144, unless he did this on purpose).

[+] sillysaurus3|11 years ago|reply
Carmack got many things wrong. The interesting thing is, none of his mistakes mattered, otherwise he would have fixed them. So you wind up with emergent behavior and bugs become features, like bunnyhopping or rocket jumping.

In this case, 204/129 ~= 1.581, which is pretty close to the golden ratio 1.618. In fact, let's just list all the ratios:

  1/1 = 1
  2/1 = 2
  3/2 = 1.5
  5/3 = 1.667
  8/5 = 1.6
  13/8 = 1.625
  21/13 = 1.615
  54/21 = 2.571
  75/54 = 1.389
  129/75 = 1.72
  204/129 = 1.581
And for the regular series:

  1/1 = 1
  2/1 = 2
  3/2 = 1.5
  5/3 = 1.667
  8/5 = 1.6
  13/8 = 1.625
  21/13 = 1.615
  34/21 = 1.619
  55/34 = 1.618
  89/55 = 1.618
  144/89 = 1.618
Here's a plot of the ratios (regular series in blue, Carmack's in red...ish): http://i.imgur.com/WA7ipZA.png

In this case, we end up with some lovely oscillations in the second half of Carmack's series. But does it look good for graphics, or behave well for gameplay purposes? No idea! Someone should find out what it's used for. It's an interesting little bit of historical excavation.

[+] jianshen|11 years ago|reply
This just caused a rush of nostalgia from a generation of PC computing that seems like a lifetime ago.

Norton Commander, Jazzy the Jack Rabbit, TheDraw, the Gravis Gamepad...

[+] doorhammer|11 years ago|reply
Jazz Jackrabbit and Commander Keen on a gravis gamepad are second in nostalgia only to playing the original Test Drive [1] and Stunts [2] on a crappy old joystick...

crap. Also playing Jet [3] on the same joystick.

  [1] http://en.wikipedia.org/wiki/Test_Drive_(video_game)
  [2] http://en.wikipedia.org/wiki/Stunts_(video_game)
  [3] http://en.wikipedia.org/wiki/Jet_(video_game)
[+] akurilin|11 years ago|reply
My dad still uses Norton Commander or some variation of it to this day. Never forget.
[+] Shivetya|11 years ago|reply
I would be so happy to see many of these games transition to tablets, are there good equivalents and/or have some actually been ported?

I have played PC strategy games ported to the iPad along with arcade classics from Atari, just missing some early games like Keen, Empire, and the like.

[+] techtalsky|11 years ago|reply
I have to say I saw every single pixel of every Keen game and I MUCH preferred the pure side view games over the isometric side view games of Episodes 4-6 and Keen Dreams. Episodes 1-3 had such an amazing, precise pixel design and a great sense of movement. The leaping just FELT right, with a slight pause while you pumped off the balls of your feet.

The later games, although much more detailed, with a larger character, had a weird floaty feeling to the controls that I never quite enjoyed playing as much.

That said, I loved all the games and it was an amazing sense of discovery. I remember the moment the shareware model finally took hold of me and I realized that I wanted the next episodes enough to pay for them.

[+] abraxasz|11 years ago|reply
Only slightly related but I read "masters of doom" recently and I can't recommend it highly enough. It is a very entertaining read even if you are not crazy over video games. It tells the story of the two Johns, and mention Commander Keen among other things. Great read
[+] bane|11 years ago|reply
Slightly related (from the same era). But the composer for the music for Unreal, Unreal tournament, Deus Ex, Tyrian, Jazz Jackrabbit and others has a music bundle for sale.

http://loudr.fm/bundle/alexander-brandon-bundle/hq4hZ

[+] eru|11 years ago|reply
I'm getting old, if people refer to Deus Ex and Command Keen as being from the same era.
[+] Pxtl|11 years ago|reply
Holy crap - I'm not normally one that gets super nostalgic over chiptunes, but the compositions in Tyrian were brilliant. Definitely getting that.
[+] Eiriksmal|11 years ago|reply
Ah, thanks for this. I've had Jazz Jackrabbit 3's ImpulseTrackers for ages, but never knew/bothered to find out who the composer was. I had no idea he'd worked up an official album for it.
[+] mikepurvis|11 years ago|reply
Thanks for the heads up! Really geeking out on Tyrian and JJ3.
[+] RunningWild|11 years ago|reply
Of note to anyone mentioning "Masters of Doom" are the following two items :

- Apogee Catalog from this time period : http://www.scribd.com/doc/134559074/Apogee-Catalog

and

- The Book of id (from the Id Anthology) : http://www.scribd.com/doc/137817173/Book-of-id

Bask in the nostalgia.

[+] jamesk_au|11 years ago|reply
I love some of the descriptions from the Apogee catalog:

Crystal Caves - "Stunning cinematic sequences"

Spear of Destiny - "Breathtaking soundtrack ... for AdLib, Sound Blaster or compatible"

Commander Keen 6 - "Over 2.5 megabytes of graphics created especially for this episode"

[+] cmapes|11 years ago|reply
I suddenly had a flashback to selecting soundblaster as my audio device..
[+] drzaiusapelord|11 years ago|reply
"There is not enough memory available to play the game reliably. You can play anyway, but an out of memory condition will eventually pop up."

Wow, I can't imagine a modern game giving this warning and still atempting gameplay. Guess a lot of people with low RAM machines had to take their chances back then.

[+] mr_sturd|11 years ago|reply
Carmack's piracy protection was bleeding-edge stuff, back then!

https://github.com/keendreams/keen/blob/master/kd_main.c#L39...

[+] readerrrr|11 years ago|reply
I wonder what that actually did.

For the confused. The piracy.h and those two lines were removed.

[+] jason_slack|11 years ago|reply
I thought that #if 0 doesn't get compiled and therefore definitely not executed. Can you explain more about your comment? I'm confused.

Edit: Corrected "not"

[+] cpayne|11 years ago|reply
I'm not sure what that means. Is that a good thing?
[+] hartror|11 years ago|reply
On your marks. Get set. Compile to JS using LLVM in 3...2...
[+] justin66|11 years ago|reply
I'm fairly sure my ancient copy of Teach Yourself C in 21 Days came with a CD including the book text and Borland C++ 3.1, which is mentioned on github as working. UPC code 0672310694, or: http://www.amazon.com/Teach-Yourself-21-Days-Sams/dp/0672310...

You can get yourself into trouble trying to use a newer version of the Borland compilers. 3.1 was the last to support native 16-bit code, or something like that, I believe.

However, I'd take a crack at making the Turbo C in the Embarcadero Museum work: http://edn.embarcadero.com/article/20841

I honestly don't remember what the difference between "Borland C" and "Turbo C" is (the former includes more) so I don't know if that will work. But the museum download is free...

[+] clarry|11 years ago|reply
If anyone's keen into doom, check out Doom 2 the Way id Did. In particular, look for the secret level (which also has the entrance to the other secret level).