Wolfenstein 5K
  home | frequently asked questions | about the author

Launch the game in a new window
Spiffy  5K wall pattern Don't let the smile fool you!  They're out to kill you! Your powerful weapon Your score increases whenever you hit an enemy.  The farther you are, the more points you get. Your health meter.   When this runs out, you are dead.  Reload the page to play again. Enemies remaining before you advance to the next level.
Turn left Walk forward Turn right Walk backward Fires your powerful weapon
Shoot the evil enemies before they shoot you! Med kits increase your health!
Related Links
Wolfenstein 5K featured in New York Times (7/18/02)
Wolfenstein 5K Homepage at www.the5k.org
Raycasting Tutorial
Wolf5k Dissected
How to contact me
Contact Lee Semel at 5k@innofinity.com

 

Frequently Asked Questions

Browser Requirements
What's the origin of the name?
How are you rendering the graphics?
How do you get the 3D effect?
How did you fit all this stuff in 5K?
Why does it flash red?
Why are the enemies smiling?
How do I get a better weapon?
Why write small games like this, with all the advanced game systems available?
Will you be updating and maintaining the game?

Browser Requirements

Windows Users

  • Internet Explorer 5, or
  • Internet Explorer 6, or
  • Mozilla 1.1 or higher

Mac Users

  • Netscape 4.77

While the game runs in Netscape 4.08 and 4.75 for the PC, the animation is not smooth, with long pauses making the game unplayable.

IE for Mac and Mozilla 1.0 do not have the capability of rendering XBM images, a feature on which this game depends, so there’s no way to make the game run on these browsers

Your video display should be capable of a resolution of at least 180 x 120 pixels. This should not be a problem for most users.

What's the origin of the name?

The original Wolfenstein 3D was a DOS game released in 1992 by ID Software, the company later responsible for Doom and Quake. Wolfenstein 3D was one of the first first-person shooters, and launched a whole genre of such games. It took its name from Castle Wolfenstein, a 2D game released in the early 80s for the Commodore 64 and other computers.

If Wolfenstein 5K has sparked your interest in the original, you can download the shareware version. Wolfenstein 5K is approximately 150 times smaller than the original.

How are you rendering the graphics?

In most situations, dynamic rendering of graphics is confined to a server. For a fast-paced game, pixel-by-pixel manipulation of graphics on the client side is required. This game accomplishes this via two little-known browser tricks:

  • Most browsers can display not only GIF, JPEGs, and PNGs, but XBM images as well. XBMs are 1-bit black and white images, originally used within the X Windows System, that have a very simple format. Rather than being stored as binary data, an XBM file looks like C source code. This makes XBMs very easy to create dynamically.
  • IMG tags can accept Javascript urls in the SRC attribute, i.e. <IMG SRC="javascript:javascript expression here">. The value returned by the Javascript expression is treated as data for the image.

The combination of these properties allows you to take an array containing image data, turn it into an XBM image, store it in a Javascript variable, and have it displayed in the browser. This is exactly what the game does each time it needs to update the display.

Unfortunately, neither Mac IE or Mozilla can render XBM images, so there’s no way to make the game work on those browsers using this rendering method.

How do you get the 3D effect?

The game uses raycasting, a fast technique for simulating a three-dimensional maze using a minimum of computation. F. Permadi has written an excellent tutorial on the subject.

How did you fit all this stuff in 5K?

By writing the code carefully, and compressing it. I wrote a Perl program to replace all the variable names with shorter versions, remove newlines, and replace constants with numeric equivalents when shorter.

I also minimized the use of Javascript keywords such as function, var, if/else. Short variable names were assigned to built-in objects such as document, window, and Math. I removed excess braces, used global variables when possible, and employed various other syntactic shortcuts to reduce the size of the source code to 5076 bytes. Combined with the 1-pixel red image at 43 bytes, the whole game fits into 5119 bytes, one byte short of the limit.

Why does it flash red?

You’ve been hit. Alfred Hitchcock did something like this when he inserted an unexpected sequence of red frames into an otherwise black and white movie.

Why are the enemies smiling?

Because they are evil! It also makes them easy to see on the low-resolution game screen.

How do I get a better weapon?

You are welcome to add this feature, if you can fit it within the 1 byte remaining.

Why write small games like this, with all the advanced game systems available?

Flashy 3D graphics and sound are not a prerequisite for fun. Witness the continued popularity of the Nintendo Game Boy product line, first introduced in 1989, and of arcade games from the 80s and 90s available via emulators.

Simple games may continue to be a big business in the future. A number of wireless companies have developed standards for offering games on cell phones for a fee. I'd play Wolfenstein 5K on my cell phone, for sure.

Will you be updating and maintaining the game?

I plan to do one minor update based on the comments received, and to use a better compressor that a fellow contest entrant wrote.






      Copyright ©2003 Lee Semel - Updated July 12, 2004  
         
Spiffy  5K wall pattern Don't let the smile fool you!  They're out to kill you! Your powerful weapon Your score increases whenever you hit an enemy.  The farther you are, the more points you get. Your health meter.   When this runs out, you are dead.  Reload the page to play again. Enemies remaining before you advance to the next level. Turn left Walk forward Turn right Walk backward Fires your powerful weapon Shoot the evil enemies before they shoot you! Med kits increase your health!