This work is based in the book Hands-on Rust: Effective Learning through 2D Game Development and Play by Herbert Wolverson. ๐ The book offers an excellent introduction to Rust and game development. I highly recommend it! ๐ You'll be able to learn Rust while understanding common design patterns in video games. ๐น๏ธ
First, the most important part: you can play the game right here! The game operates with WebAssembly and is playable directly in your browser. No installation needed โ just dive right in! ๐ You will need a keyboard to play, though.
- Use the
Arrow keys
to move and attack (if an enemy is in the position you're moving to). - Press
G
to pick up items and store them in your inventory. - Keys
1-9
are for using items in your inventory. - With the
Mouse
, hover over any enemy or item to see its stats.
The ultimate goal of the game is to recover the Amulet of Yala
. ๐
The game concludes when you reach the tile where the Amulet is located. You can find it on the last level of the dungeon (level 3). Advance to the next level by finding the stairs scattered around each level.
You'll encounter 4 types of enemies:
Goblin
: the weakest, with 1 health point and 1 attack point.Orc
: a bit tougher, having 2 health points and 1 attack point.Ogre
: a stronger foe, with 5 health points and 2 attack points.Ettin
: the mightiest adversary, boasting 20 health points and 5 attack points. There's only one Ettin in the game, guarding the Amulet of Yala. It's the final boss โ consider avoiding it to snag the Amulet! ๐ก๏ธ
Discover 7 types of items:
Healing Potion
: Restores 6 health points.Weak Healing Potion
: Restores 2 health points.Vision Potion
: Permanently extends your vision range by one tile in all directions.Rusty Sword
: Boosts attack points by 1. Only one sword can be carried at a time.Shiny Sword
: Increases attack points by 2.Huge Sword
: Amplifies attack points by 4.Dungeon Map
: Reveals the entire level map. A new map is needed for each level.
The levels are procedurally generated using the Drunkard's Walk algorithm and Cellular Automata. They ensure a path from the starting point to the stairs for the next level. Enemy and item placements are randomized, offering infinite replayability! The map is endless โ reach the edge, and you'll teleport to the opposite side.
The game is crafted in Rust, utilizing the bracket-lib
library for the game engine. The architecture follows the ECS (Entity Component System) pattern, using the Legion
library.
To compile the game for your platform, you'll need Rust and Cargo. Instructions can be found here. Compile the game with:
cargo build --release
Run the game using:
cargo run --release
To compile for the web, execute:
./generate_wasm.sh
This command handles all necessary dependencies and compiles the game for web play. Use any web server to serve the game from index.html
. Note: A web server is required for local development due to WebAssembly's needs.
Encountered a bug or want to contribute? Feel free to open an issue or a pull request. I'm eager to collaborate! ๐ค
This project is under the MIT License - see the LICENSE.md
file for details.