SCALE: Marshmallow on Raspberry Pi
Developers have used the diminutive Raspberry Pi as a platform for an assortment of computing tasks, but one of the most popular tasks has been entertainment—including video gaming. At SCALE 11x in Los Angeles, developer Guillermo Antonio Amaral Bastidas presented his work on the Marshmallow Entertainment System (MES), a retro-styled video game engine for 8- and 16-bit, 2D games. He compared MES to the competition (both open and closed) and explained what he has learned along the way.
Heroes and villains
Amaral does not simply talk the talk; his presentation was delivered in the form of a 2D side-scrolling MES game in which he navigated a character (which looked like him) through a game world—a world in which his text notes were embedded in a obstacle course (and, in some cases, floating by like clouds). He started off with a rundown of the other "open-ish" game consoles, comparing their openness and their specifications (both hardware and software).
The first was the Uzebox, a do-it-yourself retro gaming console based on an AVR microcontroller. The Uzebox offers little in the way of power, running at 30MHz, but it is 8-bit native, so game designers can build actual 8-bit, "Nintendo-style" games with the project's software development kit (SDK). The SDK includes a clock-perfect emulator, which is vital for testing games during development, and the project is completely open: open software and firmware, plus full hardware schematics. It may lack power, but Uzebox is also very affordable at US $60.
The GP2X is a slightly more powerful device designed as a handheld akin to the PlayStation Portable. It runs at 200MHz, which Amaral described as "mid-range" for such a system, and it is marketed as a ready-to-use consumer device. The SDK is open source, but Amaral said he was still unsure about the openness of the hardware. The GP2X is sold only in South Korea, so it can be difficult (and expensive) to find in other regions.
There are several Android-powered gaming devices on the market, he said, such as the Ouya and the GameStick. Both are very powerful, particularly for their price points (around US $80 for the GameStick, $100 for the Ouya, which is currently in pre-order). But they are both designed to play only Android games. So far, emulators have been promised but are not yet available. Amaral said he does not trust Android emulators to deliver a clock-perfect emulation environment, which should concern game developers. Both projects describe their SDKs as open source, but he said it was not clear exactly which components are available under an open source license and which are not. The hardware is proprietary for both products.
The challenger
MES has been two years in the making, he said. The early work was done on BeagleBoard and PandaBoard hardware, with the goal of creating a miniature game-focused distribution that anyone could download and run from a memory card on an off-the-shelf product. The BeagleBoard and PandaBoard were eventually discarded as being too slow at graphics, at which point he turned his attention to pre-release Raspberry Pi hardware. The Pi was an excellent fit because it can be safely overclocked to 1GHz, developers can write games for it in pure C++, and because it introduces few dependencies. He spent a considerable amount of time building the MES engine, plus the time required to get the Raspbian distribution into a workable shape (which included getting Qt4 running).
Lest there be any doubt, MES is entirely open source. It includes the stripped-down version of Raspbian which is focused solely on launching the Marshmallow game engine. He had initially intended each MES game to be installed on a separate SD card, so that they would be swapped in and out like the cartridges of 8-bit era game consoles. But the final builds used up just 110MB (for the OS and game engine), so he now recommends people install as many games as they want on a single card. The OS image uses a modified version of Buildroot and launches into a game selector screen. Amaral described the game selector as a work in progress, but the modified version of buildroot and other changes are all available on his GitHub repository.
During the development process, Amaral learned a few things about developing for the Raspberry Pi that he had not anticipated. The graphics capabilities are "awesome," he said, to the point where MES runs better on the Raspberry Pi than it does on his laptop. It even runs fine on the open source video driver, for those who do wish to avoid binary blobs. But audio support was less pleasant. The device supports both pure ALSA and OpenAL, but OpenAL runs too slowly to be useful. On the other hand, ALSA support was unsatisfactory as well; the device supports opening only one audio channel at a time. To get around this limitation (to, for example, provide background music as well as sound effects), Amaral wrote his own software audio mixer for MES.
A development wrinkle of a different sort is the Raspberry Pi's power cycling. The device has no reboot switch; it starts up when power is connected, and shuts off when it is removed. That can be annoying if using the device as a game system; more so while developing for it. To work around this problem, he designed an add-on board that sports a hardware reboot-switch. The board is called the Raspberry Pi Power Button, and the MES project sells it as a fundraiser, though the schematics are free on Amaral's GitHub site and anyone can build their own.
MES is just getting started as a game development platform. He described the engine as being "its own SDK," but so far there is not much in the way of a development guide. The SD card images come with a single demo game—though Amaral said he repeatedly encourages fans to contribute more to the game. The platform is BSD licensed, a decision he hoped would appeal to many independent game developers hoping to make products. Despite the newness of the platform, he said three gaming companies have contacted him to test it out, as well as attention from open source software and open hardware circles.
Raspberry Pi devices are a popular topic on the conference circuit these days, especially for gaming. But the most common gaming experience seems to be resurrecting 80's and 90's–era proprietary games for their nostalgia value. While that is certainly a source of entertainment, writing original games is more interesting, and MES shows that they can still provide that 8-bit retro feel, without the hassle of finding a legally-questionable ROM image from an old, commercial game.
| Index entries for this article | |
|---|---|
| Conference | Southern California Linux Expo/2013 |
