Tuesday, November 21, 2023

Faire Hollow Dev Log #2 - Inventory Lessons Learned

I'm redoing the inventory system, and in the process I learned a valuable lesson about planning.

When I started working on the inventory, I thought I would use the "drag and drop" built-in functionality of Godot 4. I was able to get that set up quickly and without much trouble, but I didn't take the time to think about what dragging would actually "do". I had a vague idea: I wanted to be able to drag an entire stack of items, and then ... maybe single-click to select a single item? But what about right-clicking? What about right-click-and-drag?

Turns out this isn't nearly as simple to handle as I thought. For one, there is no built-in functionality to handle right-click-and-drag in Godot. I posted on reddit for help, and got a really fantastic answer for how I could hack together a way to simulate a right-click-and-drag. But it was really fragile, and I soon realized that if I wanted to support controllers (which I'm starting to do already), I would end up rewriting the whole thing anyway.


And so back to my lesson learned. It turns out that dragging-and-dropping isn't really the right way to think about transferring items in an RPG inventory. Instead, a single click with the left mouse or a single click with the right mouse is the most intuitive way and simplest way to handle inventory transfer in my game. I looked at Stardew to see how he handles it, and sure enough, I was overcomplicating it. And it was all because I didn't take the time to plan the functionality first.

As solo developers, it is easy to start going down a path without anyone stopping you and asking: "why?" That is both the curse and the blessing of solo development. It's a blessing when it leads to experimentation, rapid prototyping, and ultra-quick learning. But it is a curse when it causes me to waste a week squashing bugs and adding on layers of spaghetti code -- when all I had to do was choose the most simple option of all: a single click!

No comments:

Post a Comment

Faire Hollow Dev Log #11 - Official Trailer

I am thrilled to share the official trailer for Faire Hollow! This has been a month-long effort to create just the right combination and var...