There are a bunch of things I need to add to my charge implementation. It kind of sounds like a simple feature. But the thing with these “oh, it’s just player moving faster for a bit” is all the extra detail that goes into considering all the cases, balancing it, then providing feedback. And I expect I won’t be done with a second pass either.
First, I have a few parametrized things to implement and tweak regarding charging. A big concern is that the player can’t panic spam charges, and the avatar won’t do tiny charges. What I need a charge cooldown — a short time after charge concludes during which a new charge cannot be activated:
And this this works nicely in-game (this being my debug output):
This will stop new charges activating while the cooldown is active. However, holding charge button will charge at the earliest opportunity.
The other part is to have a minimum duration so that charges stay active for a reasonable charging time:
And this also works:
Since I have a minimum duration, it also means I need a minimum remaining charge duration to actually allow charging:
This does happen to be the same value as minimum duration for now, but I can tweak it if I want. I am not going to stop the player charging as soon as they get back to this value, that is, I don’t have the sort overheat mechanic mounted guns have in games — “you have to fully cool the gun after you overheat it before shooting”. Besides, the next param will penalize it anyway.
The final part for a more long-time charging balance is to not recharge the remaining duration for a while after a charge, even if the player can charge again:
So the remainder stays the same for a while until it starts refilling:
Now, all these actually change how charging feels a lot. It makes it much less a spammy ability and more of a “time to charge about for a bit”. I suppose I would need my bosses of enemies do some stuff that forces the player to charge around avoiding projectiles.
Speaking of, the charge is currently not very useful other than moving out of the way of projectiles… which the player can do regardless. I think only shotgun is something the player can’t just step away from to dodge.
So I have to make the player ignore projectiles when they charge, Matrix-style. Thankfully, I have a custom collision system and every entity can arbitrarily decide what to collide with, so this change is super-simple.
Anyway, I need some HUD for the charge duration. I can’t not tell this to the player, especially when gear adds upgrades to it. So, first of all, I’m reusing and adjusting my “special powerup” bar sprites:
And I can wire the into my existing powerup HUD logic with some adjustments to produce a very passable bar:
The only addition I needed is the special charge variant for the front sprite, which is a bit more usable than the flash background outline. I also want to focus on the remainder of the bar, not the whole bar.
A big question is where to place it in UI, so I opted to put it under the other bars:
I am really short on well-spaced HUD real estate, but oh, well.
I measure charge in seconds, but I don’t think I actually want to show the seconds number. Seconds is too large of a measure, while anything less is not clear — I can’t exactly show milliseconds without it being unreadable. In fact, I will just leave the bar without any numbers:
At this point, I realized I need to add the cooldown/disabled sprites when below the activation limit. But I don’t want to modify my progress bar further and further add special cases, especially since stat bars don’t use this. So I am just moving the sprites to the main HUD charge script:
And just manually telling the bar to show the disabled variant:
Actually, I do want to show the numbers. I keep thinking about upgrading and how it adds to the duration and that I really want to show the player these numbers, so it feels like an tangible upgrade instead of some hidden number.
So I’m restoring the label. Except, I want to specify how it displays the number (without messing with my stat bar display):
And this works:
But I realize I do not like the decimal separator at all. So, let’s try this:
And this looks much nicer:
There are (so) many things I could prettify about the bar, but I think this is good enough for now.
Well, that took longer than expected (story of this game). My features get smaller, blog posts get shorter, yet days get longer. Oh well. Next, I need to focus on the in-world feedback for charge, which is the final required part of charge I will need to take care of. I might need to loo k t my effects and effect bundles first.