Penetration
Projectile mechanics have needed some love for a while now, i've been focusing on melee and all of its mechanics up and running and sniper mechanics have been falling to the wayside, so today I figue is as good as any to build up the penetration mechanics of projectiles that i've added before but just never was able to get QUITE right.
Lasting Issues: if a projectile loses a lot of its speed due to low penetration, it can often hit an enemy many times when the damage cooldown wears off, this means that a low penetration value can often mean extra damage! But we don't want that, because penetration is something you want to have.
If penetration was too high, projectiles would just sail through everything and you wouldn't feel as though it had any affect at all. Too low and it hits one fish, slowly greatly, hits maybe 2 other fish for next to no damage and it becomes worthless. So it was hard coming up with mechanics that would make projectile penetration not overpowered... not totally underpowered.
If bullets simply always have penetration, then it doesn't feel THAT special. Like if you just right click and you fire off a round that hits lots of enemies, it doesn't become strategic, it isn't something powerful you INVEST in and adds nuance to the combat.
I really like when you add a system, it's not working quite right, and you just leave it for months, and you always play with it in the background, and when you're ready to finally work on it again, you have a lot of experience wit hteh system and you're able to really think of quality ideas to fix it. This is why players often have better ideas than developers, because developers are under crunch and often implementing things in the moment without time to playtest them, and really devise wholistic ideas for why things should be made a certain way.
If we want to make better games, often times the best thing to do is to drop a very important system for a long period and come back to it later with fresh ideas and more experience with how they work in the grand scheme of things.
Oh and I almost forgot, I haven't really tuned in how projectiles will deal damage to items. I want sniper rifles to be the core means of "SMASH THAT JERKS SHIELD APART SO WE CAN FINALLY HIT THEM AND DEAL DAMAGE" and it just makes sense that we can tie penetration to how much damage projectiles deal to enemy armor, weapons, and shields.
SO! ENOUGH RAMBLING! How do we plan to redo the system?
Penetration will now not only slow the projectile, but be a function of damageCooldown, so if a projectile hits, it will factor its new penetration value, and that enemy will not be able to recieve damage for a longer period of time. This way a fast moving projectile is more able to hit multiple times and deal more damage to the same target, than a slow moving projectile with little penetration left in it. I will also be tying projectile speed into this formula. If anything should hit an enemy MANY times and feel really satisfying, it's that fast moving projectile fired at full charge, not some boring ass slow projectile you fire in an instant.
Projectiles will now take a bulk of penetration loss from the very first damage instance. This balances the issue of penetration being Too strong, or too weak. If the first hit against an enemy lowers penetration to say 50% and every hit after that lowers it by 5%, we now have secondary targets who take very solid damage, but it's not simply going to chew through 50 enemies and destroy them all immediately. It's a solid ammount of secondary damage without being totally out of control balance-wise. Will need to initialize a bool when firing "firstHit" to false, and when penetrating this, check if it's a first hit and reduce penetration by that unique value.
Penetration will only be applied to snipe attacks that have at least 50% charge or are mega charge attacks. This way sniping through multiple enemies feels special and requires specific playstyles to coral enemies in the same spot, and charge up the proper ammount to get the big Multi target damage off.
Can't remember how the damage and projectile eating mechanics of NPC items like shields work, going to have to dip into that logic and finagle things there as well.
Oh and I also want to have some projectiles that deal MORE damage, and become BIGGER as they pass through enemies, giving a breadth of interesting mechanics! So this system will be very customizable and allow for lots of neat weapons and playstyles.
Bonus Ideas (I almost called them upgrades, trying to get this logical lingo right so i can better interface with code, I just recently unified the terminology):
Armor Piercing. Will smash through enemy items, with 50% piercing remaining (does 50% damage and moves at 50% speed)
Explosive: Increases the damage done to enemy items by sniper rounds by %
Diamond Tipped: A % of all projectile attacks will be given a minimum amount of piercing, allowing them to go through their target. This will allow the player to use basic right click rapid fire attacks to mow through hordes of enemies, can tune the proc chance to make it balanced. I'm always trying to find the "balanced" value, and also add some rare items that are "imbalanced" for funs.
Extra powder: Reduces the penetration loss on first hit by %
Torpedo: Reduces penetration loss of successive hits of penetrating sniper rounds by %
Oh this reminds me I've been creating my own library of custom math functions I use all the time now and i've named it "zz" so it's very easy to access. So if I need a quick roll to check if something procs or not i just type zz.Roll(zBonusValue(zxBonuses.BlackJack)) where bonuzValue(zxBonuses.BlackJack) initialize the % chance. I'm REALLY happy with how everything is coming along.
public static bool Roll(float chance) {
if (UnityEngine.Random.Range(0f, 1f) < chance) return true;
else return false ;
}
And a bit ago I was able to figure out the holy grail of firing off things when a timer reaches zero:
if (zz.FireAtZero(ref chargeAudioCooldown, chargeAudioCooldownInit, rate)) SoundManager.Instance.PlaySingleSFX(chargeAudioClip, pitch, false, null, volume);
public static bool FireAtZero(ref float value, float resetTimeLength = 0f, float timeScale = 1f)
{
if (value == -1) return false;
if (value == 0) { if (resetTimeLength != 0) value = resetTimeLength; else value = -1; return true; } //Check the single frame where value is 0
if (value > 0) value -= Time.deltaTime * timeScale;//Tickdown
else value = 0; //If not firing or counting down, defaults to -1 state
return false;
}
It actually f*cking works. I just have a singular float value that determines how long till SOMETHING happens and whatever function follows that fireAtZero check will fire at a value of 0. Then it will either repeat and do it again, or lay dormant until set above zero ago. I absolutely love it.
I'm starting to feel like a legit actual coder, and I'm actually happy i don't know super high level advanced coding techniques, because I think it's made my project better for it. Nothing is tricky, nothing behaves in bizarre ways, we're just building working solutions simply and elegantly using basic pieces without any fancy bits and pieces that are going to behave in unpredictable manners.
Health was feeling iffy as I started writing this blog, and wasn't sure I'd get to work, but feeling a bit better now, so let's get to it!
Get SeaCrit
SeaCrit
Deceptively Deep!
Status | In development |
Author | illtemperedtuna |
Genre | Action, Role Playing, Shooter |
Tags | Beat 'em up, Casual, Indie, Roguelike, Roguelite, Side Scroller, Singleplayer |
More posts
- A Mi Manera12 hours ago
- We gotta get some thoughts together2 days ago
- Blah, blah, blah3 days ago
- We Back5 days ago
- Down to Donkey Park6 days ago
Leave a comment
Log in with itch.io to leave a comment.