patoncrispy

patoncrispy

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!

Marked As Solved

herbert

herbert

Author of Hands-on Rust

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.

Also Liked

patoncrispy

patoncrispy

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!

herbert

herbert

Author of Hands-on Rust

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

Popular Prag Prog topics Top

jimschubert
In Chapter 3, the source for index introduces Config on page 31, followed by more code including tests; Config isn’t introduced until pag...
New
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
lirux
Hi Jamis, I think there’s an issue with a test on chapter 6. I own the ebook, version P1.0 Feb. 2019. This test doesn’t pass for me: ...
New
JohnS
I can’t setup the Rails source code. This happens in a working directory containing multiple (postgres) Rails apps. With: ruby-3.0.0 s...
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
New
kolossal
Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
New
EdBorn
Title: Agile Web Development with Rails 7: (page 70) I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
New

Other popular topics Top

Devtalk
Reading something? Working on something? Planning something? Changing jobs even!? If you’re up for sharing, please let us know what you’...
1017 16885 373
New
malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
AstonJ
We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New

Latest in PragProg

View all threads ❯