For the German Amiga user in the 1980s and 90s, few computer periodicals could top the Amiga Magazin, published by the company Markt & Technik. The mag was so big in its day that it ran for an impressive twenty-two years before it ceased publication in 2009. Sadly, I don’t speak or read German myself, so the only issue of the magazine I’ve ever owned is the complimentary copy I got when I bought my Amiga 500. I keep it in my archive just to be on the safe side, should my memory start failing to remember that my personal Amiga journey started in August 1990.
Unable to understand the magazine text, I had to make do with photos and screenshots, which the mag was – luckily for me – full of. But often it took some guesswork to realize what the programs and games presented in the pages were all about. One of the games that caught my eye was called Lin Wu’s Challenge, and because of the name, my youthful imagination led me to think that it was probably some kind of martial arts game. A few months later I was able to source it at a local copy party (yes, we all did that, didn’t we?), and I realized how horribly wrong I was, because Lin Wu’s was actually a tile-based solitaire game of the Mahjong family. I hadn’t heard of Mahjong before but as I quite like puzzle games, I got hooked very quickly.
Strictly speaking, Lin Wu’s was not a traditional Mahjong but a variant called Shisen-Sho, which I didn’t know at the time. (I guess I wouldn’t have cared anyway.) So the game rules as well as the board setup were a bit different compared to the better-known, and arguably more popular, Shanghai. But it was fun to play because the game was not just a simple solitaire: it was designed as a contest in which you had to defeat several dozen opponents, each representing a level harder than the previous one. The final opponent was, as you might have guessed, tile master Lin Wu – although I never got that far.
When Amiga’s productivity potential dawned on me, playing video games became secondary to my other computer activities. Now in my adult life I still don’t play much or often, but Mahjong has remained a mainstay. A couple of months ago I realized that although AmigaOS4 had become an interesting gaming platform in recent years, I had never used it to satisfy my Mahjong guilty pleasure. Predictably, the first thing I tried was Lin Wu’s Challenge under E-UAE, but revisiting my old friend was a disappointing experience. As the emulator is far from perfect, it unfortunately fails to display the tile selection cursor, making the game unplayable (unless you want to resort to some wild guesswork). Shanghai, on the other hand, seemed to work fine under emulation:
But I didn’t consider myself covered, and I started looking for a native AmigaOS4 Mahjong to avoid the hassle and slowness of the emulator. I didn’t really expect an original OS4 game, and indeed, ports from other systems were all I could find. Searching OS4depot gave me two hits, one of which was a game that immediately crashed, telling me that my operating system was too old. Ha, ha, very funny! The other was an SDL game called Lopan, written by Dave Ashley and ported to OS4 by… well, it had actually been ported twice, by two different people who probably didn’t know of each other’s effort. At any rate, Lopan turned out to be a simple but very playable Shanghai clone.
Because both OS4 ports of Lopan were nearly twenty years old, I visited the project’s GitHub page to see if a newer version was available. I found out that the game was no longer developed, but the last code commits were much more recent, so I sat down and ported the latest version. In the process I changed the game’s window title to read “Lopan” instead of the generic “SDL_Window”, and I added an Amiga version string to make the port feel more polished. As one of the OS4depot comments complained about the game crashing due to insufficient stack, I also added a stack cookie in the code to help prevent such situations.
My porting success armed me with enough confidence to continue looking for other SDL-based Mahjong projects on GitHub. I was hoping to find a Shisen-Sho solitaire because, as I explained above, my old favourite Lin Wu’s Challenge was one such game. And again I got lucky, landing on the project page of Shisen-Seki, a game written by the Polish programmer Artur Rojek. The port was rather straightforward but strangely enough, the resulting AmigaOS4 binary showed some graphic distortion throughout the game. I’m rather new to both porting and SDL, so I was nowhere near able to tell what the actual problem was. But the Amiga community is known for being helpful, and it wasn’t long before George “Walkero” Sokianos pointed me to a fork of Shisen-Seki adapted for SDL2. After compiling this version the distortion disappeared, so I began to prepare the port for release.
I didn’t get very far, though. Soon I noticed that unlike the original, this SDL2-based Shisen-Seki used 100% CPU time even when idle, which is very strange for a board game running on a 2 GHz computer. It was the same on all of Walkero’s machines, so we knew we had a culprit to find. In the end Walkero tracked the problem down to the game’s scaler code, which in the original produced the graphic distortion, and in the SDL2 fork used a scaling function that was simply too CPU-intensive. Disabling the scaler code helped but it made the display so small that the game couldn’t be played without a magnifying glass. Oh blast! Only at this point did I realize that the game had probably been written for a mobile device rather than a system that runs on a 2560×1440 screen.
Now with three ports none of which worked plausibly, we were back to square one and I almost gave up on the wretched game. But Walkero wouldn’t hear of it, and in a few days he came up with a modified scaler code that brought the CPU usage down to some 55 per cent ony my machine. Which I admit is still a lot but a great improvement nevertheless.
The scaling makes the game look a bit rough around the edges, but otherwise Shisen-Seki is a very nice Mahjong solitaire that offers more than Lopan. It features in-game music and sound effects (both can be turned off in the settings), and it can be played in two different modes. In the Classic mode, the tiles – called “stones” in this game – behave as you would expect in a Shisen-Sho. The Gravity mode brings some added fun because when matching tiles are removed, the tiles above them fall down and reconfigure the board, making each next move less predictable.
I’m glad that I was able to finalize both games in time for a Christmas release, and I’d like to thank Walkero for helping me make this happen. Lopan as well as Shisen-Seki can be downloaded from the usual place, OS4depot.net, and I hope you’ll enjoy them as much as I do.
Merry Christmas, and here’s to more AmigaOS4 Mahjong gaming!