Ich habe eben in den FAQ nachgelesen, wie der Autor das gemacht hat. Das Programm nutzt geniale Tricks aus und verwendet sogar Raycasting (5KB Code !!!).
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 Ⅹ Windows System, that have a very simple format. Rather than being stored as binary data, an XBM file looks like Ⅽ source code. This makes XBMs very easy to create dynamically.
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 did you fit all this stuff in 5K?
By writing the code carefully, and compressing it. Ⅰ wrote a Perl program to replace all the variable names with shorter versions, remove newlines, and replace constants with numeric equivalents when shorter.