• 0 Posts
  • 3 Comments
Joined 11 days ago
cake
Cake day: November 7th, 2026

help-circle
  • I just use vim + cargo for development. However, for WildsRL, I’ve built two project-specific tools that have been essential for debugging.

    The first is time-travel debugging. When debug is enabled, every entity dumps detailed debug for each turn they take. It includes their current field of view, their knowledge of tiles and entities nearby, any Dijkstra maps they computed, and (since I’m using behavior trees) the latest (Success, Failed, Running, Unused) state for each node in the tree. I have a web UI that can display this debug information, so if I see anything unusual in testing, I can review recent gameplay from any entity’s perspective to see exactly why it did what it did.

    The second is autoplay. There are enough interactions between NPC entities that a lot of my code is exercised by just running a small scene (100x100 map, 25 entities) for a few thousand turns. I have unit tests that check for crashes using this mode. However, there aren’t that many crashes - one of the perks of writing in Rust. Arguably more important is that I can enable debug for the autoplay view and examine NPC behavior over many turns. I have another suite of tests that does that, and for all changes, I review any history diffs to check that the changes are what I intended.


  • I’m familiar with the arguments for Rust’s approach. It makes sense for many use cases. I’m not saying it’s wrong, just that there are tradeoffs and that for me, different ones are a better match for gamedev.

    Rather than focus on difficulties, though, I can point out some code that was a really nice fit for the language. Top of mind there is my behavior trees implementation. With a few macro invocations, I can define a tree that’s easy to read in source, that statically checks that nodes fit together, that supports full “time-travel” debugging, and that compiles to fully-specialized code. Besides the regular pathfinding and shadowcasting helpers, this file is the core “library” the game is built on.


  • Hello! I’d like to see this community grow and participating is the only way to make that happen.

    I wrote WildsRL in Rust with minimal use of libraries. I’m using termion to render to the terminal in the native build, and wasm-bindgen to expose JavaScript bindings in the web build. The only libraries I use for the core game logic are rand and rand_distr, for RNG. So most of the code is plain old Rust.

    I have mixed feelings about Rust for game development. The biggest problem is its “shared xor mutable” default. Games are all about mutable state. You often want to have a mut ref to an entity and const access to the rest of the game state (which itself refers to the entity). Languages like Java and JavaScript prove that there’s no actual reason that you can’t have that AND be memory-safe.

    This post explains my issues better than I can: https://loglog.games/blog/leaving-rust-gamedev/

    Why do I stick with it? Well, it’s really pleasant in other ways. I like that constructors are trivial to understand (looking at you, C++). I use union types everywhere. cargo check runs in ~0.02s so any errors in my code are instantly highlighted. Most importantly, I have a few years’ worth of code and I’m not going to throw it away.