The Arduboy, Ported To Desktop And Back Again

A neat little hacker project that’s flying off the workbenches recently is the Arduboy. This tiny game console looks like a miniaturized version of the O.G. Game Boy, but it is explicitly designed to be hacked. It’s basically an Arduino board with a display and a few buttons, anyway.

[rv6502] got their hands on an Arduboy and realized that while there were some 3D games, there was nothing that had filled polygons, or really anything resembling a modern 3D engine. This had to be rectified, and the result is pretty close to Star Fox on a microcontroller.

This project began with a simple test on the Arduboy to see if it would be even possible to render 3D objects at any reasonable speed. This test was just a rotating cube, and everything looked good. Then began a long process of figuring out how fast the engine could go, what kind of display would suit the OLED best, and how to interact in a 3D world with limited controls.

Considering this is a fairly significant engineering project, the fastest way to produce code isn’t to debug code on a microcontroller. This project demanded a native PC port, so all the testing could happen on the PC without having to program the Flash every time. That allowed [rv] to throw out the Arduino IDE and USB library; if you’re writing everything on a PC and only uploading a hex file to a microcontroller at the end, you simply don’t need it.

One of the significant advances of the graphics capability of the Arduboy comes from exploring the addressing modes of the OLED. By default, the display is in a ‘horizontal mode’ which works for 2D blitting, but not for rasterizing polygons. The ‘vertical addressing mode’, on the other hand, allows for a block of memory, 8 x 128 bytes, that maps directly to the display. Shove those bytes over, and there’s no math necessary to display an image.

This is, simply, one of the best software development builds we’ve seen. It’s full of clever tricks (like simply not doing math if you’ll never need the result) and stuffing animations into far fewer bytes than you would expect. You can check out the demo video below.

21 thoughts on “The Arduboy, Ported To Desktop And Back Again

    1. You’re right for most software but this project is different. The goal here is pushing hardware to the absolute limit, not simply making a Starfox clone. On any hardware with plenty of overhead I agree, “clever” often equates to “cryptic and difficult to maintain”.

  1. repost or not, this is an interesting devlopment worth mentioning.

    Personally I’m interested in the sourcecode, how does it look like and how it is written, perhaps it allows porting to other platforms. Retro (65XX) platforms perhaps, yes I am aware that this has additional and different limitations compared to the 32u4. Considering I have no experience with 3D related code and am not aware of how object detection etc. works in such an environment, this would be a nice example to learn from.

    Perhaps someone knows of a good place to start or a good example, please feel free to post a link below.
    Thanks in advance.

      1. I’m sure you are right, but if you never done something in this area, then it is a bit difficult to know where to start, hence my question.
        But also because the best way to learn programming is by learning from what already exists and modifying that step by step to gain knowledge.

        So in other words, I know it is well understood, I know it isn’t rocket science, though I doubt that “anyone” can pick it up and learn. But I’m just scared and need someone to hold my hand… in other words a simple but working example.

        I asume that (according to the fact that “it is all very well understood”) you have an abundance of examples (links) lying around and are willing to share them?

        1. Ok, off-topic, but….

          This is the 7th year we (a group of cranky old engineers) have run summer seminars in embedded systems at a local high school.

          The primary and most effective method for learning hardware design and software architecture and programming stuff is by solving a problem, whether extant or original or novel. Those that focus on studying existing source code are the most apt to not have a complete or functional project at the end of the seminar.

        2. If you think you can’t learn anything from the resources already available online you will definitely learn absolutely nothing from Starduino’s heavily cut down 3D code.

          > I asume that (according to the fact that “it is all very well understood”) you have an abundance of examples (links) lying around and are willing to share them?

          You’re right, there are so few open source 3D engines and examples and tutorials online to learn from that you need a heavily-cut-down-optimized-butchered-for-speed-with-cryptic-AVR-assembly-and-fixed-points-bit-shifts-and-pointer-magic 3D engine.

          Give me a break with the [there’s not enough resources online] argument.

          The only people who could possibly figure out what’s happening in the Starduino code are people who can/could already write their own 3D engines/GPU drivers from scratch.

          It’s not built for maintainability and readability (and learnability). It’s built to throw heavily compressed meshes at the rasterizer as fast as possible with a math precision cut down to be just good enough for 128×64 (and even then…) with everything else stripped out and quite a few “bad” coding practices when taken out of context (context being I got 2.5KB of RAM and 28KB of ROM to work with).

          Thrust me; I’m doing y’all a service, kids.

          Wax on. Wax off.

          1. Dear RV6502, sorry i asked… (it won’t happen again)
            The last link really shows you take your comments seriously, i would never have found that on my own :)

            I recalled asking a simple question, but all I get is “smart” people commenting the obvious. Sometimes highly optimized code IS the way to go and can be very helpfull if you want to run something on very limited systems. Considering limited and you having 6502 in your name, I guess you know what I mean with limitted systems.

            I’m pretty sure I can build a moonrocket by googling for all parts. And the whole concept of moonlandings is very well understood. I never mentioned I couldn’t find anything. I was only hoping to find people who have good experience with this or similar code and perhaps someone could propse a nice example to start with or learn from.

            So as a comparison, I didn’t asked for the plans of the moonrocket, I merely asked for the building plans of a simple kite. Sure, it may have nothing to do with flight from your perspective but it does go up and seems to “fly” beautifully. Which is the great achievement in this project, so impressive it resulted in two articles on hackaday.

          2. This behaviour is getting tiresome:

            Step one: Don’t do very basic research, demand people do it for you.

            Step two: When not spoon-fed the information pretend in a snarky challenging tone you need links provided with the implication it’s difficult to find.

            Step three: When proven the information is easy to find act hurt and offended, being “sorry I asked” and traumatised by the experience “It won’t happen again”. Assert victim status while throwing even more snark.

            Step four (Anytime now): Escalate, report, claim the hacker community has a toxic elitism* problem.

            * throw in a few more -isms for bonus points if you qualify.

            This is not new, there’s even a term for it: “crybully”. But the fact that the hacker/maker/foss/online communities have been giving them power to waste everyone’s time or else face the wrath of the “code of conducts” has become a real problem. It’s even infected the Linux kernel community.

            Hopefully HaD doesn’t fall into that trap.

    1. >not aware of how object detection

      You can do some primitive object detection by having a rectangular bounding box around an object e.g. (xmin,ymin,Zmin) to (xmax,ymax,zmax). Checking is just a whole bunch of comparison statements to see if their boxes overlap each other.

      Disclaimer: I don’t even do graphics.

      1. So I imagine an array of obstacles and the game/program is constantly browsing through that array (in a sensible way) to check if values match based on current location and a certain box (or set of boxes to represent a more complex shape) representing the players vehicle.
        okay, that actually isn’t as complicated as I expected, thanks for the tip

  2. Hello, I’m looking at your attiny10 project on USB.. I was curious can it be done with arduino code? I’m not sure how to program raw code like that.


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.