Infinite Blocky Runner: A Game in 256 Bytes!


Here’s my entry for a Z80 coding competition I entered just a few years ago, in 2016!

The challenge was to come up with a Sinclair ZX Spectrum game in 256 bytes without using ROM routines, so the entire game is self-contained - input handling, rendering, data, code, everything. For reference, 256 bytes is about the size of this ray gun sprite, which is 16x16 pixels at 1 byte per pixel (256 colors):


Here’s my entry, “Infinite Blocky Runner“ (see below).

I've posted the source code for this on my Github here.

At the very least, this effort fits in (exactly) 256 bytes. I know of a couple of issues (the progress bar at the top will probably wrap in odd ways, should you progress far enough). There’s no audio, no difficulty progression, but you can at least die and restart.

The code was developed using the ASM80.com site and is formatted using the somewhat quirky code formatter there (so I make no apologies for the layout). I was able to develop and debug entirely using the site.

The approach I have taken here is basically to use zero data, everything is procedural. I've taken advantage of the fact that the Spectrum display is organized as a 1-bit bitmap with a 16-color attribute table, each attribute corresponding to an 8x8 pixel block, and so I am updating the attribute table only.

I should add that I’ve embedded JSSpeccy, the JavaScript ZX Spectrum emulator here in order to run the game. Let me know if this is working for you in the comments!

Press a key to jump. Enjoy. 🙂note: will not work on mobile devices without a keyboard.


The Spectrum can be pushed to do much more - below is an extract (from this YouTube walkthrough on the RZX Archive channel) from my game Crosswize to illustrate the point! Note, Crosswize actually runs smoother - at a solid 25fps - on the real hardware than in this emulated video capture. However, to pull off a feat like this requires trading memory for speed (Crosswize uses many unrolled loops and advanced dynamic compilation techniques) and of course much more development time. As a reminder, the Spectrum has a 3.5MHz Z80 and 48KB of RAM of which the screen takes about 7KB. I'll post a future article on how I approached the development of my games Sidewize and Crosswize and I'll delve into more technical details.

Crosswize on the Sinclair ZX Spectrum


If you enjoy my blog, you can help support it by buying me a coffee!

Comments

Popular posts from this blog

Odin Computer Graphics Part One : 1985

Software Projects : 1984

Nodes of Yesod : ZX Spectrum Next : Update #4