With the new 2.3.1 release of GameMaker Studio 2, we now have the option to build games for Raspberry Pi via the Ubuntu ARM export. This is ideal for small DIY games consoles, or kiosk installations, as Raspberry Pi are inexpensive options.
I’ll be going over the steps needed to set up a Raspberry Pi to build GameMaker builds. This guide assumes you are somewhat familiar with using a command-line, and SSH. This guide does not go into actually running the game itself, which may require a few more steps.
This guide is current as of beta IDE v18.104.22.168 runtime v22.214.171.124
Getting the equipment
The first step is to acquire a Raspberry Pi. There are many models available, but the current recommendation is to get the Raspberry Pi 4 with 4GB RAM; game builds take a bit more resources than playing them so a Pi 4 with 4GB RAM gives us plenty of space to do that. Players can play with a lower-specced Raspberry Pi (depending on your game of course).
The full set of equipment you’d need is:
- The Raspberry Pi itself
- A Micro-SD card (at least 4 GB)
- A USB-C power adapter (recommended 15W or above)
- A micro-HDMI cable for your monitor
- OPTIONAL: a case for the RPi 4
- A monitor
- Mouse and Keyboard
- Micro-SD card reader
- OPTIONAL: ethernet cable for your wired internet (you can use Wifi otherwise)
Note: items 1 through 4 are often purchasable as a bundle, containing RPi, Case, SD card, power supply, and micro-HDMI adapter
However, if you don’t actually care about using the RPi to play the game, and just want to get builds up an drunning with the least effort and parts, we can drop the mouse, keyboard, or monitor/adapter. We’d only need.
- The Raspberry Pi itself
- A Micro-SD card
- A USB-C power adapter
- Ethernet cable (which can be removed later once wifi is set up, or continue using over wired network)
- A Micro-SD card reader
Here’s my RPi. I like the passive thermal-conductive case that makes contact directly with the components that need cooling and conduct heat to the top of the (cast aluminium) case itself. I re-used an old phone charger, and micro-SD card I had, so the only parts I needed to buy were the RPi and case.
The Raspberry Pi
The Raspberry Pi is a small single-board-computer, originally built to be as low-cost as possible while still operable as a full linux computer, intended for educational purposes. Its low cost and ubiquity drove its popularity with hobbyists, leading to a lot of projects, examples, guides, and hardware being made.
Partly as a result of its popularity, over time newer versions of the RPi became more powerful, but also more costly. The RPi 4 is now a very capable device, but it’s several times more expensive than the original. Its popularity and higher profile have lead to what some might consider “unusual” peripherals such as this heatsink and fan
What’s important from a software development point of view is that the Raspberry Pi runs an ARM CPU, and some flavour of linux. If you want to compile programs to run natively on the device, you need to grab not only an ARM compiler, but a specific one to the OS running on it.
GameMaker Studio 2, in days prior to 2.3.1 could only make two kinds of builds targeting ARM computers: Windows UWP ARM, and Mobile (Android/iOS). However, the only way to use these games on RPi, was to either install Windows ARM OS (and I hear the UWP support is patchy and weird at best), or Android on the RPi.
Thanks to the efforts of YoYo Games, GMS 2.3.1 now has an Ubuntu ARM build as part of the Desktop license, allowing us to build and play games directly on RPi’s linux installs, without having to get another export license (you still need the Desktop export license though, which most people using GMS have), and risking the weirdness of using UWP or trying to get Android running on RPi (it’s doable)
Step 1: Setting up your Raspberry Pi
Once you’ve received your Raspberry Pi, put it together with whichever case you purchased (if you did purchase one). Before you power it on, we need to prepare the Micro SD card.
A Raspberry Pi works exactly like a small computer. It has USB ports, networking, monitor (though beware: RPi 4 uses micro-HDMI ports, which you’ll need an adapter for, older RPi had full-sized HDMI ports), and usually boots from a Micro-SD card. The main difference between RPi and a regular desktop from a system builder point of view is, where a regular desktop you’d boot up using a bootable USB drive containing an OS installer (like a Windows installer image, or a Linux installer), the most common way to set up an RPi is to download one of the several RPi images, and write them to the Micro-SD card directly, skipping the install step.
Head over to the Raspberry Pi OS page, and download one of the images.
For those who want to play the game on the RPi and/or use it for desktop purposes: select the “with desktop and recommended software” option. If you just want the minimum setup for building, select “Lite”
Next, head over to balena’s Etcher page to download a tool to write this image to the SD card
Plug in the Micro-SD card. Once both have finish downloading, and you’ve installed (or ran the portable version of) Etcher, you’ll see this menu. Click “Flash from File”, and select the zip file you just downloaded.
MAKE SURE YOUR MICRO-SD CARD IS SELECTED in the device selector in the middle column of Etcher. You don’t want to accidentally wipe an important drive by accident. Once you’ve triple-checked the device is the one you want to put Raspberry Pi OS on, hit “Flash!”
Once the flashing is complete, Windows may complain that there is an unformatted disk drive plugged in, hit “cancel”. This is expected — Windows can’t read this newly prepared Raspberry PI OS drive. If you opt to format it, you’re going to need to re-run Etcher again.
At this point, if you just want the fastest setup to build, you can enable SSH right now, rather than having to boot it up, plug in a mouse/keyboard and configure it by hand. Normally RPi OS starts with SSH disabled, but a awy is provide to enable SSH from first boot without additional config (useful if you want to just build games without ever needing to plug keyboard/mouse/monitor in): go to the Boot drive that will have just appeared once you finished flashing, and create a file called
ssh in there (no extension)
Step 2: Configuring stuff
If you’re setting up the RPi like a computer and wanting to play games on it, plug the newly flashed MicroSD card into the RPi, connect up your monitor, mouse, and keyboard, and network cable if you have one, then plug in the power. Your RPi will now boot up, you can set up your network, and any other preferences. Open up a terminal app, you’ll run the commands from the next steps in the terminal.
To get your IP if you’re on the RPi already, you can juts use
ip a or
ip addr show, your IP address will be listed under
eth0 if you’re wired in, or
wlan0 if wifi
For minimal setups, you’re not going to plug a keyboard/monitor in, instead everything will be done remotely over the network. Plug the newly flashed MicroSD card into the RPi, plug in the network cable, and then plug in the power. Wait for a minute or two for the green LED to stop flashing, which will indicate bootup is completed. Now, you will need to go figure out what IP address your RPi got from the network. You can do this either by port-scanning for it (use port 22), or if you can access your router’s admin panel, you can see if a new DHCP lease was given out. On mine, it shows the host name as “raspberrypi” and has acquired the IP address 192.168.1.113, yours will almost certainly be different.
If you can’t access the network admin panel, and can’t port-scan for the raspberry pi, you can always plug in a monitor keyboard and mouse, and find the IP address from there.
Once you have the IP, you can now SSH into it using an SSH client. The default username is
pi and password is
raspberry . Your computer probably already has an ssh client in the terminal, the command is probably
ssh email@example.com (replace the IP address with your Pi’s). If you don’t have an SSH client handy, download PuTTY
At this point, you should probably change the password. Use the
passwd command to do so. You can also set up your own user account to avoid using the
pi user, but that’s up to you.
Step 3: Installing the required packages
Either inside the terminal app when you’re piloting the RPi from keyboard, mouse, or monitor; or over SSH if you’re doing it over the network, first update your system’s package registry using
sudo apt update, then issue a
sudo apt upgrade to install updates on everything; it’s good to start with an updated system.
Next, install the build requirements for GameMaker:
sudo apt install build-essential clang libssl-dev libxrandr-dev libxxf86vm-dev libopenal-dev libgl1-mesa-dev libglu1-mesa-dev zlib1g-dev libcurl4-openssl-dev zip
Step 4: Set up Gamemaker
From the build-target menu inside GMS 2.3.1 or later, select “Ubuntu”, “YYC”, and click on the Device Editor button.
If you don’t have “Ubuntu” platform, then you don’t have the required Desktop license
In the device editor, add a device and punch in the details, including IP address from before
Step 5: Build your game!
Once you’re ready, hit build. If all things go well, you should after a few moments, have a game built! You can watch the CPU load go up on the RPi while you build by using the
Known issues and workarounds for 2.3.1 beta
Ubuntu icon incorrect
Currently with 2.3.1 beta, sometimes, the Ubuntu build icon is invalid, you will need to grab a 64x64 png image to use as a game icon before it’ll build
Backslashes in filename
Currently with 2.3.1 beta, the last few steps of the build process will fail due to backslashes in the file path. Subsequently, the build will not provide you with a game zip. This can be worked around manually
Once the build fails, on the raspberry pi, if you
ls your home directory (or where you asked GameMaker to install, you’ll see some suspect filenames that contain backslashes. To manually complete the last few steps of the build, run the following:
mv 'GameMakerStudio2\game_project\game_project.zip' game_project.zip
unzip -o game_project.zip game_project
chmod +x game_project
zip -g game_project.zip game_project
game_project with your game’s project name. This process renames the generated zip file to something more sensible, extracts the executable file from it, adds “execute” permissions to it, and sticks it back in the zip. This appears to be the last few steps that are failing on the build. This Zip file
game_project.zip should now be the same zip that you would have received had the build succeeded.
To copy that file over to your windows machine, use
scp command, e.g.
scp firstname.lastname@example.org:~/gaem_project.zip ./ or download FileZilla client, and connect to your RPi with address
ssh://192.168.1.113(use your actual IP). Or throw it on a USB stick, or upload it in a browser, or any one of many options for transferring files around.