Racing The Beam With Super Hexagon

Early game consoles like the Atari 2600 had a very, very limited amount of RAM. There wasn’t even enough RAM for all the pixels on the screen; instead, pixels were generated by the CPU as they were being drawn. It’s playing with scanlines and colorbusts with code, something we’re now calling. ‘racing the beam’ for some reason.

[Sam] is in the middle of an EE degree right now, and for a digital design class he needed to write some Verilog. At the time he was addicted to the game Super Hexagon, and the game mechanics are simple enough for an FPGA. He built his own implementation, but not one with framebuffers. He’s using a pipelined approach where each pixel’s value is calculated just a few clock cycles before it’s displayed. It vastly reduces the memory requirements, on his Altera DE1 board compared to the framebuffer approach.

Video below.

24 thoughts on “Racing The Beam With Super Hexagon

  1. It used to be ‘ahead of the beam’ or ‘ahead of the raster’. There was even a magazine titled this way.

    It’s amazing what can be done with FPGA with so little memory. For as little as 30 bits of memory (less than 4 bytes) you have the core of a state machine that has more than a billion states.

      1. What is Ramless HDL if not a FSM? The number of possible states is 2 ^ number of registers. The complexity of each state is defined in combinational logic.

        As for ‘code’, just look at the gallery of this project and also the main page. He even has a state transition diagram. This project is exactly the example your asking for. It’s a complex finite sate machine with minimal registers and no block ram or processor.

        I have been with HDL (VHDL not verilog) for just on six months and it still fascinate me how much can be achieved with so little. I managed to get a pseudo random pixel pattern in VGA 800×400 with a 16 bit linear feedback shift register and still couldn’t visually see any repetition in the image. All of this was done with about 35 bits of registers.

        1. Hi. I’m the creator of the Super Hexagon clone. Technically the project does contain a 6bitx128 block of ram for storing the wall patterns, but that’s it. Everything else is registers, logic and a few lookup tables.

          Some of my first tests driving the VGA display involved picking bits from the pixel counters and feeding them straight out to the DAC (a simple resistor divider network) and the display. You could generate some interesting patterns fairly easily.

          I’m not sure if you missed it, but there is also a GitHub repository with the Quartus project and Verilog code:

  2. “Now we’re calling it racing the beam, for some reason.” Man, that’s the laziest writing ever. You’re writing an article, you’re supposed to find out what it means and put it in the article. Why would someone be dismissive and arrogant-sounding about a figure of speech, that is clearly referring to the electron scanning beam in CRT displays, on a tech blog? “Yeah, so there’s this new thing, called like, Arduino, whatever the hell that means, lol, probably means ‘noob f@g’ or something, lol, acting like I’m proud of my ignorance is awesome, lol.” Jeez.

    1. I think the author was making a tongue-in-cheek comment on how there is no ‘beam’ anymore, as most of our displays are LCD/LED/Other technology, but “Chasing the V-Blank” sounds slightly dirty, so we still call it ‘chasing the beam’ anyway…

    2. It’s a 150 word blog post. The etymology of beam racing is not the focus of the story, nor does the technical background of it play any role in [Sam]’s implementation of the game.

      Get off your high horse before you smack a tree branch.

    3. I wrote a comment on the term ‘racing the beam’ and I wanted to back it up with a link. After half an hour of googling, I gave up looking. I know it’s out there as I have seen it before. The problem is that according to the internet nothing existed before the internet. Information about the world before the internet is hard to find.

      So it may well be the case that [Benchoff] did spend time on the research bit that the research simply didn’t yield the results desired.

      The only references I could find was were wikipedia. I do however know that there is an old book archive somewhere that had the original magazine articles from the late 70’s early 80’s somewhere.

      So if the think this article is lacking something then please show us your google fu and show us the original reference’s.

        1. Yes I saw that book … several times … in fact I saw it everywhere and it was plastered all over wikipedia. It’s blocking the SEO of the original book and terms used originally back in the late 70’s early 80’s.

          It’s more or less the ‘reason’ I can’t find what I was looking for.

  3. Poor guy makes a little joke about the antiquity of a phrase, and the villagers pitch fork and torch up and go marching after him.

    Impressive stuff, talk about lack of bloat.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.