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 Pragmatic Bookshelf topics Top

Razor54672
The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
New
jdufour
Hello! On page xix of the preface, it says there is a community forum "… for help if your’re stuck on one of the exercises in this book… ...
New
AleksandrKudashkin
On the page xv there is an instruction to run bin/setup from the main folder. I downloaded the source code today (12/03/21) and can’t see...
New
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
brunogirin
When running tox for the first time, I got the following error: ERROR: InterpreterNotFound: python3.10 I realised that I was running ...
New
taguniversalmachine
It seems the second code snippet is missing the code to set the current_user: current_user: Accounts.get_user_by_session_token(session["...
New
rainforest
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels. Before ...
New
Keton
When running the program in chapter 8, “Implementing Combat”, the printout Health before attack was never printed so I assumed something ...
New
dachristenson
I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
New

Other popular topics Top

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
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
Margaret
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
1134 25373 750
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
AstonJ
Saw this on TikTok of all places! :lol: Anyone heard of them before? Lite:
New
PragmaticBookshelf
Author Spotlight James Stanier @jstanier James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File > New Rule: And select Deny, O...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New