Commander Keen 1 Clone

I recently stumbled upon some of my old sources; amongst others I found my attempt to rewrite keen 1. I started this project when I was 14, and eventually had to give it up due to lack of time.

A long time ago, when I was still using MS DOS and didn't have access to any kind of documentation (no internet!), I tried to rewrite Commander Keen 1. Here's the result...

I think I'd do a complete rewrite if I wanted to continue to work on it, but well... I have more important things to do these days (unfortunately). However, the program has some features that the original keen didn't have (most notably, spitting Greasels (inspired by Deus Ex)), so I post it here.

The only thing I did not implement was the BIOS scrolling stuff, because I did not have access to any information about that topic at the time I wrote this code. Namely, I did not know how to do the ugly hack of increasing the width of the virtual image in the graphics card memory;) (That's what causes the dosbox to look totally messed up when you play the original keen under windows and leave the full screen mode;) Of course, this would be a nice project;)

The game is not availably for download yet, as it includes some graphics of the non-shareware games keen 2 and 3 and generally requires some cleanup. I'm working on it, however.

Not a clone in the classical sense...

I imported the graphics from Commander Keen 1, but the maps are completely different. Also, some functionality has been added and some of the original stuff is different.

NOTE: Altough my goal was to get the whole functionality of the Keen game and add features afterwards, the project was not well designed and I learned a lot while I wrote the code. The result is a rather unstable thing;) unfortunately, I do not have enough time to fix these things. At times, the game can crash a win2k3 machine completely.
The idea to write the code for MS DOS was probably not the brightest one either...

Screen shots

Keen scene
A scene in rkeen (Keen 1 clone)
Keen scene
Playing an original Keen 1 map with some small modifications
Keen level editor
The keen IDE
A script excerpt
A script code excerpt (main menu function). The syntax hilighting works with an ugly hack: When "compiling" a script, the compiler outputs a .rtf file with the original source + syntax formatting stuff. The compiler's main task is to strip spaces and comments and to convert strings into integers, while storing the actual strings in a separate string table file.
A script excerpt
A script code excerpt after "compilation"
Keen console
The console, with the ls() function being executed (ls lists all global variables)

Source Code

If there's interest, I will publish the full source code (after a cleanup) under the BSD/GPL license. The program was written for MS DOS using Turbo C/C++ version 3. It includes its own scripting language. Elevator pictures were imported from Keen 2. The rest of the sprites were imported from Keen 1; the code was created by me from scratch.

Note for all those who are spoiled by UNIX: In DOS, you had seven memory models, and based on the memory model you had long or short pointers (long pointers contain a segment as well as an offset, short pointers are relative to DS) and other nice subtle differences. Also, you had a total 640kB of memory that the code and data had to share ;), 16 bit integers,... Lots of nice things. And yes, I almost forgot: direct hardware access, the best thing about DOS;) Programming the EGA graphics card in 4bit 320x200 mode is great fun.

For the curious, here's two of the original source files: The NPC code and the drawing functions


Powered by FreeBSD

Impressum
$Id: index.html 112 2008-04-27 08:59:17Z hc $