Home Blog: Archives Goods: Games About me
Home Archives Games About me

Another Visit in Hell

This game came out of a challenge posted by the regulars at the rec.games.roguelike.development newsgroup. The question was basically this - how much of a roguelike could fit inside a one-kilobyte source file?

As it turns out, quite a lot! This game features most of the staples of the genre: randomly generated dungeons, multiple enemy types, items and weapons, line of sight and magic spells (well, a magic spell). It still fits snugly under the 1024-byte limit (actually, it’s exactly at the limit). While everything had to be simplified by necessity, the game manages to be quite fun for a few plays, so I deem the whole experiment a success.

The version you can download here is actually the third attempt at cramming as much as possible into the game. The first one was called “A Journey To Hell”, and it had neither magic nor weapons. The second version introduced the weapons, while the third changed the way dungeon memory is done completely, which saved enough bytes to implement both magic and preparing your attacks to strike harder. Each time I looked at the code after a break, I found ways to make it even smaller. At this point, I’m afraid to tweak it anymore, lest it collapse into a black hole.

Binaries for Windows are available. Please look at the readme file for controls, and turn Num Lock on before playing. Or, if you don’t feel like downloading the big ZIP file, you can always copy it from the box below and run it through your trusty compiler.

#define F(v,h)for(v=0;v<h;v++)
#define D(i)F(y,23)F(x,T){i;}
#define G d[x][y]
#define Z(n)(n>0)-(n<0)
#define M d[x+Z(f)][y+Z(g)]
#define C(v,i)M^v||(i,M=e),
#define r rand()
int x,y,f,g,L,l=18,p=18,v,j,a,w=1,c,b,d[90][90],T=64,e=46,u=96,
"\nHP:%d/%d M:%d W:d%d L%d $%d %c ",l,p,j,w,L,v,L^9?32+a:87);c=

The resulting file will be a little bit more than 1024 bytes due to line-breaks added so that the source would fit within the blog layout.