Angolmois BMS player, Rust edition

Angolmois Rust Edition

Angolmois Rust Edition on Travis CI

This is a direct, one-to-one translation of Angolmois to Rust programming language. Angolmois is a BM98-like minimalistic music video game which supports the BMS format for playing.

Angolmois is a combination of string parsing, path manipulation, two-dimensional graphics and complex game play carefully packed into some thousand lines of code. This translation is intended to provide an example of translating a moderately-sized C code to Rust, and also to investigate additional library supports required for such moderately-sized programs. The resulting translation is certainly one of the largest applications written in Rust to date (most Rust projects are libraries for now), weighing more than 6,000 lines of Rust code. This is partly due to the fact that, unlike the original Angolmois code (which sacrifices most comments due to code size concerns), the Rust version has much more comments which can be beneficial for understanding Angolmois itself too.

For more informations (especially the usage), please refer to the README file of the original Angolmois. If you want to learn more about what the BMS format is and how Angolmois is structured, it turns out that I've already written a lot about them.


Game data credits: "sunken azure world", music by maki, courtesy of Daida Three Brothers. All rights reserved.


Angolmois is distributed under GNU GPL version 2+, so is this translation. The portions of it is intended to be sent as a patch to Rust, so those portions are licensed under Apache License 2.0 and MIT license. See the code for specifics.


How to compile?

Clone this repo and run the following commands (yes, you need the MinGW shell for Windows):

cargo build --release
target/release/angolmois --help

You require the most recent Rust master and Cargo. You can install nightlies for both.

Why did you put everything to one file?

Mainly because this is a direct translation of Angolmois, which consists of a single C file with less than 2,000 lines of code. I tried to keep the entire structure of code while doing some refactoring since this makes the translation much more obvious. This also explains why we have rather big bindings; the original Angolmois was also self-contained besides from SDL libraries.

There is now a fork of Angolmois called Sonorous which has outgrown the original to become a full-featured game. If you don't like one big file, please consider taking a look at it.

What's a difference between the Rust Edition and the original Angolmois?

In theory, Angolmois Rust Edition should be identical to Angolmois 2.0.0 alpha 2. In practice, there are some differences:

  • They behave differently on the files with invalid UTF-8 sequences.
  • The Rust version caches the directory entries in order to avoid the performance penalty due to the different directory listing semantics.
  • The C version is unable to handle 2,000 or more measures in the display. (Fixed in 2.0 alpha 3)
  • The C version allows a non-native path separator in #PATH_WAV; the Rust Edition doesn't.
  • The C version allows "rewinding" the movie by repeatedly setting the same alphanumeric key to the BGA layer; the Rust Edition doesn't. I'm not sure that this feature is portable at all.

Please also note that the Rust Edition, based on 2.0.0 alpha 2, is also substantially different to 2.0 alpha 3 in the development. Targeting 2.0 alpha 3 is not hard but currently blocked by the immaturity of SDL 2.0 bindings for Rust.