A Monopoly game implemented in Rust with WebAssembly (WASM) and egui.
This project is a web-based implementation of the classic Monopoly board game, built using Rust and compiled to WebAssembly. The game features:
- A complete 40-space Monopoly board with properties, railroads, utilities, and more
- Support for 1 human player and 1-3 AI opponents with different difficulty levels
- Standard Monopoly rules with some interesting modifications
- A clean, text-and-color based UI that runs in any modern browser
The game follows standard Monopoly rules with these modifications:
- Property Acquisition: When landing on an unowned property, players can choose to buy it or auction it.
- GO Salary: The GO salary starts at $200, decreases by $10 each time any player passes GO until it reaches $0, then increases by $10 until it reaches $500.
- Passive: Conservative strategy, maintains high cash reserves, bids up to 50% of property value
- Normal: Balanced strategy, maintains moderate cash reserves, bids up to 100% of property value
- Aggressive: Risk-taking strategy, maintains low cash reserves, bids up to 150% of property value
- Rust and Cargo (https://rustup.rs/)
- wasm-pack (https://rustwasm.github.io/wasm-pack/installer/)
-
Clone the repository:
git clone https://github.com/yourusername/monopoly_wasm.git cd monopoly_wasm
-
Build the WebAssembly package:
wasm-pack build --target web
-
Serve the static directory:
# Using Python's built-in HTTP server python -m http.server -d static
-
Open your browser and navigate to
http://localhost:8000
The project follows an MVC (Model-View-Controller) architecture:
- Model: Game data and business logic
- View: UI rendering using egui
- Controller: Game flow and user input handling
This project is licensed under the MIT License - see the LICENSE file for details.
- The egui team for their excellent immediate mode GUI library
- The Rust and WebAssembly communities for their tools and documentation