Dev Log: The Case of the Mischievous Upgrade System 🕵️‍♂️

Chapter 1: The Unruly Bugs
Two puzzling issues surfaced in my game’s upgrade system:
- The damage aura ability kept showing up twice, defying its max quantity of 1.
- The anvil count upgrade appeared without the prerequisite anvil ability, as if skipping the line.
These behaviors pointed to deeper problems in the upgrade manager’s logic, but identifying the root cause wasn’t going to be simple.
Chapter 2: A Night of Speculation
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.
Chapter 3: The Debugging Process
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:
Step 1: Renaming the Offenders
I suspected a problem with how names were processed. To rule this out, I standardized the names:
- Lowercase “axe” became proper case “Axe.”
- Result? No improvement.
Step 2: Switching to IDs
Next, I replaced names with unique resource IDs:
- Refactored the system to rely on IDs.
- Improved weight management and dependency tracking.
- Result? Still no luck.
Step 3: Adjusting Weights Dynamically
To refine the upgrade logic further, I introduced dynamic weight adjustments:
- Prioritized unacquired abilities.
- Penalized upgrades that appeared too often.
- Result? The core issue persisted.
While these steps improved the system’s robustness, they didn’t solve the fundamental problem.
Chapter 4: The Eureka Moment
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:
- Confused logic: Both abilities shared an ID, making the system think they were the same.
- Broken dependencies: Dependencies and weights became meaningless because the system couldn’t tell the abilities apart.
- Weird behaviors: Selecting one upgrade triggered both, and they showed up when they shouldn’t.
Fixing the ID resolved everything instantly.
Chapter 5: Lessons Learned
This debugging session was a humbling reminder of a few key lessons:
- Start simple. A tiny mistake in data can cause seemingly unrelated issues.
- Take your time. Rushing to push updates, no matter how exciting, can lead to errors.
- Check the foundations. Verifying configurations first can save hours of debugging.
- Unique IDs are sacred. They’re the backbone of clear, maintainable systems.
- Debugging is a marathon. Coffee, patience, and a calm mindset (preferably with a dog nearby) are your best tools.
Final Thought
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! 🎮
Files
Get Knightmare
Knightmare
Vampire Survivor derivate, which I hope will be atleast half the fun of the original game
More posts
- Patch Notes - New Content & Balance Update88 days ago
- Dev Log: Refining Loot Drops and Enemy Visual Feedback93 days ago
- Dev Log: The Journey to a Scythe System93 days ago
- Iron Skin, Weapon HUD, and Player Damage Fixes 🛡️⚔️🔥99 days ago
- Dev Log: Combat Evolution and Upgrade Rebalancing 🎮⚔️Jan 01, 2025
- Dev Log: Weapon Mastery System, Echo Strikes, and UI EvolutionDec 27, 2024
- Dev Log: Sword Ability 2.0 - From Frustration to Satisfaction 🗡️Dec 20, 2024
- Dev Log: The Case of Disappearing Gold Bars & Save File Shenanigans 🔍Dec 20, 2024
- Dev Log: Elite Visual System Evolution & Currency OverhaulDec 18, 2024
Leave a comment
Log in with itch.io to leave a comment.