itch.io is community of indie game creators and players

You're looking buff my dude

The Problem:

Creating the Base class for the buffs was not an Issue, I laid out what every buff has in common then tried to boil that down to an even smaller list. What I was left with was a pretty basic class that I could extend for different buff types, Vital, Stats, Etc.. The problem came in when I was trying to figure out the best way to tie the buffs to the player and in turn the HUD. I wasn't sure the best way to go about it, I didn't want looping includes or anything that might affect the optimization of the game (I lost the game..). I talked with some of the other developers and looked up some thing trying to ensure I provide the best solution for this problem.

The Solution:

As I dove deeper into the web and google searches, one thing stood out to me... everyone has an opinion on what's the "Best Method" and they will defend that tooth and nail. I went down so many rabbit holes I thought for sure I'd see the white rabbit soon, but after a bit I decided to go with using interfaces so that each object isn't trying to reference all the others. Using an interface I was able to get any information I need from the player without the player actually having to know about the buff class. The same was kind of true for the HUD though that was a bit easier as I was able to make some basic functions that update the UI without too much fan fair. In the end I over thought the problem and after taking a break was able to come up with a solution that I believe to be the right fit for our game.


*All images are purely concept art and do not reflect the final product, all are subject to change!

author: Dewayne Hicks
posted on 1/9/23

Leave a comment