Lerk Spike Damage mod

Fluid CoreFluid Core Join Date: 2007-12-26 Member: 63260Members, Reinforced - Shadow
edited January 2012 in Modding
<div class="IPBDescription">Spike damage increased by forward movement</div><i>Because there was a request for it, and the code have grown pretty much since the first approach aswell as the different ideas being more or less done, I think it now fits to put this in the modding forums. The original post from the I&S forums can be found <a href="http://www.unknownworlds.com/ns2/forums/index.php?showtopic=115786" target="_blank">here</a> for more details regarding the full process. Much of the text here is taken directly from that thread. Anything not in quote tags are posts made by me. At the very bottom you will find links to the code in its entirety on dropbox.</i>

What the mod does, in a few variations on approach, is to increase the spikes damage based on your forward speed. Strafing doesn't affect the damage, while moving backwards reduces it. The damage decrease on was also modified to be treated in different various ways for all three approaches that we eventually arrived at. The first and second approach are pretty much the same, but with different damage decrease, while the third is further of those two.

The goal of these changes is to change the focus of lerk gameplay away from getting close to a marine and circle them by the roof. Instead we want the lerks to fly in against a marine and then fall back for a new attack . By this change lerks could do a fair bit of damage on the initial charge, and then finnish it of with low damage spikes or take evasive action and prepare for a new attack. At the same time, we want to make the lerks less effective at sieging from afar, and the combination of lower damage while stationary and damage decrease with rsnge, they should want to get close or atleast fly in and out quickly to take down structures.
All this is meant to get the lerk effectively use the ability to fly in combat. To change them from gettinh into your fsce, and staying there, to fly in and out and be the mobile class they should be.

I think this summarize our intents and idea. If i forgot something or made a misstake, please point it out so that I can correct it.
<!--quoteo(post=1893181:date=Jan 9 2012, 02:30 AM:name=Harimau)--><div class='quotetop'>QUOTE (Harimau @ Jan 9 2012, 02:30 AM) <a href="index.php?act=findpost&pid=1893181"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Another way to look at it is simply, damage increases with forward speed. <!--coloro:gray--><span style="color:gray"><!--/coloro--><!--sizeo:1--><span style="font-size:8pt;line-height:100%"><!--/sizeo-->based on the concepts of kinetic energy, relative velocities or conservation of momentum<!--sizec--></span><!--/sizec--><!--colorc--></span><!--/colorc-->
We also want damage to decrease with distance. <!--coloro:gray--><span style="color:gray"><!--/coloro--><!--sizeo:1--><span style="font-size:8pt;line-height:100%"><!--/sizeo-->based on the concept of drag<!--sizec--></span><!--/sizec--><!--colorc--></span><!--/colorc-->

The lerk will want to <b>move</b>, play aggressively, and swoop down on targets. The lerk will be Death From Above.

Other implications that Fluid Core hasn't yet definitively described:
- Lerks that fly backwards while shooting will be penalised (do a bit less damage than normal) for attacking while retreating, making it fairer for marines (who are also penalised for the same by having reduced back-walk speed).
- Circling (strafe-flight) or hovering around a target, or sitting still and firing, will not have any damage bonus.
- An implication for the marines is that, because swooping is significantly more effective (you can gather a lot of speed and therefore damage), marines will want to "watch the skies" a bit more when they know lerks are in play and there are high ceilings. A further implication would be that this splits their attention away from the walls and ground where skulks may be, making skulks a little more effective. Or the reverse, skulks in play draws attention to the wall and ground, leaving the lerk open to safely rain death from above.
and that's it, I think.<!--QuoteEnd--></div><!--QuoteEEnd-->

<i><b>And finally, below you can see the changed code for the three versions. </b></i>



<b>Physical version with drag to decrease distance damage</b>
Damage at 0 range
<a href="http://www.wolframalpha.com/input/?i=plot+20%2F47^2*%2847%2Bx%29^2*e^%28-12047*0%2F%281390*0.04%29%29+%2C+-13%3Cx%3C20" target="_blank">http://www.wolframalpha.com/input/?i=plot+...2C+-13%3Cx%3C20</a>
Damage decrease with distance:
<a href="http://www.wolframalpha.com/input/?i=plot+e^%28-1.2047*x%2F%281390*0.04%29%29+%2C+0%3Cx%3C16" target="_blank">http://www.wolframalpha.com/input/?i=plot+...+%2C+0%3Cx%3C16</a>

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// Have damage increase to reward close combat
//local damageDistScalar = Clamp(1 - (distToTarget / kSpikeMinDamageRange), 0, 1)
//local damage = kSpikeMinDamage + damageDistScalar * (kSpikeMaxDamage - kSpikeMinDamage)
                
//Yuuki: Make damage increase based on your speed

//SpikeInitialSpeed=47
//KineticenergyToDamage=40/(m*SpikeInitialSpeed^2)
//Lerkspeed=player:GetVelocity():DotProduct(player:GetViewAngles():GetCoords().zAxis)
//AirDensity=1.2047
//DragCoefficient=1
//SpikeDensity=1390
//CylinderSpikeLength=0.04
//Damage=KineticenergyToDamage*m/2*(SpikeInitialSpeed+Lerkspeed)^2*e^-(AirDensity*DragCoefficient*distToTarget/(SpikeDensity*CylinderSpikeLength))
local movement = player:GetVelocity():DotProduct(player:GetViewAngles():GetCoords().zAxis)
        
local damage = 20/47^2*(47+movement)^2*e^(-1.2047*distToTarget/(1390*0.04))<!--c2--></div><!--ec2-->


<b>Semi-physical approach to drag</b>
Damage from 0 to 2 range:
<a href="http://www.wolframalpha.com/input/?i=plot+20*%28%281%2F%28abs%28x%29%2F35+%2B+1%29%29*x%2F35+%2B+1%29^2++%2C+-13%3Cx%3C20" target="_blank">http://www.wolframalpha.com/input/?i=plot+...2C+-13%3Cx%3C20</a>
Damage decrease from 2 to 16 range:
<a href="http://www.wolframalpha.com/input/?i=plot+%2815%2B5*%281-%28x-2%29%2F%2816-2%29%29%29%2F20++%2C+2%3Cx%3C16" target="_blank">http://www.wolframalpha.com/input/?i=plot+...+%2C+2%3Cx%3C16</a>
For some reason it didn't work to link the exact code. So I used the exactely same shape but with a few unnecessary things.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// Have damage increase to reward close combat
local damageDistScalar = Clamp(1 - (distToTarget / kSpikeMinDamageRange), 0, 1)
//local damage = kSpikeMinDamage + damageDistScalar * (kSpikeMaxDamage - kSpikeMinDamage)

                
//Yuuki: Make damage increase based on your speed
//max damage = 20
//min damage = 15
local static = 15 + damageDistScalar * 5
local movement = player:GetVelocity():DotProduct(player:GetViewAngles():GetCoords().zAxis)
//spikespeed = 35
local dragfactor = 1/(math.abs(movement)/35 + 1)
local damage = static * (dragfactor*movement/35 + 1)^2<!--c2--></div><!--ec2-->


<b>Sigmoid shaped</b>
Damage at 0 range:
<a href="http://www.wolframalpha.com/input/?i=plot+2*20%2F%281%2Be^%28-%28x-1%29%2F5%29%29++%2C+-13%3Cx%3C20" target="_blank">http://www.wolframalpha.com/input/?i=plot+...2C+-13%3Cx%3C20</a>
Damage decrease at range:
<a href="http://www.wolframalpha.com/input/?i=plot+2*%282%2F5*e^%28-%28x^2%29%2F%28200%29%29%2B0.6%29%2F%281%2Be^%28-0%2F6%29%29+%2C+0%3Cx%3C20" target="_blank">http://www.wolframalpha.com/input/?i=plot+...+%2C+0%3Cx%3C20</a>
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// Have damage increase to reward close combat
//local damageDistScalar = Clamp(1 - (distToTarget / kSpikeMinDamageRange), 0, 1)
//local damage = kSpikeMinDamage + damageDistScalar * (kSpikeMaxDamage - kSpikeMinDamage)
              
//Yuuki: Make damage increase based on your speed
//max damage = 18

local movement = player:GetVelocity():DotProduct(player:GetViewAngles():GetCoords().zAxis)
        
local damage = 40/(1+math.exp(-(movement-1)/5))*(0.4*math.exp(-(distToTarget^2)/200)+0.6)<!--c2--></div><!--ec2-->


<b>This is a server-side mod. Just add or replace the lines of code that are changed or missing in the Spikes.lua file (found in ...\ns2\lua\weapons\Alien). Save it like any mod, but replacing the original would probably work fine if you want it permanent for your servers.</b>

The completely physical approach with drag.
<a href="http://dl.dropbox.com/u/49503284/lerkSpikes/lua/Weapons/Alien/SpikesPhysical.lua" target="_blank">http://dl.dropbox.com/u/49503284/lerkSpike...kesPhysical.lua</a>
The semi physical approach with drag for speed damage decrease, but linear damage decrease for range.
<a href="http://dl.dropbox.com/u/49503284/lerkSpikes/lua/Weapons/Alien/SpikesSemiPhysical.lua" target="_blank">http://dl.dropbox.com/u/49503284/lerkSpike...emiPhysical.lua</a>
The mathematical approach with a sigmoid shape. The one I tested against eggs/drifters/MAC:s
<a href="http://dl.dropbox.com/u/49503284/lerkSpikes/lua/Weapons/Alien/SpikesSigmoid.lua" target="_blank">http://dl.dropbox.com/u/49503284/lerkSpike...ikesSigmoid.lua</a>
Complete file updated for 192 with the sigmoid shape.
<a href="http://dl.dropbox.com/u/49503284/lerkSpikes/lua/Weapons/Alien/Spikes.lua" target="_blank">http://dl.dropbox.com/u/49503284/lerkSpike...lien/Spikes.lua</a>

Comments

  • KoruyoKoruyo AUT Join Date: 2009-06-06 Member: 67724Members, Reinforced - Shadow
    edited January 2012
    We tested a version of this by yuuki in a few gathers on monday (6v6, with ppl with good hardware and aim), and pretty much everybody agreed it doesnt work out right.

    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Instead we want the lerks to fly in against a marine and then fall back for a new attack<!--QuoteEnd--></div><!--QuoteEEnd-->
    This doesnt work, there are medpacks, nanoshield and increasing armor and dmg upgrades for marines.
    Lerk is fast, flying and because of that weak on the hp side.

    So while it was ok in 1 on 1 situations in early game(especially if you engaged from behind) - you could forget the lerk lategame.
    Also you need to fly pretty straight lines into a marine to get any bonus dmg at all => suicide, so you end up doing less dmg overall.
    The distances you have - the path to fly into a marine is usually very short*(so you end up trying to hover finish marines with weaker dmg than it was before this mechanic, which makes medpacks very effective to counter you finishing of a marine), also marines will just try to snipe you and cover behind corners or objects forcing you to encounter them in close combat were you dont do much dmg anymore.

    Before you could hover around and dodge bullets, now you have to fly a very easy predictable line and usually take heavy dmg making it impossible to try a second attempt - meaning either you finish the marine off in the first run, die, or you have to try flying back for heals. (but by that time the marine is either dead by someone else(not very fun to play a class that can rarely finish off marines) already dead somewhere else or fully healed again)

    This system makes lerks pretty much into an ambush class - so your best chance is trying to attack from behind. (so you dont get much dmg and have time to finish a marine off - were you will take lots of dmg) make a few altfire hits and finish with primary in hover mode... - tho again, hovermode(with weaker spikes now) + medpacks = easy for marines to stay alive.


    Im not very good in describing the problem... maybe it can be fixed by tweaking a few numbers.

    But in general for a closecombat lerk bite would be a lot better... since you kinda need to be able to dodge a lot as lerk at any time but also be able to do dmg in between.

    * we played on ns2_turtle_b2 (which doesnt have much long corridors)
  • HarimauHarimau Join Date: 2007-12-24 Member: 63250Members
    Hmm, is it the base damage that's too low? I think the original had a range of 20~24 static, while many of the versions we came up with had around 15~20 static (with a multiplier based on movement, up to about 150~200%).
  • KoruyoKoruyo AUT Join Date: 2009-06-06 Member: 67724Members, Reinforced - Shadow
    I dont really know, yuuki should make a comment - he also played in those gathers.

    The problem is, inceased basedmg would be make it a bit too good early game if you ask me.
  • Fluid CoreFluid Core Join Date: 2007-12-26 Member: 63260Members, Reinforced - Shadow
    edited January 2012
    I played in those too, and I think in more then what Yuuki did. You are right about that, something didn't quite feel right. Yuuki mentioned that it might be an issue of learning curve, and that might be the case. It was quite unforgiving tho. How do you think changing it back to get increased damage from strafing too would work out? I just don't like the idea of the lerk mainly hovering pretty much stationary in combat.

    I liked bite with lerk myself, but I can see how it felt to much like a skulk with wings.
  • KoruyoKoruyo AUT Join Date: 2009-06-06 Member: 67724Members, Reinforced - Shadow
    edited January 2012
    Now that you say it - right, you were also at those gathers, stupid me... sorry!

    idea1:
    How about lowering the attackspeed and increasing the dmg and energy values accordingly? (so dps is kinda the same, but there is a little more "burst potential" to counter medpacks)
    But it would also need to have alternative spike dmg values for the alt attack. And good aim gets more important.
    Not sure if this would really change anything - its just an idea.

    idea2:
    Or how about making the alt fire into a charge up ability.
    - You can charge it for up to 5seconds.
    - Spike number and energy cost is depending on how long you charged up (@5 seconds up to lets say idk 20 spikes? and 50%energy, also there is no energy regeneration while you are holding the charged up ability)
    After release it would shoot spikes like the primary fire, just at higher attackrate and with the bonus dmg from the point you released it.
    This means you dont have to fly straight into a marine while shooting spikes, you can dodge around at speed, release it and then hover or make a little strafe circle and get the bonus dmg for this number of spikes...

    Primary fire or gas is used to finish it off in case this is needed (maybe still do the suggestion from my first idea here)

    Lerks are too weak to force them divebombing for a long distance straight into marines then fly away and try it again. Its like running into a marine, making a bite run away and try your luck again as skulk - just this time the marine knows that you will be coming(and from what general direction), maybe also gets reinforcements and commander attention or a better position to attack you from. (also he has time to reload and getting his guns ready again)
  • YuukiYuuki Join Date: 2010-11-20 Member: 75079Members
    It's true that flying straight to marines is quite bad, also the map are quite small, so you can't really fly so much. We should try Fluid core versions though.

    I like idea 2.
  • Fluid CoreFluid Core Join Date: 2007-12-26 Member: 63260Members, Reinforced - Shadow
    That's a really easy change. We just revert the movement back to Player:GetVelocity():GetLength() and then it gets all movement.
  • Fluid CoreFluid Core Join Date: 2007-12-26 Member: 63260Members, Reinforced - Shadow
    With the lerks being made more durable in 192 I think it was worth trying this out again. I verified the files for 192 and updated the code where needed. I also think that I found the option to hold your secondary and fire them. This should take away the unintuitive part when you not fire anything if you press your secondary before 0.08 seconds have past since your last primary spike was fired.
  • fanaticfanatic This post has been edited. Join Date: 2003-07-23 Member: 18377Members, Constellation, Squad Five Blue
    Waste of time. Rapid-fire spikes are only a few general fps improvements away from becoming completely useless. Should be working on how to fix the shotgun spikes instead, if anything.
  • Fluid CoreFluid Core Join Date: 2007-12-26 Member: 63260Members, Reinforced - Shadow
    I had pretty much discarded this mod before 192, because when the fps improved enough you died like a fly if you flew straight for someone, and it just turned into a nerf of the lerk. With the introduction of the hide however, the lerk is tanky enough to swoop on lmg marines to make it work. Tried it today on a gather, and I really liked it then. You don't die "instantly" as before if you tried a head on attack, so you can get of some nice damage. As a side-effect you also do lower damage against structures too. Now, I understand if all don't like this new playstyle of the lerk, it is quite different from now. But I like it, it's how I always imagined the lerk, and it works well in this patch :)
  • swalkswalk Say hello to my little friend. Join Date: 2011-01-20 Member: 78384Members, Squad Five Blue
    edited January 2012
    <!--quoteo(post=1896169:date=Jan 20 2012, 06:12 PM:name=fanatic)--><div class='quotetop'>QUOTE (fanatic @ Jan 20 2012, 06:12 PM) <a href="index.php?act=findpost&pid=1896169"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Waste of time. Rapid-fire spikes are only a few general fps improvements away from becoming completely useless. Should be working on how to fix the shotgun spikes instead, if anything.<!--QuoteEnd--></div><!--QuoteEEnd-->
    Not really, check the changelog on the latest patches.
    Now lerks have 2 dmg reduction, which means that they take alot less dmg from rifles. And a little less from shotguns.
    Also, hanging in the air spiking marines without any skulks nearby would be a mistake from the lerk.
    Spikes are not useless, and I think this mod is really great for the lerk now that it have more effective HP.
    You can kill a a0 marine in one "swoop", primary spikes as you approach, and end it with sg spikes when you get close.
    At the moment in vanilla, hovering lerks are too powerful.
    Also, no one says you have to go in a straight line against the marine.
    Use movement modifiers(A/D) as you fly towards the marine, you will still get the extra damage from your forward speed.
    It is really a skill to execute these swoops right, and at the right time. Not useless, just powerful if used right.
    Even more so if used in combination with gas, as you obstruct marines view if dropped correctly.
    Also, lerks definitly needs a small nerf against sniping structures, lerk rushes on CCs are really powerful, even more so after CC health nerf.
  • fanaticfanatic This post has been edited. Join Date: 2003-07-23 Member: 18377Members, Constellation, Squad Five Blue
    edited January 2012
    You've missed the point. The reason why lerks are so overpowered in 193, is because they tried treating the symptom (easy to kill) instead of the disease (rapid-fire spikes).

    It just isn't possible to balance rapid-fire spikes for all skill levels. The problem is that rapid-fire hitscan weapons require you to constantly track your target while attacking, which puts a hard limit on your freedom of movement. Sure you can use a few different techniques to evade fire, but you're very limited and your movement patterns are fairly easy to predict. What this means is that at higher skill levels, the marines will be hitting almost every bullet. At lower skill levels however, where player skill at aiming and lerk movement are still fairly even, marines will be missing a lot. So now you're stuck with a scenario where if you buff lerk hp to balance it for higher skill levels, it will be overpowered at lower skill levels -- or the other way around.

    I also don't like that it basically turns the lerk into a flying marine (funny story, "flying skulk" haters...).
  • Fluid CoreFluid Core Join Date: 2007-12-26 Member: 63260Members, Reinforced - Shadow
    <!--quoteo(post=1896275:date=Jan 21 2012, 12:58 AM:name=fanatic)--><div class='quotetop'>QUOTE (fanatic @ Jan 21 2012, 12:58 AM) <a href="index.php?act=findpost&pid=1896275"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->You've missed the point. The reason why lerks are so overpowered in 193, is because they tried treating the symptom (easy to kill) instead of the disease (rapid-fire spikes).

    It just isn't possible to balance rapid-fire spikes for all skill levels. The problem is that rapid-fire hitscan weapons require you to constantly track your target while attacking, which puts a hard limit on your freedom of movement. Sure you can use a few different techniques to evade fire, but you're very limited and your movement patterns are fairly easy to predict. What this means is that at higher skill levels, the marines will be hitting almost every bullet. At lower skill levels however, where player skill at aiming and lerk movement are still fairly even, marines will be missing a lot. So now you're stuck with a scenario where if you buff lerk hp to balance it for higher skill levels, it will be overpowered at lower skill levels -- or the other way around.

    I also don't like that it basically turns the lerk into a flying marine (funny story, "flying skulk" haters...).<!--QuoteEnd--></div><!--QuoteEEnd-->

    Rapid fire spikes as they are now are a problem, yes, because you need to track a marine for a longer time to deal reasonable damage. This mod is meant to adress that by allowing you to do more damage in shorter time, but much lower damage if you continue to track them while not really moving much. If we argue that at high skill levels, a lerk that tracks you will basically not be missed by your fire, then flying straight for a marine makes no difference from circling them. But this mod makes flying at the marine at speed and firing spikes so much better, that it should be worth it to make shorter attacks aiming at the marine, and then stop tracking them to evade the fire. The mod didn't work well before hide, because the initial "straight" on approach would make you take to much damage.

    The combination of hide and speed-damage spikes makes a good try to treat the disease.
Sign In or Register to comment.