Posted December 11, 2024 by Avskum
Two puzzling issues surfaced in my game’s upgrade system:
These behaviors pointed to deeper problems in the upgrade manager’s logic, but identifying the root cause wasn’t going to be simple.
After an evening out with colleagues and a couple of beers, I went to bed—but my thoughts wouldn’t let go of the upgrade manager, particularly the new damage aura ability. What could be causing these strange behaviors?
The next morning, I powered through my usual tasks and went straight to debugging. With a strong coffee in hand and my dog snoozing by my feet, I was ready to dig deep into the issue.
The upgrade manager was designed to handle abilities with weights, dependencies, and quantity limits, but something wasn’t adding up. Here’s how the investigation unfolded:
I suspected a problem with how names were processed. To rule this out, I standardized the names:
Next, I replaced names with unique resource IDs:
To refine the upgrade logic further, I introduced dynamic weight adjustments:
While these steps improved the system’s robustness, they didn’t solve the fundamental problem.
Then it hit me—I remembered duplicating the anvil.tres file to create the new damage_aura ability. In my excitement to push the new ability to itch.io for testing, I had rushed the process. Just to be sure, I checked the resource file to confirm I hadn’t overlooked renaming everything.
Sure enough, the ID for anvil.tres
was still set to "damage_aura", causing:
Fixing the ID resolved everything instantly.
This debugging session was a humbling reminder of a few key lessons:
Development isn’t always smooth sailing, but even mistakes can lead to improvements. The upgrade manager is now more robust, and I’ve got another lesson to apply in the future.
Until next time, happy coding! 🎮