Hands-on Rust

Book description

Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters - and what better way to learn than by making games. Each chapter in this book presents hands-on, practical projects ranging from "Hello, World" to building a full dungeon crawler game. With this book, you'll learn game development skills applicable to other engines, including Unity and Unreal.

Rust is an exciting programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters. With Rust, you have a shiny new playground where your game ideas can flourish.

Each chapter in this book presents hands-on, practical projects that take you on a journey from "Hello, World" to building a full dungeon crawler game. Start by setting up Rust and getting comfortable with your development environment. Learn the language basics with practical examples as you make your own version of Flappy Bird. Discover what it takes to randomly generate dungeons and populate them with monsters as you build a complete dungeon crawl game. Run game systems concurrently for high-performance and fast game-play, while retaining the ability to debug your program. Unleash your creativity with magical items, tougher monsters, and intricate dungeon design. Add layered graphics and polish your game with style.

What You Need:

  • A computer running Windows 10, Linux, or Mac OS X.
  • A text editor, such as Visual Studio Code.
  • A video card and drivers capable of running OpenGL 3.2.
  • Publisher resources

    View/Submit Errata

    Table of contents

    1.  Acknowledgments
    2.  Preface
      1. Who Should Read This Book
      2. What’s in This Book
      3. What’s Not in This Book
      4. How to Read This Book
      5. Conventions Used in This Book
      6. Online Resources
      7. Wrap-Up
    3. Part I. Getting Started with Rust
      1. 1. Rust and Your Development Environment
        1. Installing Rust
        2. Installing and Configuring Your Development Environment
        3. Managing Projects with Cargo
        4. Creating Your First Rust Program
        5. Using Cargo to Build, Check, or Run Your Project
        6. Formatting Your Code
        7. Finding Common Mistakes with Clippy
        8. Package Management with Cargo
        9. Wrap-Up
      2. 2. First Steps with Rust
        1. Creating a New Project
        2. Capturing User Input
        3. Moving Input to a Function
        4. Trimming Input
        5. Storing Strings in an Array
        6. Grouping Data with Structs
        7. Storing a Variable Amount of Data with Vectors
        8. Categorizing with Enumerations
        9. Wrap-Up
      3. 3. Build Your First Game with Rust
        1. Understanding the Game Loop
        2. Creating Different Game Modes
        3. Adding the Player
        4. Creating Obstacles and Keeping Score
        5. Wrap-Up
    4. Part II. Building a Dungeon Crawler
      1. 4. Design a Dungeon Crawler
        1. Adding Headings to Your Design Document
        2. Wrap-Up
      2. 5. Build a Dungeon Crawler
        1. Dividing Your Code Into Modules
        2. Organizing Your Imports With a Prelude
        3. Storing the Dungeon Map
        4. Adding the Adventurer
        5. Building a Dungeon
        6. Graphics, Camera, Action
        7. Wrap-Up
      3. 6. Compose Dungeon Denizens
        1. Understanding Terminology
        2. Composing Entities
        3. Installing and Using Legion
        4. Composing the Player
        5. Managing Complexity with Systems
        6. Adding Monsters
        7. Collision Detection
        8. Wrap-Up
      4. 7. Take Turns with the Monsters
        1. Making Monsters Wander Randomly
        2. Moving Entites in a Turn-Based Game
        3. Sending Messages of Intent
        4. Wrap-Up
      5. 8. Health and Melee Combat
        1. Giving Entities Hit Points
        2. Adding a Heads-up Display
        3. Implementing Combat
        4. Waiting as a Strategy
        5. Wrap-Up
      6. 9. Victory and Defeat
        1. Building a Smarter Monster
        2. Implementing a Game Over Screen
        3. Finding the Amulet of Yala
        4. Wrap-Up
      7. 10. Fields of View
        1. Defining an Entity’s Field of View
        2. Limiting Monsters’ Fields of View
        3. Adding Spatial Memory
        4. Wrap-Up
      8. 11. More Interesting Dungeons
        1. Creating Traits
        2. Creating Cellular Automata Maps
        3. Creating Drunkard’s Walk Maps
        4. Prefabricating Map Sections
        5. Wrap-Up
      9. 12. Map Themes
        1. Theming Your Dungeon
        2. Rendering with Themes
        3. Unleashing Your Imagination
        4. Wrap-Up
      10. 13. Inventory and Power-Ups
        1. Designing Items
        2. Managing Inventory
        3. Wrap-Up
      11. 14. Deeper Dungeons
        1. Adding Stairs to the Map
        2. Tracking Game Level
        3. Displaying the Current Level on the HUD
        4. Wrap-Up
      12. 15. Combat Systems and Loot
        1. Designing Data-Driven Dungeons
        2. Extending the Combat System
        3. Adding More Swords
        4. Wrap-Up
      13. 16. Final Steps and Finishing Touches
        1. Packaging Your Game for Distribution
        2. Making the Dungeon Crawler Your Own
        3. Additional Content
        4. Wrap-Up
    5. Part III. Additional Resources
      1. A1. ASCII/Codepage 437 Chart
      2. A2. Short Game Design Documents
        1. Make a Note of Every Idea
        2. Why You Need a Design Document
        3. Design Document Headings
        4. You Aren’t Gonna Need It
        5. Wrap-Up
      3. A3. Rust Cheat Sheet
    6.  Bibliography

    Product information

    • Title: Hands-on Rust
    • Author(s): Herbert Wolverson
    • Release date: June 2021
    • Publisher(s): Pragmatic Bookshelf
    • ISBN: 9781680508161