Angolmois BMS player, Rust edition

Related tags

Games angolmois-rust
Overview

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.

Screenshots


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

License

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.

FAQ

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.

Comments
  • Making it work on rustc stable

    Making it work on rustc stable

    I am posting this PR just for completeness, as I don't intend to continue working on it. It might be useful to someone though so here it is. There must have been some devil riding me when I thought I could make it work in an hour or so ;).


    It's not yet there though, and requires much more work with its dependencies (use ..., and possibly API changes in SDL2 and friends).

    Considering the state of the code, I am not sure if it is worth the effort to invest more time, even though I'd love to see a game with music and fancy graphics (which was the reason I made an attempt in the first place).

    opened by Byron 0
  • fail -> panic

    fail -> panic

    Sorry I broke your code with rust-lang/rust#17894 ! Here's a fix :heart:

    (this is a semi-automatic PR, so sorry if it's not perfect. Let me know and I'll fix any problems.)

    opened by steveklabnik 0
  • Correct std::ascii mod names in use statements

    Correct std::ascii mod names in use statements

    Renames for std::ascii module:

    • StrAsciiExt => AsciiExt
    • OwnedStrAsciiExt => OwnedAsciiExt

    This fixes compilation using today's nightly versions:

    • rustc 0.13.0-nightly (6ef8392b3 2014-10-20 22:17:49 +0000)
    • cargo 0.0.1-pre-nightly (481a433 2014-10-20 05:14:53 +0000)
    opened by semperos 0
  • Can't compile on OS X [2]

    Can't compile on OS X [2]

    cargo build --release Compiling sdl v0.3.6 (https://github.com/lifthrasiir/rust-sdl.git#fcf08194) /Users/Q/.cargo/git/checkouts/rust-sdl-469adf883c5df7b7/master/src/sdl/audio.rs:196:24: 196:26 error: expected type, found || /Users/Q/.cargo/git/checkouts/rust-sdl-469adf883c5df7b7/master/src/sdl/audio.rs:196 pub fn with_lock(f: || -> R) -> R { ^~ Could not compile sdl.

    To learn more, run the command again with --verbose.

    opened by MuradGazibekov 0
  • Can't compile on OSX

    Can't compile on OSX

    I think I'm just missing some dependencies, but they aren't listed in the README.

    $ cargo build --release
        Updating git repository `https://github.com/lifthrasiir/rust-sdl.git`
       Compiling sdl v0.3.4 (https://github.com/lifthrasiir/rust-sdl.git#1b4e1c81)
       Compiling sdl_mixer v0.3.4 (https://github.com/lifthrasiir/rust-sdl.git#1b4e1c81)
       Compiling sdl_image v0.3.4 (https://github.com/lifthrasiir/rust-sdl.git#1b4e1c81)
       Compiling angolmois v2.0.0-alpha2 (file:///Users/jjelinek/Projects/angolmois-rust)
    angolmois.rs:1373:5: 1373:45 warning: static constant `DefaultBPM` should have an uppercase name such as `DEFAULTBPM`, #[warn(non_uppercase_statics)] on by default
    angolmois.rs:1373     pub static DefaultBPM: BPM = BPM(130.0);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    angolmois.rs:1561:9: 1565:47 warning: static constant `bmsheader` should have an uppercase name such as `BMSHEADER`, #[warn(non_uppercase_statics)] on by default
    angolmois.rs:1561         static bmsheader: &'static [&'static str] = &[
    angolmois.rs:1562             "TITLE", "GENRE", "ARTIST", "STAGEFILE", "PATH_WAV", "BPM",
    angolmois.rs:1563             "PLAYER", "PLAYLEVEL", "RANK", "LNTYPE", "LNOBJ", "WAV", "BMP",
    angolmois.rs:1564             "BGA", "STOP", "STP", "RANDOM", "SETRANDOM", "ENDRANDOM", "IF",
    angolmois.rs:1565             "ELSEIF", "ELSE", "ENDSW", "END"];
    error: linking with `cc` failed: exit code: 1
    note: cc '-m64' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-o' '/Users/jjelinek/Projects/angolmois-rust/target/release/angolmois' '/Users/jjelinek/Projects/angolmois-rust/target/release/angolmois.o' '-Wl,-force_load,/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a' '-nodefaultlibs' '-fno-lto' '-Wl,-dead_strip' '/Users/jjelinek/Projects/angolmois-rust/target/release/deps/libsdl_mixer-f0bf7dbe3f01411c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libnative-4e7c5e5c.rlib' '/Users/jjelinek/Projects/angolmois-rust/target/release/deps/libsdl_image-6050a8cbcdb3f3a0.rlib' '/Users/jjelinek/Projects/angolmois-rust/target/release/deps/libsdl-9239c25556fa8d4a.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libstd-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libsync-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/librustrt-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libcollections-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libunicode-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/liballoc-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/liblibc-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/librand-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libcore-4e7c5e5c.rlib' '-L' '/Users/jjelinek/Projects/angolmois-rust/target/release' '-L' '/Users/jjelinek/Projects/angolmois-rust/target/release/deps' '-L' '/Users/jjelinek/Projects/angolmois-rust/.rust' '-L' '/Users/jjelinek/Projects/angolmois-rust' '-lsmpeg' '-lSDL_mixer' '-lSDL_image' '-lSDL' '-lSystem' '-lpthread' '-lc' '-lm' '-lcompiler-rt'
    note: ld: warning: directory not found for option '-L/Users/jjelinek/Projects/angolmois-rust/.rust'
    ld: library not found for -lsmpeg
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    error: aborting due to previous error
    Could not compile `angolmois`.
    
    To learn more, run the command again with --verbose.
    
    opened by johnjelinek 0
Owner
Kang Seonghoon
Yet another procrastinating programmer
Kang Seonghoon
A work-in-progress, open-source, multi-player city simulation game.

Citybound is a city building game with a focus on realism, collaborative planning and simulation of microscopic details. It is independently developed

Citybound 7.2k Jan 3, 2023
4fun open-source Cave Story reimplementation written in Rust

doukutsu-rs Download latest Nightly builds (Requires being logged in to GitHub) A re-implementation of Cave Story (Doukutsu Monogatari) engine written

null 564 Jan 1, 2023
A roguelike game in Rust

A fantasy deathcrawl in Rust Work in progress. To run, with Rust compiler and Cargo package manager installed: cargo run --release When building on W

Risto Saarelma 347 Nov 21, 2022
Snake implemented in rust.

rsnake - An implementation of classic snake in rust This game was built using the piston_window window wrapper. Download the game If youre using mac-o

Maximilian Schulke 85 Jan 7, 2023
A Doom Renderer written in Rust.

Rust Doom A little Doom 1 & 2 Renderer written in Rust. Mostly written while I was learning the language about 2 years ago, so it might not the best e

Cristi Cobzarenco 2.2k Jan 1, 2023
ASCII terminal hexagonal map roguelike written in Rust

rhex Contributors welcome! Rhex is looking for contributors. See Contributing page for details. Introduction Simple ASCII terminal hexagonal map rogue

Dawid Ciężarkiewicz 137 Dec 2, 2022
An implementation of Sokoban in Rust

sokoban-rs This is an implementation of Sokoban in the Rust Programming Language. An example level: Build Instructions Before building sokoban-rs, you

Sébastien Watteau 137 Dec 23, 2022
A personal etude into rust software (RPG<-it's more fun to debug) development: Tales of the Great White Moose

TGWM (Tales of the Great White Moose) NB: Currently compiles. Should compile and run on both 1.28.0 and 1.31.1 if the Cargo.lock files are deleted. A

null 15 Nov 17, 2021
😠⚔️😈 A minimalistic 2D turn-based tactical game in Rust

Zemeroth is a turn-based hexagonal tactical game written in Rust. Support: patreon.com/ozkriff News: @ozkriff on twitter | ozkriff.games | facebook |

Andrey Lesnikóv 1.3k Jan 5, 2023
⬡ Zone of Control is a hexagonal turn-based strategy game written in Rust. [DISCONTINUED]

Zone of Control The project is discontinued Sorry, friends. ZoC is discontinued. See https://ozkriff.github.io/2017-08-17--devlog.html Downloads Preco

Andrey Lesnikóv 354 Nov 14, 2022
This is a simple implementation of the classic snake game in rust

My snake game Looks like this. This is with Roboto Mono Nerd Font. If you use a different font it may look different or distorted. Install rust In ord

Konstantinos Kyriakou 16 Apr 4, 2021
The classic tetris game written in Rust using ncurses

tetris.rs This is the classic tetris game I wrote to have a bit of fun with Rust. Installation and playing cargo install --

null 71 Jul 25, 2022
The video game for Fonts of Power. A tabletop roleplaying game made in Rust with Bevy!

The code and rules for Fonts of Power, a tactical TTRPG / video game about exploring magical places. You can follow its development in our Discord ser

null 25 Dec 23, 2022
A refreshingly simple data-driven game engine built in Rust

What is Bevy? Bevy is a refreshingly simple data-driven game engine built in Rust. It is free and open-source forever! WARNING Bevy is still in the ve

Bevy Engine 21.1k Jan 3, 2023
Data-oriented and data-driven game engine written in Rust

What is Amethyst? Amethyst is a data-driven and data-oriented game engine aiming to be fast and as configurable as possible. Principles These principl

Amethyst Engine 7.9k Dec 31, 2022
Rust library to create a Good Game Easily

ggez What is this? ggez is a Rust library to create a Good Game Easily. The current version is 0.6.0-rc0. This is a RELEASE CANDIDATE version, which m

null 3.6k Jan 4, 2023
Minesweeper game developed with Rust, WebAssembly (Wasm), and Canvas

?? click here to play the game ?? Minesweeper game Revealing all the cells without hitting the mines is the task. Each number in the cell denotes how

Karthik Nedunchezhiyan 23 Dec 28, 2022
A Gameboy emulator written in Rust

An open source Gameboy emulator written in Rust that can use a command line interface as a screen and input device.

Blake Loring 237 Dec 7, 2022
Snake Game in rust for the web

About This template shows how to create a web app using Yew and wasm-pack. ?? Usage ??️ Build When building for the first time, ensure to install depe

PsiAphex 1 Oct 24, 2021