Experience systems and bug extermination.


Author: Jesse Silcott

3/27/2025 

Hello everyone! Jesse here today. Let's talk about experience points. Let's talk specifically how hard they are to make happen. In an effort to make our game more entertaining and have a measurable sense of success, I decided it was time to finally wrap things up with a leveling system. And then I promptly realized that I had not set myself up for that. In order to have an experience system, I needed a way to track what relics the player had. So far that was only tracked by some if checks that didn't exactly stay throughout level changes. And in the immortal words of George Harrison... Here come the bugs. I think that's what he said, right?

It all started here, right here on the menu screen. Once you go past this, in the state the game was in, nothing ever saved. If you used mana, you got it back when you changed levels. The Oddly Self-Aware NPC showed up and took you down to 1 HP? Don't worry, just jump through that big yellow portal and everything will go right back to full. just like nothing ever happened. Once I noticed this little bug here I realized that I couldn't keep track of experience if I couldn't keep track of mana. 

This clearly presented an opportunity for me to make some instance saving. The first thing I did was open the game instance and make some variables for current HP and mana. Doing this allowed me to store the current values that the player has and to pass them back to the player in the BeginPlay() function, thus eliminating the ability to never die! Well... sort of. It didn't inform the HUD. In order to make that work I actually had to trick the HUD into thinking the player was spending mana or losing health. But I can't just make the player lose HP or mana every time they change scenes, right? Well of course I can. Turns out the HUD isn't picky. It's totally ok taking 0 mana and 0 health from the player. This allowed me to broadcast to the HUD exactly how much was stored in the instance, and to display it properly as soon as the new scene was loaded. 

Now on to the relics. This was a bit trickier, as I now needed to track a larger number of things. And lucky for me, I know about interfaces. I ended up storing everything the relics needed to know about in order to function, and then created some UObjects to store that information. Each relic needed to know about the players mana or orientation, something it didn't have access to. So I passed all that into the interface and started working. Once I was able to get all that information into the relic object it was just a matter of creating that object and storing it somewhere that could be seen by everything. Ok, so back into the instance we go! Now all that's left is to write the experience system. That part, admittedly, was incredibly easy. Just made a variable called experience and added the value on the end of each combat. Ok... so maybe the experience was the easy part. Although I think I need an Orkin outfit now. I squashed so many bugs making this happen that I've got to be close to a certified exterminator. 

Leave a comment

Log in with itch.io to leave a comment.