King Mahjong - antonizoon/antonizoon.github.io GitHub Wiki

When I was young, I noticed my grandmother would play this interesting Taiwanese Mahjong PC game. It was made by Pamirs Corp in 2001, and known as 至尊麻將 (King Mahjong).

There were 11 distinct characters who competed against each other, and spoke in different accents and languages (Mandarin, Hokkien, Hakka) to reflect their background. Even if it was just snippets of responses (Pong! 紅中! 發財! Fang Chiang!), each of the speakers had a commanding personality that would often be emitted off my own family. It really gave me the feeling that I was at the table.

The music is amazing, the kind you hear in a nice jazz cabaret. I've searched far and wide for the sources of these midis, but they must be some kind of special Taiwanese improvisation.

Thankfully, the one time I managed to get the game running, I extracted the all the music files by directly recording the direct sound output from the PC Speakers, and separating the waveforms. I've posted it here for your listening pleasure.

Later on, I'll try and get some game footage, or maybe even recreate it in Python... It was pretty difficult to figure out how to get the game working.

Pamirs Description

至尊麻將

全國第一套完全模擬真實麻將規則的遊戲。

一個站在玩家角度思考所製作的麻將遊戲。

  • 產品名稱:至尊麻將
  • 產品類型:益智類,支援網際網路多人連線
  • 操作環境:視窗98、95中文版
  • 建議售價:NT$ 299

帕米爾資訊股份有限公司 製作、發行

第三波資訊股份有限公司 總經銷

從今天起打麻將不再怕三缺一全國第一套完全模擬真實麻將規則的遊戲。

實現網路休閒生活的理想─ 遊樂場就在你家。

擺脫時間與空間的限制,提高遊戲的人性化。

讓您一圓網際雀戰的美夢、牌技精進、不再是牌桌上的菜鳥,

從走進遊樂場開始,你可以完全自主的選擇牌友。

玩家們都知道

打敗電腦對手,不算大師

節錄的麻將規則,不算正宗

複雜的上網動作,不算真連線

沒有支援DirectX,不算真正流暢

不能在牌桌上互相叫陣,不算真語音

特點

完整的麻將規則(正統台灣十六張麻將)

單人 / Internet 網路連線模式

全程語音及語音叫陣功能

完全支援 Direct X

支援網際遊樂場﹝InterCab﹞,提供一個穩定快速的網路環境

Running on Windows

You need to use Windows 9x/ME/XP to run this game correctly. For one, it's a Windows 9x DirectX game, which is a difficult system to emulate and causes all sorts of compatibility issues with newer systems.

Also, it has some kind of curious anti-piracy feature which requires the original CD-ROM inserted to play correctly, to thwart file-sharers that copy it straight off the disc. It also seems to demand that the disc drive have the letter D:. Most old DOS games saved their music as audio tracks on the CD, so I assume this is how it works.

Thus, I've created a .BIN/.CUE dump which preserves all multisession data on the disc that an ISO image usually misses. I've used quite a lot of other formats, such as ISO and junk, and they just aren't capable of grabbing all data.

The best option to play this game is to burn the .BIN/.CUE dump directly to a CD-R. Use ImgBurn on Windows. You could do emulation, but you're probably better off saving the frustration and burning to disc.

Disc Emulation

If your computer doesn't have a CD drive, you can use the MagicDisc disc drive emulator to emulate a CD drive. Unfortunately, as an anti-piracy measure, you must not have any other physical CD Drive on your computer, so remove it or disable it.

  1. Install a Disc Drive emulator. MagicDisc works great, WinCDEmu doesn't work.
  2. (Optional) Install East Asian Language support via Control Panel. A Windows XP Setup Disc may be necessary for this (grab it from somewhere online).
  3. (Optional) Under Advanced, set the encoding to Chinese (Taiwan).
  4. Download and unzip (using 7zip) the KINGMAHJONG-bin-cue.7z archive.
  5. Right click the MagicDisc icon in the tray, and open the .CUE file (make sure the companion .BIN file is in the same folder).
  6. An autoplay program splashscreen will appear. Click the first option to install the game.
  7. Click the second option to install DirectX.
  8. When finished, go to the Start Menu, Programs, and you can play the game (the virtual CD must always be inserted).

Conversion

In order to make this game work for the rest of time, I'm trying to convert the assets into a Python game engine. Perhaps with It's simple enough, since all the sound files are just wavs, and the graphics are all in one nice bitmap. It's more about whether I have the patience to do it.

Someday, I will. It will at least be a great present to my grandparents.

The first thing to do is to create a conversion script that grabs and converts proprietary files from the original disc (because it is still copywrited, even if it is an ancient game). In the future, it would be better to try and create our own voicebanks (I can ask my family) and game assets.

  1. (~DONE) Extract Music from PC Speakers.
  • Some advanced haxx (such as Resource Hacker) may be necessary to grab the original MIDI from within the game files.
  • In the beginning, I couldn't manage to find it, so I extracted it straight from the PC speakers.
  • Later on I discovered that DOS games doubled as Audio CDs, storing music as Audio tracks. I could extract them this way.
  • I might want to create a remixed MIDI edition using a modern synthesizer: which I could then make open source.
  1. Convert Bitmaps into Transparent PNG.
  • The Bitmaps, instead of using alpha channels for transparency, uses hot pink colors just like any DOS game assets. Use imagemagick to somehow convert it automatically.
  • It might be a better idea to find new open-source Mahjong sets.

Game Logic

The game logic is no different from any Mahjong game that I remember. In fact, it might be a better idea to get modern algorithms Just grab an existing Python-based Mahjong game and expand off of it.

Here's a research paper describing a good AI methodology.

Game Art

The art, the game board is all encased in bitmaps, with pink for transparency. This makes it very easy to grab assets.

It also had some weird satanic pentagram and ram's skull atop on the multiplayer InterCab board... weird, maybe it's just to look totally metal.

Dialogue

All the dialogue and sound effects and recorded as short WAVs, labeled in English, thankfully. Though there are a ton of them, but they all follow a standard format, and that's what makes it fun.

The MAJ.INI file shows exactly which characters there are, and what each sound clip is.

SOUND0=菜      鳥[男聲國語]
SOUND1=溫柔淑女[女聲客家]
SOUND2=慧黠少女[女聲台語]
SOUND3=可愛少女[女聲國語]
SOUND4=場中老手[男聲客家]
SOUND5=職業賭徒[男聲台語]
SOUND6=痞      子[男聲台語]
SOUND7=溫柔淑女[女聲國語]
SOUND8=臭  屁  王[男聲國語]
SOUND9=女中豪傑[女聲台語]
SOUND10=女中豪傑[女聲國語]
SOUND11=新好男人[男聲台語]

Extracting the Music

The only hurdle I had to face was to extract the music. I could not find the music files anywhere on the ISO, though I saw tons of .wav files. The music must have been generated MIDIs, hidden somewhere deep in a .exe file.

Instead, I resorted to the brute-force method: I ran the game and recorded the music straight off of the PC speakers, using Audacity. It wasn't pretty, and since each piece of music played in a random order, it took a while to grab them all.

But eventually, I managed to match duplicate waveforms, eliminate the ones with bad audio pops, and narrow it down to 7 files. Here it is, in lossless FLAC Format: King Mahjong Music

Taiwan Computer Scene

Taiwan seems to have had a vibrant computer scene, but it is long gone now. I have no idea how to even start recovering that point of history, since I can barely read Mandarin, the people have dispersed, and the servers and BBS systems have shut down decades ago.

  • Weird Taiwanese Otome Game - An Otome game made by Taiwanese devs in the Japanese style of the 1990s happens to be in the desk drawer of my grandpa's old house. Not sure exactly why he, or my uncle would have bought it, but it appears to be a puzzle game of some kind. The dated style repelled me away from it, but I deeply regret not grabbing it now: It's a pretty unique treasure from a bygone era.

Sources