Home Creators Posts Import Register Favorites Logout

Content

This last week has been something of a busy one. I managed to get quite a bit of groundwork laid for future developments. I’ve been expanding the list of possible upgrades that you can receive, and that means I need to also have the bullet and damage functionality to make those upgrades actually do something. Strictly speaking, I only got two or three upgrades added to the list, but I’m quite pleased with what I had to do to make those work.

The first thing I implemented was the Critical Hit system! That’s right, you can now land crits against enemies! I’ll have to go back and revise this system to make it play nicer with the rest of the damage systems, which I don’t think will be hard since all I have to do is move the code from one script into another and make sure the variable references don’t try to make an invalid reference, but I’ve done that sort of thing before—including with the other thing I did last week—and it shouldn’t be hard at all.

I’m also very pleased with how specifically implemented the system. Like most creative types, game designers are magpies; we steal anything shiny enough to catch our interest. And there’s one Critical Hit system that always comes to mind for me before any other: the Yellow, Orange, and Red Crits from Warframe.

If you don’t know what Warframe is, it’s free, go play it. What’s important here is that in Warframe, it is possible to upgrade a weapon so that its chance of landing a Critical Hit is more than 100%. There’s no official name for this, but damage numbers in Warframe are color-coded, hence why I referred to these as Orange and Red Crits last paragraph. The basic way the system works is that you can Crit multiple times with one attack, with each Crit reapplying the Critical Hit Damage Multiplier. For example, if your weapon has a 150% Critical Hit Chance and a 2x Critical Damage Multiplier, you are guaranteed to do twice as much as your base damage, with a further 50% chance to do four times as much damage instead.

I refer to this as an Overcrit, since Warframe players always refer to this by the color of the damage number—Yellow for a normal crit, Orange for two Crits, Red for three.

And it turns out the Overcrit system is actually super easy to implement! You take a For loop that randomizes an integer between 0 and 100, and if it’s lower than the Critical Chance, apply the Damage Multiplier, subtract 100 from the Critical Chance, and repeat the loop until it fails. I haven’t capped this number yet, meaning that if you could somehow get 1,000% Crit Chance or something you’d have some frankly absurd damage multipliers applied, but that’s half the fun of crazy builds in Roguelikes/lites! If it becomes a problem I can easily fix it later.

(I also took a quick break to fix the upgrade system crashing the game due to an invalid reference when upgrading the player’s Bullet Movement Speed. Like I said before I’ve done this fix a lot; it’s pretty easy. In this case, I took the chance to improve the versatility of the code, as well.)

But when people think of dedicated builds in games like this, one of the ways I generally see it broken down is a Critical Hit Build versus a Status Effect Build, and you’d better believe that I implemented some status effects! Or, one status effect, but the system is designed to be easily expandable, like pretty much everything else in the game. Future-proofing your code is extremely important to avoid coding conflicts later down the line. The further you are in production, the harder adding new things becomes.

Anyway, I Added a simple Burning status effect. I don’t have Overstatuses the way I have Overcrits as a way to further make them play differently from each other, so the Status Check only runs once per Status Effect. Having a dedicated script for handling all my damage handling makes it extremely simple to add new code to it.

There was an issue where I forgot how arrays worked for something like two hours which resulted in my conditional statements failing to find the status effect I was looking for in the array because the arrays were nesting, but once I figures out the problem it wasn’t that hard to fix, albeit somewhat convoluted. Combining arrays like that without duplicating any statuses means I need another For loop to check each entry in the array storing the Bullet’s statuses against the target’s active statuses, and adding any that aren’t there. I also only have a single Status Chance variable, meaning that all status effects have the same chance of applying in a single shot—which doesn’t necessarily mean that it’s all or nothing, but that it’s currently impossible to have a build where you have a better chance of any one status over another. That might be worth changing, but that’s something only playtesting can prove.

For the sake of simple implementation, I created a script that runs every frame to apply every status so that the entire Status Effect Code within each enemy is a single line. Much like the array comparison from before, this is handled with a simple For loop, checking each item in the Status Effect Array and then executing the corresponding script. While this makes it very easy to implement, it made it somewhat tricky for the status effects to actually wear off. See, if I ever set the duration within the script, then it would reset the timer back to full every frame of the game, which isn’t exactly ideal. In the end I had to initialize a specific variable for that status effect, which I set equal to another variable: the player’s Status Duration. This means I can also have upgrades that make status effects last longer, but I’ll also need every enemy to have a timer variable for each status effect. I’ll probably move that to its own script to save me some time, and so that I can update those variables whenever the player gets a Status Duration upgrade.

It also took me some fiddling to get the Damage Over Time of the enemy burning just right. I don’t want a basic enemy to burn to death after a single bullet with no other upgrades, but I also don’t want to damage to be so little that it’s unnoticeable. But after a few different tests of frequency and damage, I got something that I’m happy with.

This is also useful for me for future Status Effects. For example, I want a Bleed Status unique to Critical Hits (once you have the associated upgrade, of course) that’s distinct from Burning or Poison or whatever other Damage Over Time I end up doing. These experiments to get Burning just right will be invaluable for that later.

Though I do need to also adjust some other things so that the Status Effects have other, additional effects, like increasing how much damage an enemy does or takes, for example. That shouldn’t be too difficult, I don’t think, so long as I make sure not to double-up on those effects and accidentally adjust a parameter in a way I wasn’t expecting.

And I got a new keyboard, too, since my last one was having trouble reading my inputs, especially on certain keys.

All in all I think it was a successful week.

Until next Devlog!

-DeusVerve

Special thanks to my Tier 3 Patrons, Haelerin and Christos Kempf!

Comments

No comments found for this post.