java maze - a fast java raycaster like doom or wolfenstein 3D
java maze was brought into existence by two factors; firstly, I'd recently picked up the Java language in my final year of Uni, and secondly, I'd (mis)spent the previous ten to fifteen years trying to coax pretty graphical effects from various computers - Texas Instruments TI-99/4A, Vic 20, Atari ST and 486 PC.
The desire to create real-time 3D in the web browser using Java was therefore born. My eventual aim was to create a raycasting engine (aka raycaster) with a visual appearance lying somewhere between Wolfenstein 3D and Doom.
The first prototypes (late 1999) were somewhat miserable in terms of performance. The shape rendering and bitmap stretching routines built into Java weren't living up to expectations in terms of performance. 2 or 3 frames per second on a Pentium 100, even with accurate texture mapping, wasn't quite what I'd hoped for.
The alternative approach came in the form of the MemoryImageSource, a Java class allowing the creation of on-screen bitmaps by pointing to an array of palettised or RGB image data. Surprisingly, this approach turned out to be several magnitudes more effective than the previous one - a couple of days effort and my applet was running at 18-20 frames per second in a 250x250 window (not bad in the days of 800x600 displays).
With a solid foundation to work upon (at least in terms of algorithms and speed, but perhaps not code elegance), my attention turned to adding whizzy effects to the engine. At this point, I had a raycasting engine that was roughly comparable to Wolfenstein 3D - texture mapped walls and a load of objects to walk around.
Within just days, the atmosphere created by the engine was transformed. Texture mapping had been added to the floors, and each square within the maze had been assigned a light level from 0-63 - with the colours displayed being pulled from a CLUT - a handy trick pilfered from my mode 13h days.
Unfortunately, my trusty Pentium 100 laptop with the dual-scan colour screen was no longer up to the job - the same 250x250 window could only yield 7-8 frames per second due to the additional processing overhead of the Z-buffer (to correctly display the objects amongst the walls), floor texture mapping and the CLUT lookup for each pixel. Convinced that I'd squeezed near-maximum potential from the Java runtime, I took the easy option and started testing on a Pentium2/233 - somewhat state-of-the-art at the turn of the century.
It was around this time the time demands of my first real job began to take their toll, and development of java maze was put on the back burner. Whilst I've made no changes in the interim, Vincent Stahl picked up the source code, tidied it up, and turned it into a full browser-based game. You can see the results of his handywork at Stahlworks.
Enough history - you're probably keen to see java maze in action:
If you're feeling particularly brave, you may wish to download and compile the source code. Bear in mind that this was last compiled by me around 7 years ago - your mileage may vary: