Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Conquering UI Challenges in Character Abilities

A topic by CodeCrunchers created Sep 15, 2023 Views: 57
Viewing posts 1 to 1
Developer

This week, I implemented the character's ability UI elements. The initial plan was to make the UI appear bright, signaling its readiness for use by the player. Once activated, the image would fade to gray, and a timer would commence, counting down from 10 atop the grayed-out image. When the timer hit zero, the image would brighten again, accompanied by a sound to indicate its availability for use once more. This task may sound straightforward, but in reality, it took me six times longer than my original estimate. Collaborative game development with multiple team members can lead to unforeseen complexities.


In my initial conception, I thought I could create the UI on the HUD, then establish a variable that would guide the code to access the HUD and trigger the specified functions when the player activates their abilities. I spent nearly two full days convinced I was overlooking a fundamental step. I managed to make the transition from the character skill to the HUD function, displaying on-screen debug messages, which suggested it was on the right track.


However, as soon as I attempted to implement anything beyond the debug messages, the game would crash, even with validity checks in place, leaving me baffled. It was only later that I discovered there was no trace of the items in memory. I had to reconfigure how I called the functions from the character's C++ code to the HUD. Instead of a direct transition from the character to the HUD, I had to route it through the player controller, a HUD class, and then to the HUD containing the functions. Eventually, I managed to get everything I added to the HUD to function correctly in the game, as long as I followed this revised approach.