This post will cover setting up a Ubuntu virtual machine on VirtualBox which you can use to build Linux versions of your Gamemaker Studio 2 games. You only have to set up your Virtual Machine once and after that’s done, it takes less than 5 minutes to build a Linux version of your game. I have basically no idea what I’m doing and I managed to get this set up, so there really is no reason not to support Linux!
Firstly I’m going to outline some ‘quirks’ I’ve found with Linux:
- Checking the gamepad select button (gp_select) does not work. I work around this by checking button index 16 (e.g. gamepad_button_check_pressed(pad,16))
- window_get_visible_rects(x1, y1, x2, y2) returns a completely empty array regardless of number of displays (I’ve reported this as a bug but not heard back yet)
There may be more issues that I have yet to come across. If you know of any, let me know so I can include it!
Firstly, we need to install VirtualBox. You may also use HyperV, which is included with the Windows 10 OS, but this guide will cover VirtualBox.
Once VirtualBox is set up and running, we want to install Ubuntu. You can find the version recommended for Gamemaker Studio 2 here, so go ahead and download the disc image.
Meanwhile, in VirtualBox, select ‘New’ to create a new virtual machine. Call it ‘Ubuntu’ or similar; it should pick this up and automatically set “Type” to “Linux” and “Version” to “Ubuntu (64bit)”. You can then proceed through all the remaining dialogue, choosing all the recommended settings.
After all the setup dialogue, your Virtual Machine has been created. We need to change one setting and insert the disc image, so select “Settings” and go to “Network”. You want “Enable network adapter” checked and select ‘Attached to: bridged adapter’.
Whilst still in settings, you also need to insert the disc image you downloaded earlier. So select “Storage'”, select the CD icon from “Storage Devices”, then under attributes there will be another CD icon – click on this, choose “Select Virtual Optical Disk File” and navigate to the disc image you downloaded.
Now you can close settings and start your virtual machine. Proceed with the installation as instructed.
At this point I am going to refer you to this blog post on YoYoGames, it gives you instructions on everything you need to install on your new Virtual Machine and how to do so. It also gives instructions how to actually build using your new Virtual Machine.
Make sure you read the instructions very carefully, I made several mistakes trying to build because I didn’t!
Note that your guest machine will have considerably less resources available to it for running your game, so expect it to run very poorly – this is not a reflection on its performance on Linux. I have some friends who can play on Linux to test it out, but other than the issues outlined at the very beginning of the post, everything seems to work as expected!