Recurse Center Week 2
Week 2 Recap#
Ok, this post is a few days late and it’s technically the start of week 3 now, but late is better than never! This post will likely be a bit shorter than the first one, mostly because I want to get back to working on my character creator. Last week I shared that I had three goals I decided to focus on:
- A 5e character creator TUI
- Learning Rust
- Learning Wails & Svelte
I also shared that these were all subject to change, and sure enough they already have! I’ve decided that while there’s a lot I find compelling about Rust (especially when it comes to enums & pattern matching), I ultimately don’t enjoy actually reading or writing it, and if I’m going to learn something for “learning’s sake”, I’d like to enjoy what I’m learning! I also think I underestimated how much goes into a character creator. It’s for these reasons that I’ve decided to drop Rust from the list. Maybe I’ll come back to it in the future, maybe I won’t, we’ll just have to see!
Character Creator#
So I’ve mentioned this character creator several times now but haven’t really said much about what it actually is.
Right now, it’s not much - just a listing of all 12 classes with the option to select one. You can see a short demo on asciinema1.
I’m using the 5e-srd-api as the data source and genqlient to interact with the GraphQL API.
For the UI, I’m currently using a combination of charm.sh libraries, including huh and bubbletea.
I may end up ditching huh
and leaning more directly on bubbletea
, as huh
seems to be a little more limited than I realized; for example, there doesn’t seem to be a clear way to grab the current item the cursor is “hovering” over without manually keeping track of which group & input the form is at.
The biggest challenge, however, is figuring out how to model the character data. I knew going in this would be a bit complicated, but I figured I have plenty of experience manually creating characters so it couldn’t be that hard. I was wrong! There’s a lot of moving pieces to 5e characters that affect each other in a lot of ways, and figuring out how those pieces all fit together programmatically is a bit of a puzzle. Luckily for me, another Recurser (Eric Allen, check him out at Interweb Alchemy) had looked into this previously and gave me a few helpful resources to check out:
- a Roll20 script that imports characters from D&D Beyond, which looks like it will be helpful in getting a grasp on how other’s have solved this problem before
- a stack overflow post about character architecture
He also shared his D20 roller library which I may end up taking some inspiration from when it comes to ability score rolling2.
Plan for This Week#
I want to have something a little more demo-able by the end of the week. I’m going to spend a lot of heads down time hacking away at this and see where I get, but I’m trying to not stress out too much about it. I’m also hoping the 5.2 SRD comes out soon, as I really like a lot of the changes in the 2024 rules update, and I’d like to use them for this project.
I spent at least half an hour trying to get the embedded player to work with this blog before giving up on it for now. I’m using Hugo and the terminal theme and I’m sure there’s a way to use shortcodes to get what I want, but that’s an exercise for another day. ↩︎
That is, if I don’t go the route of “roll real dice and input your results”. ↩︎