Tips and trick on how to make a working Linux build for RMXP

After finishing my first game for the Cozy Places event, I ended up learning a lot about making a working Linux build in the engine that I used, RPG Maker XP, so I thought it will be a good opportunity to share my learnings. Special thanks to Irog for testing my build several times to get it working.

Issue 1: Text doesn't show

What happened?
RPG Maker XP uses Arial as its default font, and with it being Windows-exclusive, it's obviously won't be available in Linux. RPG Maker XP uses system font to render its text, so it won't show any text if the used font isn't installed in the system.

What you should do as a game developer:
From my understanding of the license, you can't redistribute the Arial font, so your only option is to change the default font. Go to the Main script by pressing Tools > Script Editor from the menu (or F11), find a script named Main, and copy this below the begin line.
  Font.default_name = ["Arial","FreeSans"]

if !Font.exist? ("Arial")
# set custom setting for freesans font
Font.default_size = 24

What this will do is that it will fallback to FreeSans whenever the Arial font isn't available in the player's machine, and set its font size to 24. I found that FreeSans is smaller than Arial by default so I ended up increasing the size.

You are free to change FreeSans to any other font that you need. However, do not forget to always include either the .ttf or .otf file in your game files, namely in a place that is accessible to the player (example: Font folder in their game directory) so they can manually install the font if needed.

Alternatively, you also can use an auto install script like this to install it automatically when the game is run.

What you should do as a player:
If the game doesn't have a fallback font, you have no choice but to install the Arial font manually. Refer to this article or section 2 of this guide for more info.

Issue 2: BGM doesn't play, but SFX plays just fine

What happened?
There is an issue with DirectMusic in Wine. RPG Maker XP will run any MIDI files (the ones with .mid extension) through DirectMusic Synthethizer, so it won't run the music if it has issues.

What you should do as a game developer:
Change all of your .mid files to .ogg. One way to do it is through VLC.

If you do it from VLC, go to Tools > Preferences (or CTRL+P), click on the Input / Codecs tab, and see the Show settings tickbox on the bottom left. Tick it to All.

The layout should change. On the left side, find Input / Codecs > Audio codecs > FluidSynth. You need to provide a SoundFont file through the Browse button. There are several sources where you can find this. I can't remember where I got the link from, but I downloaded mine from here, the one stated under GeneralUser GS 1.471.

Once you put the SoundFont file in VLC, exit the Preferences menu, then go to Media > Open Multiple Files (Ctrl+Shift+O). In the file Tab, click the Add button to add all of your .mid files, then click on the down arrow button next to the Play button, and click Convert (Alt+O). A new menu should pop up. Tick the Convert button in the Settings, then find Audio - Vorbis (OGG) in the Profile dropdown. Click Start to convert them all to .ogg.

Once you are done, replace your .mid files in your RPG Maker XP project manually to .ogg and deliver it to your players. If you compressed the file in RPG Maker XP, double check to ensure that the .mid files are included in your project file as well after it is being extracted.

What you should do as a player:
Add DirectMusic to Wine. Go to this guide and follow step 4 for more details.