Packaging Your Game for Distribution

Hands-on Rust — by Herbert Wolverson (106 / 120)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Chapter 16 Final Steps and Finishing Touches | TOC | Making the Dungeon Crawler Your Own 👉

In previous chapters, you compiled and ran your game in debug mode. Debug mode adds extra information to your executable (or .pdb file on Windows), mapping machine code to Rust code, allowing you to run the program inside a debugger and watch program state changes. Debug mode also disables many compiler optimizations that can make your game run faster; these optimizations might combine or remove parts of your code, making it confusing to debug. Since you aren’t expecting your players to debug the game, you can take advantage of these optimizations in a Release build.

Why Not Always Run Release Mode?

INFORMATION

Release mode disables some safety checks, particularly bounds-checking on collections and overflow errors on numeric calculations. It’s possible to create code that works in Release mode, but will crash in Debug mode. It’s a good idea to develop in debug mode and periodically test it as a release build.

Enabling Release Mode and Link-Time Optimization

You can run your game in Release mode with the command cargo run — release. Try it now, and you’ll see that the game is much faster and more responsive. Play through the game to make sure that it still works…

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.