The game is a basic rendition of the classic game Snake. This project was a just for fun example to get familiar with the Rust programming language. This implementation combines the power of Rust compiled to WebAssembly (WASM) and executed with TypeScript
It is based of the the Rust Udemy Course from Jerga99
You can try it out in your browser here.
-
Rust: The game logic and functionality are implemented in Rust, a powerful and performant systems programming language.
-
Cargo: Rust's package manager and build system, used to manage dependencies and build the project.
-
WASM_Bindgen: This tool facilitates communication between Rust and JavaScript, allowing the Rust code to be compiled to WebAssembly and integrated with the TypeScript code.
-
TypeScript: The game is orchestrated and enhanced using TypeScript, a superset of JavaScript that adds static typing and other features.
-
Tailwind CSS: A utility-first CSS framework used for styling the user interface, providing a clean and responsive design.
To run the project locally, follow these steps:
-
Clone the Repository:
git clone https://github.com/willnjl/Snake-Game-Rust-Wasm.git
-
Navigate to the Project Directory:
cd Snake-Game-Rust-Wasm -
Compile Rust:
wasm-pack build --target web
-
Generate the Frontend
cd www/ && npm run dev
This will build the Rust code to WebAssembly, compile the TypeScript code, and serve the project locally.
-
Open in Browser:
Open your web browser and go to http://localhost:8080 to play the Snake Game.