Hands-on Rust: Adequate docs for bracket_lib

I’m new to Rust and am using this book to learn more as well as to feed my interest in game dev. I’ve just finished the flappy dragon example and wanted to go on and learn how to make modifications, but haven’t had much luck finding adequate documentation to get started.

I know the docs.rs link bracket_lib - Rust (docs.rs), but that doesn’t show me how to use the libraries features. There is also the Roguelike Tutorial ( Introduction - Roguelike Tutorial - In Rust (bracketproductions.com)), but that doesn’t show me how to use sprites, for example.

The best I could find is some of the existing examples, and the repo associated with the book, but by that stage it’s all figured out for me which kinda spoils things a bit.

Just wondering if anybody knows any documentation or simple examples of using bracket-lib without any ‘spoilers’ for the book? A ‘Getting Started’ guide with simple examples would be great!

1 Like

Hi!

There’s a short tutorial showing how to go from Flappy Dragon to the bonus version on the book’s website: From Flappy Dragon to Flappy Bonus · Hands-On Rust

I agree that some extra documentation would be a good idea. For now, if you clone the Github repo (GitHub - amethyst/bracket-lib: The Roguelike Toolkit (RLTK), implemented for Rust.) and cd into bracket-terminal, you can type cargo run --example and get a list of the examples (run by adding the example name, e.g. cargo run --example dwarfmap). The source code for all of these is in the examples directory. I’ve tried to annotate the examples to explain what’s going on.

I’ll try and get a better set of documentation posted at some point soon (it’s hard to give an exact timeframe). Some parts of the library are very mature/stable (the simple/sparse consoles, and probably the “fancy” console). Documenting those should be pretty straightforward. The sprite system is pretty new, so documentation for it will have to wait it to stabilize.

If you want to go far beyond the examples in Hands-on Rust, I recommend taking a look at the Amethyst and Bevy engines. Bracket-lib is designed as a teaching tool—so it sacrifices performance in the name of teach-ability in a few cases. Both Bevy and Amethyst use the same ECS approach as the book, and (especially Bevy) are developing a great body of examples and tutorials. I also know of at least one reader who implemented all of the book’s examples using Macroquad instead of bracket-lib, retaining the Legion and ECS elements. I’ve not used Macroquad enough to recommend or not-recommend it.

1 Like

Wow that was quick! Thanks for the pointers! That first article is a help already and I’ll go through the examples you mentioned - thanks!

For the Chapter 3 Wrap Up section, I feel like I wasn’t armed with enough information to be able to get started on that stuff. Animation, for example, feels worlds away from just moving an icon around. I think a greater explanation of tilesets and how they work would be really useful! I’ve spent the past hour going through the code for the book and it all makes much more sense now. I only wish I didn’t have to go to the answers to be able to get here.

I’m really enjoying to book though and cracking on through it. Thanks again for the quick and thorough response!

2 Likes

Just a quick note, I’ve started pulling some documentation together. It’ll be a while before it’s complete (quite a large amount of ground to cover). The initial documentation covers the examples I pointed you towards. The in-progress documentation is gradually appearing at What is Bracket-lib - Bracket-Lib Usage Guide

1 Like