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.

Popular Prag Prog topics Top

jimmykiang
This test is broken right out of the box… — FAIL: TestAgent (7.82s) agent_test.go:77: Error Trace: agent_test.go:77 agent_test.go:...
New
iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
New
ianwillie
Hello Brian, I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
New
sdmoralesma
Title: Web Development with Clojure, Third Edition - migrations/create not working: p159 When I execute the command: user=> (create-...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
alanq
This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New
AndyDavis3416
@noelrappin Running the webpack dev server, I receive the following warning: ERROR in tsconfig.json TS18003: No inputs were found in c...
New
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
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
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New

Other popular topics Top

DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
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
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New

Latest in PragProg

View all threads ❯