Labyrinth is a virtual version of the classic labyrinth marble game written in Rust.
First, compile the shaders by installing glslangValidator, and running
glslangValidator -V -o src/default.frag.spv -e main src/default.frag
glslangValidator -V -o src/default.vert.spv -e main src/default.vert
glslangValidator -V -o src/shadow.vert.spv -e main src/shadow.vert
glslangValidator -V -o src/2d.frag.spv -e main src/2d.frag
glslangValidator -V -o src/2d.vert.spv -e main src/2d.vert
in the project main directory.
Then, install Rust, and do
cargo build --release
in the project main directory.
Labyrinth can be built for Android using cargo-mobile. The Labyrinth repo doesn't contain any of the files that can be generated by cargo-mobile, so they need to be generated before the build. The process is
- Create an empty directory and init a cargo-mobile project with name "labyrinth" there using the wgpu template pack
- Copy the directories ".cargo", "assets" and "gen", and the file "mobile.toml" to Labyrinth main directory
- Add
android:screenOrientation="landscape"
andandroid:theme="@android:style/Theme.NoTitleBar.Fullscreen"
attributes toactivity
element in gen/android/labyrinth/app/src/main/AndroidManifest.xml - Follow the cargo-mobile instructions for building the project for Android (in the Labyrinth directory)
Implements the core game logic and physics. Takes no stance on how the game is presented or how user input is given. Note that even though Labyrinth is a 3D game, the physics in game
module are 2D.
The main game loop: maintains overall application state (game in progress, paused...), handles events, updates game state and the objects in the scene graph, and triggers rendering. Also implements the 2D game UI using the egui library.
Implements a scene graph based 3D graphics engine using the wgpu-rs library. Not specific to Labyrinth, could in principle be used for other purposes also.