Skip to product information
1 of 1

Herbert Wolverson

Hands-on Rust: Effective Learning through 2D Game Development and Play

Hands-on Rust: Effective Learning through 2D Game Development and Play

Low Stock: Only 1 copies remaining
Regular price £26.57 GBP
Regular price £38.50 GBP Sale price £26.57 GBP
30% OFF Sold out
Tax included. Shipping calculated at checkout.

YOU SAVE £11.93

  • Condition: Brand new
  • UK Delivery times: Usually arrives within 2 - 3 working days
  • UK Shipping: Fee starts at £2.39. Subject to product weight & dimension
Trustpilot 4.5 stars rating  Excellent
We're rated excellent on Trustpilot.
  • More about Hands-on Rust: Effective Learning through 2D Game Development and Play


This book teaches game development skills with Rust,a programming language that combines the power of C with memory safety,fearless concurrency,and productivity boosters. It covers hands-on projects from Hello,World to building a full dungeon crawler game,with practical examples and tips for creating high-performance games.

Format: Paperback / softback
Length: 325 pages
Publication date: 31 July 2021
Publisher: The Pragmatic Programmers


Introduction to Game Development with Rust



Rust is an exciting new programming language that combines the power of C with memory safety, fearless concurrency, and productivity boosters. It offers a vibrant playground for game developers, allowing them to bring their game ideas to life. In this book, we will embark on a journey to learn game development skills with Rust.

Each chapter in this book presents hands-on, practical projects that range from creating simple games to building complex dungeon crawler games. We will start by setting up Rust and familiarizing ourselves with its development environment. We will learn the language basics through practical examples, such as making our version of the popular game Flappy Bird.

As we progress, we will delve into the realm of random dungeon generation and monster population. We will explore concurrent game systems to achieve high performance and fast gameplay. We will also learn how to debug our programs effectively.

With Rust, we have the freedom to unleash our creativity and add magical items, tougher monsters, and intricate dungeon designs to our games. We will learn how to layer graphics and polish our games with style, making them visually appealing and immersive.

To get started, you will need a computer running Windows 10, Linux, or Mac OS X. You will also need a text editor, such as Visual Studio Code, and a video card and drivers capable of running OpenGL 3.2.

So, whether you are a seasoned game developer or a beginner looking to explore the world of game development, this book is for you. Join us on this exciting journey and unlock the full potential of Rust in game development.

Chapter 1: Setting Up Rust



In this chapter, we will set up Rust and get familiar with its development environment. We will install Rust on our computer and create a new project. We will also learn how to use the Rust compiler to compile our code.

Setting up Rust is relatively easy. We can download Rust from the official website and follow the installation instructions. Once Rust is installed, we can create a new project by running the following command in our terminal:

```Bash
rustup new my_game
```

This will create a new directory named "my_game" and initialize a new Rust project.

To compile our Rust code, we can use the Rust compiler. We can run the following command in our terminal:

```Bash
rustc my_game/src/main.rs
```

This will compile the "main.rs" file in the "my_game" directory and generate a binary file named "my_game.exe".

Once we have compiled our code, we can run it by executing the following command in our terminal:

```Bash
my_game.exe
```

This will run the compiled Rust code and display the output in our terminal.

In this chapter, we have set up Rust and learned how to compile our code. We have also run our first Rust program and seen the output in our terminal.

Chapter 2: Hello, World!



In this chapter, we will create our first Rust program, "Hello, World!". We will learn how to write Rust code and use basic Rust syntax.

To create our first Rust program, we can open a new file in our text editor and write the following code:

```Rust
fn main() {
println!("Hello, World!");
}
```

This code defines a function named "main" that prints the string "Hello, World!" to the console.

To compile our code, we can run the following command in our terminal:

```Bash
rustc my_game/src/main.rs
```

This will compile the "main.rs" file and generate a binary file named "my_game.exe".

Once we have compiled our code, we can run it by executing the following command in our terminal:

```Bash
my_game.exe
```

This will run the compiled Rust code and display the output in our terminal.

In this chapter, we have created our first Rust program, "Hello, World!". We have learned how to write Rust code and use basic Rust syntax. We have also compiled our code and run it, seeing the output in our terminal.

Chapter 3: Random Dungeon Generation



In this chapter, we will explore the realm of random dungeon generation. We will learn how to generate random dungeons and populate them with monsters.

To generate random dungeons, we can use the "rand" crate, which provides random number generation functionality. We can use the "rand::thread_rng()" function to create a new random number generator and the "rand::distributions::Standard" distribution to generate random numbers.

To populate our dungeons with monsters, we can use the "monster" crate, which provides a simple interface for generating and managing monsters. We can use the "monster::Monster" type to represent a monster and the "monster::generate()" function to generate a new monster.

To create our dungeon crawler game, we can use the "dungeon" crate, which provides a simple interface for generating and managing dungeons. We can use the "dungeon::Dungeon" type to represent a dungeon and the "dungeon::generate()" function to generate a new dungeon.

To add monsters to our dungeons, we can use the "dungeon::add_monster()" function. We can specify the type of monster we want to add and the position of the monster in the dungeon.

In this chapter, we have explored the realm of random dungeon generation and populated it with monsters. We have used the "rand" crate to generate random numbers and the "monster" crate to generate and manage monsters. We have also used the "dungeon" crate to generate and manage dungeons.

Chapter 4: Concurrent Game Systems



In this chapter, we will explore the realm of concurrent game systems. We will learn how to run game systems concurrently and achieve high performance.

To run game systems concurrently, we can use the "rayon" crate, which provides a simple interface for parallelizing tasks. We can use the "rayon::ThreadPool" type to create a thread pool and the "rayon::join()" function to wait for all tasks to complete.

To create our dungeon crawler game, we can use the "dungeon" crate and the "rayon" crate. We can create a thread pool to run the dungeon generation and monster population tasks concurrently. We can then use the "rayon::join()" function to wait for all tasks to complete before running the game loop.

To add monsters to our dungeons, we can use the "dungeon::add_monster()" function and the "rayon::join()" function. We can specify the type of monster we want to add and the position of the monster in the dungeon.

In this chapter, we have explored the realm of concurrent game systems and achieved high performance. We have used the "rayon" crate to parallelize tasks and the "dungeon" crate to generate and manage dungeons. We have also used the "rayon::join()" function to wait for all tasks to complete before running the game loop.

Chapter 5: Debugging Your Program



In this chapter, we will learn how to debug our Rust program. We will use the "println!()" function to print debug information to the console and the "std::panic!()" function to handle panics.

To debug our program, we can use the "println!()" function to print debug information to the console. We can use the "println!("debug message: {:?}", value)" syntax to print a debug message with a specific value.

To handle panics, we can use the "std::panic!()" function. We can use the "std::panic::catch_unwind()" function to catch any panics that occur in our program and the "std::panic::recover()" function to recover from the panic.

In this chapter, we have learned how to debug our Rust program. We have used the "println!()" function to print debug information to the console and the "std::panic!()" function to handle panics.

Conclusion



In conclusion, Rust is an exciting programming language that combines the power of C with memory safety, fearless concurrency, and productivity boosters. It offers a vibrant playground for game developers, allowing them to bring their game ideas to life. In this book, we have explored the realm of game development with Rust, creating simple games and building complex dungeon crawler games. We have learned how to set up Rust, compile our code, run our programs, generate random dungeons, populate them with monsters, and run concurrent game systems. We have also learned how to debug our programs effectively.

Rust is a powerful language that can be used to create high-performance games and other applications. With its focus on safety, concurrency, and productivity, Rust is becoming increasingly popular among game developers and other professionals. If you are interested in game development or other programming languages, Rust is definitely worth exploring.

In conclusion, Rust is an exciting programming language that combines the power of C with memory safety, fearless concurrency, and productivity boosters. It offers a vibrant playground for game developers, allowing them to bring their game ideas to life. In this book, we have explored the realm of game development with Rust, creating simple games and building complex dungeon crawler games. We have learned how to set up Rust, compile our code, run our programs, generate random dungeons, populate them with monsters, and run concurrent game systems. We have also learned how to debug our programs effectively.

Rust is a powerful language that can be used to create high-performance games and other applications. With its focus on safety, concurrency, and productivity, Rust is becoming increasingly popular among game developers and other professionals. If you are interested in game development or other programming languages, Rust is definitely worth exploring.

Weight: 658g
Dimension: 190 x 235 x 21 (mm)
ISBN-13: 9781680508161

UK and International shipping information

UK Delivery and returns information:

  • Delivery within 2 - 3 days when ordering in the UK.
  • Shipping fee for UK customers from £2.39. Fully tracked shipping service available.
  • Returns policy: Return within 30 days of receipt for full refund.

International deliveries:

Shulph Ink now ships to Australia, Belgium, Canada, France, Germany, Ireland, Italy, India, Luxembourg Saudi Arabia, Singapore, Spain, Netherlands, New Zealand, United Arab Emirates, United States of America.

  • Delivery times: within 5 - 10 days for international orders.
  • Shipping fee: charges vary for overseas orders. Only tracked services are available for most international orders. Some countries have untracked shipping options.
  • Customs charges: If ordering to addresses outside the United Kingdom, you may or may not incur additional customs and duties fees during local delivery.
View full details