Skip to content

A dungeon crawler written in Rust ๐Ÿฆ€ and deployed with WebAssembly ๐ŸŒ

License

Notifications You must be signed in to change notification settings

alexfdez1010/dungeon_crawler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

36 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Dungeon Crawler ๐Ÿ‰

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. ๐Ÿ•น๏ธ

Play the Game ๐ŸŽฎ

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.

Controls ๐Ÿ•น๏ธ

  • 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.

Goal ๐Ÿ†

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.

Enemies ๐Ÿ‘น

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! ๐Ÿ›ก๏ธ

Items ๐Ÿ“ฆ

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.

Level Design ๐Ÿ—บ๏ธ

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.

Development ๐Ÿ› ๏ธ

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.

Compiling and Running the Game ๐Ÿ–ฅ๏ธ

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

Compiling and Running the Game for the Web ๐ŸŒ

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.

Contributing and Bugs ๐Ÿ›

Encountered a bug or want to contribute? Feel free to open an issue or a pull request. I'm eager to collaborate! ๐Ÿค

License ๐Ÿ“œ

This project is under the MIT License - see the LICENSE.md file for details.

About

A dungeon crawler written in Rust ๐Ÿฆ€ and deployed with WebAssembly ๐ŸŒ

Topics

Resources

License

Stars

Watchers

Forks

Languages