nCave is an experiment with the HTML5 Canvas element. It's a port of the old SFCave game for the Palm Pilot. I had hours of fun playing this game on my Palm m505 back in the day.

I initially tried rendering double-buffered animation using two canvas elements - a hidden back buffer and a visible front buffer. Blitting from the back buffer to the front buffer using getImageData and putImageData worked, but the performance was not great.

The current approach is to render the cave into multiple tiles, and slide these tiles across the screen. To hide the edge of the cave when the window resizes, there is a semi-transparent canvas with a gradient obscuring the right-hand side of the screen. Performance is better, but it still uses more CPU than I'd like, and on slower machines there are occasional frame rate drops.

You need a recent version of Chrome, Safari, or Firefox, with Canvas tag support, and probably a fairly fast pc. It renders correctly on iPhone and iPad, but the performance is too slow to be playable.

Play the game!