Making Games on a Pi
2021-04-23
I don't think I've owned a computer that was ever "cutting edge" or "current" in my life. My first PC was a hand-me-down 386 that I was given when my folks bought our household's first Pentium. The last PC I bought myself was an ASUS Transformer Mini, which is one of those half-Windows PC, half-tablet devices. It was great, and a bargain price compared to similar laptops. I loved it, even though it was very underpowered. Alas, being a tablet meant that it had an all-glass screen, which cracked one day while sitting in my bag. Now it gathers dust, and my only Windows computers since have been low-spec laptops provided by my employer so I can remote into the office and do my job.
So being of little disposable income, somewhat familiar with Linux, and excited by the then-recently-released Raspberry Pi 4... I bought a Raspberry Pi 4 to be my main desktop PC. I've been using it for nearly two years, and it has introduced some challenges as a platform for making games.
Rewinding a bit to 2011: The first game I ever made was in Stencyl, a visual code editor based off of Scratch. After that I used Actionscript, thanks to a really good IDE (FlashDevelop) and game-making framework (Flixel). Eventually I transitioned to using Haxe, which has a port of Flixel and was similar enough to Actionscript to make the transition comfortable. I did all this on Windows machines, excepting the times I compiled builds on Linux to offer my work on those platforms. I'm mainly a self-taught programmer with a bit of tutoring in Actionscript, so I have a lot of gaps when it comes to established practices and skills. I get by with what I can learn from documentation or figure out myself. Sometimes that works, other times it ain't so fun. This was the background I had coming in to using the Pi as my main development PC.
HaxeFlixel
Naturally, I tried to jump back into my ol' faithful. My beloved IDE of choice wasn't available, I despise VSCode, and the Pi's preinstalled Geany was nice but lacked some features I had come to rely on, like really good code completion. I did my best to adapt to this new way of working, and it was going well until I tried my first test compile. It failed, referring to a missing .dll in a directory specific to the Raspberry Pi platform. To summarize a complex headache, HaxeFlixel has different folders for compiler instructions to work on different platforms, and the Pi one was just... empty. The folder was there, created by the Haxe installation, but it contained nothing. I searched the forums and found that the last time folks had this working was several versions previous. It was like these files just got phased out of Haxe at some point and no one had mentioned it. It wasn't the first time I had dealt with undocumented changes to Haxe or HaxeFlixel, and after trying to resolve the issue myself, I wasn't about to waste any further energy on it.
It's Linux!... but not THAT Linux
I consider myself a programmer, but I've also rarely been lucky enough to work as part of a team. Thus, I'd use programs like Audacity (for audio) and Glimpse (a fork of the Gnu Image Manipulation Program with the slurs removed) back when I was using Windows. Raspbian (now apparently "Raspberry Pi OS", despite still being listed as Raspbian within the OS itself) has repositories of free software that makes finding and installing them fairly painless with the right package manager. Audacity is in the Raspbian repositories, and it works great! Glimpse is not, however, despite the fact that Gnu-IMP is available. When I went digging, I found Glimpse available in some different package manager that claimed to support Raspbian, but I could never get it to work. I had also tried to directly download a number of applications that provided Linux versions, only to find them nonfunctional. It took me a bit, but I eventually learned that "supports Linux" isn't a universal signifier, especially on a Raspberry Pi.
I knew that there were 32-bit and 64-bit operating systems, usually listed as "x86" and "x64" respectively, and the version you use depends on the hardware on which you install the OS. The Raspberry Pi 4 uses an ARM7 processor, which is more like those found in mobile devices than what you'd use in a computer. The operating system, and any software compiled for it, are neither x86 nor x64; they have to be specifically compiled for ARM7 architecture to work. This meant that a lot of gamemaking tools that "support Linux" aren't available to me: tools like Godot, GB Studio, GDevelop (why do these tools all start with G? Coincidence, I'm sure), which work perfectly fine on x86 or x64 Linux systems. In GBStudio's case, I'm told if I can compile the source code for ARM7, it may work on my Pi... but learning how to compile from source has been tough. Almost every tutorial is written from a level of familiarity with using the Unix command line that surpasses my current ability.
This can't be everything, can it? Surely there are some options for making games on this tiny computer?
Web-Based Tools
Anything that runs completely in a browser is, for the most part, platform-agnostic. Two of my favourite tools are bitsy and Twine, and both work fine in Raspian's default browser (which is basically just Google Chrome). Like all web tools, you need to make sure you know where and how your progress is being saved: in bitsy's case, I have to periodically save the game's data to a .txt file. Unlike the rest of my past work, you can even play a couple of my bitsy creations, Minuit and I Ask U, over on itch.io! However, though I love these tools, they aren't always capable of creating the kind of work I want. Their limitations offer charm and challenge, but sometimes I need something more robust.
Python and LÖVE
So Python and Linux seem like peas in a pod; Python 3 was pre-installed in Raspbian, and there are multiple IDEs available, including the very good Mu. I'm still very new to Python but I love how it codes: its syntax feels downright elegant next to Actionscript and Haxe. I know there are gamemaking frameworks available, such as PyGame, but I want more practice with the basics of Python before I start trying to make games with it. I also have questions of portability: I don't know how self-contained one can make a Python app, and I hate putting things out that require a bunch of dependencies to be installed to make them run.
If I consider Python's syntax to be elegant, then LÖVE's Lua scripting feeks like the opposite. It's clunky and feels, I dunno, childlike compared to the work I used to do in Flixel, let alone Python. However, LÖVE is a really robust framework that also works natively on a Pi. I am again lacking an IDE that supports code completion on the same level as FlashDevelop used to, but I've had fun doing tutorials and getting things to work. LÖVE feels the most familiar to me out of all the tools I've tried. I can't quite put my finger on why, but I look forward to becoming more familiar with it and eventually making something worth releasing.
pico8
This final tool surprised me the most. Lexaloffle has been releasing and updating ARM7 builds of their all-in-one fantasy console to this day. You probably already know that it's an IDE, sprite editor, sound maker, and music composer in one package, built around the specific limitations of a non-existent retro console. It works really well on a Raspberry Pi. I've struggled with making things on pico8 for years; it also uses lua scripting, and the tiny window provided by the code editor made reading long lines tough, especially since I use verbose variable names (seriously programmers, if I can't tell what a variable is by its name, what is the point?). I also found things to be very poorly documented, but that has changed over time, and I've gotten a lot more comfortable with how to get things working the way I want. It isn't the most comfortable tool available to me, but it is the one I am most excited to keep using.