Friday, February 12, 2021

Case study: RPG Maker games on Raspberry Pi [2000][2003][XP][VX][VX Ace][MV][MZ]

🕐🕐 Duration: 2 to 3 hours (nw.js;Tapir;EasyRPG)
🕐🕐🕐 Duration: Up to one day (Wine-based RPGXP, RPGVX and RPGVX Ace)
🔧🔧🔧 Difficulty: Somewhat difficult
🌟🌟🌟 Interest: Interesting

[Updated May 20, 2021: Added nw.js engine for RPGMaker MV and MZ]
[Updated July 11, 2021: Okay I finally added EasyRPG to be complete]
[Updated January 06, 2022: Added a link to deal with sound issue problems]

Tinkerers fans of indie games probably already know the marvels that EasyRPG bring us: namely RPG Maker 2000 and 2003.

The real outbreak of RPG Maker games happened between 2005 and 2015 when indie developers started seriously with XP, VX and VX Ace.

Recently nw.js also has provided a very decent solution for MV and MZ engines where the game database is still growing today.

This makes those 5 really interesting to get to run on your favorite berry fruit.

Is it possible?

RPG Maker VX Ace can be simple if you know what you are doing. Basically the main pitfall here is to choose your Wine version carefully and use a pristine wineprefix.

I used wine-5.0.2-stable for debian x86 and Box86. If you need to install Wine, go there. Then, you have to download the VX Ace RTP here. Once downloaded:

sudo apt-get install unzip
unzip RPGVXAce_RTP.zip
cd RPGVXAce_RTP/RTP100
WINEPREFIX=/home/pi/path/to/rpgmaker/wineprefix/ /home/pi/path/to/wine/x86/502/bin/wine setup.exe

This should install RPG Maker VX Ace RTP on your dedicated wineprefix. You can run any RPG Maker VX Ace game afterwards by typing:

cd /home/pi/vxace/game/path/
WINEPREFIX=/home/pi/path/to/rpgmaker/wineprefix/ /home/pi/path/to/wine/x86/502/bin/wine Game.exe

RPGMaker XP is tricky to make run. Here is a little troubleshooting:
  • Game location: always store your game somewhere on your C drive in your wineprefix.
  • Fonts: see hereafter how to install the fonts. Install any provided custom font.
  • RTP: RTP has to be inside the game directory. Wine does not really handle well system-wide installed RTP
RPG Maker XP RPGMaker Raspberry Pi Game directory
Your game directory should look like this

  • First try to run the game without changing anything.
  • Edit Game.ini and replace RGSS102E.dll with RGSS104E.dll to improve compatibility.
  • You might try to unpacking Game.rgss* (the main game resource) in the game directory.
  • Avoid "Script is hanging" by starting the game alone and first after boot (no other opened window), set your governor, overclock your Pi and use GL4ES (see below).
  • If after unpacking Game.rgss* and improving the performance all the possible ways you still get "Script is hanging" then, the game is unfortunately unplayable.
  • Game can be unstable.
RPGMaker VX is almost like RPGMaker XP in worse: slower and fewer games run.
  • VX game coverage is the lowest.
  • RGSS202E.dll is not compatible, need to switch to RGSS202J.dll in Game.ini
  • Chance to get the game through "Script is hanging" is slimmer than with XP
  • Fortunately VX game base is the smallest.
  • Game can be unstable.
[UPDATE May 20, 2021]
RPGMaker MV and MZ games can be run thanks to nw.js. The performance is decent. It's quite tricky to run and everything is documented there. The only change you will have to do is to provide an inline setting --use-gl=gles instead of --use-gl=egl.

If you want to save yourself the trouble of getting the right release from LeonardLaszlo's git and tweak it to make it work, I made a bundle here to download.

If you are using my bundle, the process is quite simple: untar it, and brute copy all the contents of the untarred directory right into the target Game.exe directory. Game starts afterwards with ./start.sh
 
If you are using LeonardLaszlo last build, the process is slightly different. You will have to untar the release file and then untar the chromium version. Brute copy afterwards the untarred chromium version right into Game.exe directory and start the game with:

./nw --use-gl=gles --ignore-gpu-blacklist --disable-accelerated-2d-canvas --num-raster-threads=2

Don't simply type "./nw" because the graphics will be rubbish and the game will be unplayable.

Troubleshooting
When running a MV/MZ game through nw.js you might have bugs and crashes here and there because Linux doesn't find some resource (png image for example) within the image directory. It's because Linux is case sensitive and Windows isn't. Be careful about the capital and small letters in the name of the resources and rename the files accordingly to debug your game. Unless the coder was really dirty, it shouldn't happen too often.
Tip: how to rename all files to lowercase. Use zip/unzip method.

[UPDATE July 11, 2021]

RPGM2000 and RPGM2003

 
To be complete, I decided to finally add a RPGM2000 and RPGM2003 section. Those can run through EasyRPG. EasyRPG is not really a challenge to install and the pointers are available on its git but you will have to build liblcf and link it correctly. Here are the pointers to get EasyRPG running:
 
Liblcf 
 
cd ~
git clone https://github.com/EasyRPG/liblcf
cd liblcf
autoreconf -i
cmake .
cmake --build .
sudo cmake --build . --target install
sudo ln -s /usr/local/lib/liblcf.so.0 /usr/lib/arm-gnueabihf/liblcf.so.0
 
EasyRPG player

cd ~
git clone https://github.com/EasyRPG/player
cd player
autoreconf -i
cmake .
cmake --build .
sudo cmake --build . --target install 

This is it, you should be able to run by:

cd /your/favorite/rpgm200x/game/dir/
easyrpg-player

Fonts

You might encounter a font issue at some point: game does not start or no text displays. In that case, just type:
 
sudo apt-get install ttf-mscorefonts-installer
 
[UPDATE January 06, 2022]

Sound issues

See this post about problems with DirectX audio that can occur while trying to play RPGMaker games

Performance

Performance is quite low. It stays playable for all the engines but the FPS stay quite low. Don't expect to run games faster than 5 FPS. Playing huge games (500mb or more) can be laborious.

For RPGMaker XP and RPGMaker VX, you will have to push your Pi a little to avoid "Script is hanging":

  • (If needed) Install cpufrequtils 
    sudo apt-get install cpufrequtils
 
  • Set governor to userspace and a good frequency (1400Mhz or 1200Mhz if you experience voltage drops)
    sudo cpufreq-set -g userspace
    sudo cpufreq-set -f 1400Mhz
  • Use GL4ES with rendering discarding:
    LIBGL_SHRINK=1 LD_LIBRARY_PATH=/home/pi/gl4es/lib/ WINEPREFIX=... .../wine ...
  • Unfortunately will not start in RetroPie. Window will be tiny and not resizeable.
  • Don't mash buttons (unstable).
  • "Script is hanging" happens less often when started from minimalist xserver and startx. See here for more info on this opportunity
  • If you still have performance issues ("Script is hanging"), consider overclocking Pi, GPU and SD Card.
  • Running your games from a(n A2) SD Card will also improve performance.
  • Using "nice -1" can help your Raspberry Pi manage better your game. Actually "nice -1" will work better than "nice -15" or lower.
Should make your game start. XP and VX will still stay very unstable but it is better than nothing... I guess... 
 

Alternative: Tapir

For non WIN32API games, TAPIR gives a good response to the slowness issues and performs outstanding compared to classic RTP through Wine and Box86. This solution is pretty straightforward to install, assuming you are starting from a pristine OS. If you messed up SDL2 and libboost packages, it will be very difficult to get it to compile without blanking your OS back to stock PINN install. Check Tapir with Crysalis game to notice the performance difference with RTP. 

While Tapir might be a dead project, it is the only engine rewrite that currently works on Raspberry Pi.

Doesn't work: mkxp

Unfortunately, mkxp and all their forks (hiddenchest, mkxp-z, mkxpplus) don't work on Raspberry Pi. While you will eventually succeed compiling them they will not start games properly. Script errors will appear and mkxp-z will not properly detect WIN32API on Raspberry Pi

However, mkxp and forks are very alive and we can hope they will increase our RPGMaker games compatibility one day. Mkxp might definately become the future of RPGMaker games on exotic platforms like the Raspberry Pi.
 

Doesn't work: JRGSS

JRGSS will first not compile as is on Raspberry Pi. If you want to compile it, you have to remove the "runtime" xml tag from Player-Desktop/pom.xml (line 96):
 
compile jrgss on raspberry pi linux
Get rid of this MAC-based line
 
When doing so the engine will compile smoothly thanks to maven but it will fail to build game bundles and won't launch games.

Game coverage

XP and VX game coverage is unfortunately random at the moment since most of games end in "Script is hanging" or segmentation fault. Most compatible RTPs are RGSS104E.dll and RGSS202J.dll. If the game provides a launcher out of Game.exe, try it too. If the game doesn't use WIN32API, try Tapir.

However, VX Ace brings us a nice surprise: a lot of games work. You will have to be careful about unicode-named scripts which can give you a challenge because file will not be found. Games are otherwise quite straightforward to play although most of them will be slow. 

MV and MZ will not reasonibly work on Apache server solution but after some exploring they actually give the best result when using nw.js. MV and MZ give a very good game coverage as the only issue you are likely to meet is the case sensitiveness of the resource files.

Resolution

When playing any RPG Maker game on a desktop environment, you can expect a tiny window inside your big 1920x1080 screen. You can trick that away with either xrandr (Fake-KMS) or tvservice (VGA).
 
xrandr -s 1024x768
 
On Raspberry Pi OS you will have to use xrandr after the game has started. Games tend to reset xrandr especially when ran with GL4ES

See this article to use tvservice.

Most of the RPG Maker runtimes can be implemented in RetroPie following the forementioned article. Implementing a chromium RPG Maker MV in RetroPie or Raspberry PI OS 32 Bits is a matter of choice.

To summarize, here is a quick overlook on what you can do to get most of your RPG Maker games running on Raspberry Pi:


Engine
Solution
Game Coverage
RPG Maker 2000
EasyRPG90%
RPG Maker 2003
EasyRPG60%

RPG Maker XP
RPG Maker VX
RPG Maker VX Ace
No WIN32API
Tapir80%
RPG Maker XP -
WIN32API
Box86 + Wine 6.0.0 + RTP
in game directory
GL4ES Don't forget fonts!
50% - slow and unstable
RPG Maker VX -
WIN32 API
XP in worse
10% - very unstable
RPG Maker VX Ace
WIN32API
Box86 + Wine 5.0.2 + RTP    
90% - slow but stable
RPG Maker MV
RPG Maker MZ
nw.js
90% - decent

RetroPie

RPGMaker can be used via Wine, RTP or Tapir. All your runnables will be .sh scripts. This guide can be used to implement any RPGMaker runner in RetroPie. VX Ace games run well in RetroPie. XP and VX games will randomly succeed starting.

Conclusion

The game coverage is quite surprising: VX Ace which is commonly reported as the most difficult to run actually has a very good game coverage. On the contrary VX and XP rather pout to the Raspberry Pi. 
 
EasyRPG is a safe and easy bet for older games (2000 and 2003).

You might consider trying Tapir if your target games don't use WIN32API. 

If you don't mind the low FPS VX Ace is still great news (it stays playable), MV and MZ play with a decent performance thanks to nw.js. Be careful because Linux is case sensitive and Windows isn't. You might have to rename a few resources files (typically png images with capital letters) to debug the nw.js MV/MZ ported game.

The pi gamer

2 comments:

  1. Does the solution you provided for playing games with RPG Maker MZ still work? I get the error that the "Requested GL implementation is not available" when using the provided script.

    running nw with the egl flag does not work either. I have tried using the files from the Google Drive link you provided, and the most recent binary releases from the Github repository.

    ReplyDelete
    Replies
    1. Hello,

      The hereabove solution was working with a Pi3 and a buster 32 bits configuration.

      With new configs like Pi 5, Bookworm, 64 bits, you will almost certainly need some troubleshooting to make it work.

      What's certain is that nw.js is the actual native engine for MV/MZ. You might have to recompile it reading docs or doing trial/error method changing the configuration.

      I'm considering buying a Pi5 but I'm not decided yet...

      Good luck!

      Delete

Play ET: Legacy on Raspberry Pi [FPS]

🕐🕐 Duration: A few hours 🔧 Difficulty: Easy 🌟🌟🌟🌟 Interest: Hours of fun