Shields! A Rant.

Shields! A Rant.

Requests for features in the spring code.

Moderator: Moderators

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Shields! A Rant.

Post by Argh »

Ok, it's like this- I just solved a big mystery, and the answer is really awful. I finally figured out why the MortarTank's shots can pass through Resistance Shields.

Shield behavior has always been a little strange to me. I've been wondering for some time how they actually work. Getting them to consistently behave like you'd expect them to work- as buffers against X incoming rounds that cover an area and recharge over time- has been a really mysterious process.

So, I'm going to share a few factoids:

1. Shields aren't losing the damage value of the rounds they stop. A round that does 350 to a shield with 1000 power doesn't cut down that power by 350. Instead, it appears they're losing shieldEnergyUse per round, no matter what the weapon is. Unless it just passes through, doing no harm to the shield at all. See 2.

Now, I dunno about the rest of you, but I think that's not a feature. It makes Shields completely un-flexible, and basically either invulnerable vs. slow-firing things, or totally vulnerable to just about everything. That isn't a choice- it's a straightjacket.

Moreover, it's not documented anywhere at all. In fact, the documentation says, "Power is drained by the affected weapons damage", which is erroneous.

2. Shields totally fail to intercept rounds that have a default damage over their power value.

It's not like they intercept that bullet and then have a power value of zero, and won't start charging until shieldRechargeDelay has occurred (which doesn't seem to work, btw).

It's not like they take the full damage of the round, get set to zero, and the round goes through.

Both of these things would make sense to players. No, they just go right through the shield. That's totally counterintuitive, imo.

3. Like so many things in Spring, they're relying on the default damage values for these behaviors. They should not be doing that. I hate tag-forest stuff, but I hate it even more when something can't be tweaked to make any sense without disrupting other things all over a game design, and in this case, it's totally like that.

4. Lastly, as if all of the above wasn't confusing and annoying enough, it appears that, after testing, the value of shieldpowerregen is not an absolute number and is not per-second. I'm still testing, but I'm probably going to have more luck when I look at the source. Let's just say that the behavior doesn't make any obvious sense, and when I look at the source I won't be surprised if it's some lengthy formula that's jacked up and works only if you use the exact settings in a certain OTA mod.


Basically, this is not a well-designed feature, folks. I was present when Shields were designed, and the reasoning behind the design choices was faulty then, and seems even worse now that I'm trying to do some fancy things with them. Like make them game-balanced.

Shields should just be like autoheal that covers an area, bounces / destroys stuff that hits it and has an associated energy cost, imo. That they don't work this way is completely counterintuitive, and makes them very hard to get balanced in any meaningful way outside whatever special case was put in for OTA mods.

Therefore, I'd like to propose a "shielddamage" tag. This is the actual damage that will be removed from a shield when hit by the Weapon. It should default to whatever it is now.

Shields should use an absolute number for points recharged per second. Not whatever they're doing now.

Shields should not apply bizarre amounts of force to projectiles, and should respect that max velocity tag... which they don't appear to actually do correctly.

And shields should either fail completely, when hit by something whose damage is greater than the value of the shield, or they should intercept it allowing it to explode... and then fail. The second behavior is more logical, imo. But they should not look fine, and act fine if hit with lesser weapons. That's confusing.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shields! A Rant.

Post by Argh »

Wait, lemme add one more thing that's screwy with Shields right now.

If they're intercepting projectiles fired from the inside... they don't lose any power. Ever. You can fire at them from outside, and they lose power. Inside, nothing happens at all, except the shots are deflected (at bizarre velocities, I might add).
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shields! A Rant.

Post by Argh »

Oh, and one last thing!

Mortar-type weapons don't get intercepted at all. Even after fixing my shields to correctly handle weapons with a higher default damage value than their previous value, once I determined that that was a problem... the MortarTank's rounds still pass straight through. And setting them to variable-trajectory didn't make a difference.

WTF!?!?

They're all stock weapons, guys. ArtilleryCannons, MortarTanks, and Maxims are all basically identical other than game-design variables (i.e., range, ROF, AOE, etc.). They're all using the same model. MortarTanks do less default damage than the Shields now. None of this should be happening at all. Is there some special "nuke exception" or something like that?
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Shields! A Rant.

Post by Google_Frog »

Instead, it appears they're losing shieldEnergyUse per round, no matter what the weapon is.
This looked untrue when I tried it, high damage weapons took more to defect although weapon velocity played a large part.
Argh wrote:And shields should either fail completely, when hit by something whose damage is greater than the value of the shield, or they should intercept it allowing it to explode... and then fail. The second behavior is more logical, imo. But they should not look fine, and act fine if hit with lesser weapons. That's confusing.
Think about how stupid that is. If shields can block anything even with 1% charge the energy cost is the same for all projectiles above the shields current power. Also they may get pushed to 0% but then they can instantly recharge back to 1%.

My advice is stick to destruction shields. I fiddled around with shields trying to make them reasonable when reflecting multiple weapon types and gave up because the drain was so different. Destruction shields work fine, their battery just absorbs pure default dps. (My other advice is don't use special damages if you want avoid confusing behavior.)

That is until reflector shields get more options to make them more flexible. What I think they really need is an option to make them drain like destructor shields but make shots behave like deflector shields. I agree that most of the other stuff needs fixing or at least made optional.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Shields! A Rant.

Post by lurker »

(3) Not another tag, an armor cat.
(2) is a simple bug. Shields need enough charge to repulse for 1 second even though they only repulse a frame at a time. (1) It costs the weapon's damage to repulse for 1.0 seconds. Just needs a bit of refactoring to fix. ShieldEnergyUse is a completely unrelated tag.

Code: Select all

	if (isEnabled && (curPower < weaponDef->shieldPower) && rechargeDelay <= 0) {
		if (owner->UseEnergy(weaponDef->shieldPowerRegenEnergy * (1.0f / 30.0f))) {
			curPower += weaponDef->shieldPowerRegen * (1.0f / 30.0f);
		}
	}
(4) Looks like it charges that much per second just fine. Did you test this on its own or did you use weapon shots, thinking that the recharge delay was broken? I also have a good bit of experience tweaking shields, and recharging has never seemed broken to me.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shields! A Rant.

Post by Argh »

My advice is stick to destruction shields. I fiddled around with shields trying to make them reasonable when reflecting multiple weapon types and gave up because the drain was so different. Destruction shields work fine, their battery just absorbs pure default dps. (My other advice is don't use special damages if you want avoid confusing behavior.)
Ah, I didn't know that they were behaving fundamentally differently. You're right, the code that governs their energy use is very different.
(3) Not another tag, an armor cat.
That would be totally fine with me.
Looks like it charges that much per second just fine. Did you test this on its own or did you use weapon shots, thinking that the recharge delay was broken? I also have a good bit of experience tweaking shields, and recharging has never seemed broken to me.
I'm pretty sure that was User Error on my part. I was tired and doing a lot of, "wtf, I just wanted to fix Maxims firing through my shields, and maybe fix MortarTanks" and all of a sudden, I'm having to juggle variables like crazy. I looked at the code in Spring, unless there's something else going on, I'm entirely wrong.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Shields! A Rant.

Post by Forboding Angel »

Shields have been retarded since they were introduced. Completely unintuitive. YOu would think that things would honestly be quite simple.

Shield has x hitpoints

Shield regenerates x amount of hitpoints every second

Shield uses x amount of energy or metal while recharging

Shield has to wait x amount of time before beginning to recharge

Shield can block these types of projectiles: a,b,c,d (the retardedness of shieldtypes and the massive grid to figure out what type does what is fucking ridiculous).

^^ The above is only referring to explode on contact types of shields. The most irritating issue is the fact that repulsors and normal shields are the same entity.

Meh whatever, I figured out the formulas some time ago to figure out how to tweak them correctly, but in their current state they are essentially a novelty item.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Shields! A Rant.

Post by KDR_11k »

Forboding Angel wrote:Shield can block these types of projectiles: a,b,c,d (the retardedness of shieldtypes and the massive grid to figure out what type does what is fucking ridiculous).
Lolwut? It's a simple flag array, just set consistent flags for your interception categories and you won't have trouble (e.g. CvC groups weapons into close range, long range, artillery and orbital IIRC). I prefer having flags over a list of weapon names because a list of names is a maintenance nightmare (e.g. copying a weapon won't make the copy intercepted by all the shields the original was since its name differs, with flag arrays the interception properties are copied too).
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Re: Shields! A Rant.

Post by 1v0ry_k1ng »

i just want a new shield type that is literally a second healthbar, with no graphic or anything else. it simply loses HP when shot, and when the shield is down the main healthbar gets hit. customisable shield hp/drain/regen but literally just a blue healthbar above the green one. it would make everything so easy! just lua or script the fx afterward for big win
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Shields! A Rant.

Post by Pxtl »

1v0ry_k1ng wrote:i just want a new shield type that is literally a second healthbar, with no graphic or anything else. it simply loses HP when shot, and when the shield is down the main healthbar gets hit. customisable shield hp/drain/regen but literally just a blue healthbar above the green one. it would make everything so easy! just lua or script the fx afterward for big win
You mean Protoss shields? Argh did that once, just to show how easy it was.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Shields! A Rant.

Post by lurker »

Shield has x hitpoints. Check.

Shield regenerates x amount of hitpoints every second. Check.

Shield uses x amount of energy or metal while recharging. Energy only, but check.

Shield has to wait x amount of time before beginning to recharge. Check.

Shield can block these types of projectiles: a,b,c,d. Yes, TYPES. Check. Types have a tag in the weapondef. There is no grid if you only give each weapon a single type. If it's confusing then you're doing it wrong. You can even give the types names in luadefs.

The most irritating issue is the fact that repulsors and normal shields are the same entity. Why? None of the above change. The only difference is that hitpoints means how much damage it can repulse for one second, disregarding bugs.

What do you disagree with in the current shields? What 'formulas'?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shields! A Rant.

Post by Argh »

The "irritating issue" is that Shields don't lose the hitpoints of the weaponProjectile's default damage. If that was fixed, then they'd start making sense. Instead, they just lose X hitpoints every time they're hit, by any weaponProjectile with the appropriate bitfield setting.

This creates a bunch of serious game-design problems. Want to block a whole class of stuff, like "all plasma weapons"? Well, now the slow-firing but really dangerous ones are effectively useless, whereas fast-firing ones are Shield-killers. It doesn't make a great deal of sense, frankly.

And the whole "if it does more default damage than the Shield can take, just let it pass through and not knock the Shield down" is ridiculous. It doesn't make any intuitive sense at all.

And lastly, mortar-type weapons aren't getting blocked at all. And yes, I've tested that, several times now. IDK why, it doesn't make sense based on the code for Shields... it's just what's going on. Maybe their bitfield setting is getting screwed up, or something.

And sure, I can do a Protoss-style shield. But doing it over an area is very expensive with Lua.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: Shields! A Rant.

Post by Evil4Zerggin »

1v0ry_k1ng wrote:i just want a new shield type that is literally a second healthbar, with no graphic or anything else. it simply loses HP when shot, and when the shield is down the main healthbar gets hit. customisable shield hp/drain/regen but literally just a blue healthbar above the green one. it would make everything so easy! just lua or script the fx afterward for big win
I hear there's work (or maybe completion for next version?) on a UnitPreDamaged callin, would allow you to block damage via Lua. You could also do this via COB (HitByWeapon) right now, or by armor types and manual damage application via Lua (similar to my s44 AP damage test mod), although this is somewhat more annoying.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shields! A Rant.

Post by Argh »

Meh, it can be done even easier than that. Just reverse the damage done immediately, drain it from the shield's power instead, and increase each shield's power by whatever each second / frame / whatever.

The problem is area shields. Since Lua can't do a search for weaponprojectiles in a given volume, can't destroy weaponprojectiles, etc. like the engine can, the solutions are pretty slow and yucky. If we could do those searches via Lua... hell, I'd be really tempted to do a lot of very fancy stuff at that point, as well as refining their performance, etc., which I can't do ATM, since it's all hard-coded.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Shields! A Rant.

Post by Google_Frog »

Argh wrote:The "irritating issue" is that Shields don't lose the hitpoints of the weaponProjectile's default damage. If that was fixed, then they'd start making sense. Instead, they just lose X hitpoints every time they're hit, by any weaponProjectile with the appropriate bitfield setting.
They work fine for destruction shields.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shields! A Rant.

Post by Argh »

You're right, that works.

Still won't block mortar rounds, though. Maybe it's the velocity?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Shields! A Rant.

Post by lurker »

Argh wrote:The "irritating issue" is that Shields don't lose the hitpoints of the weaponProjectile's default damage. If that was fixed, then they'd start making sense. Instead, they just lose X hitpoints every time they're hit, by any weaponProjectile with the appropriate bitfield setting.
[code] const int type = (*pi)->ShieldRepulse(this, weaponPos,
weaponDef->shieldForce,
weaponDef->shieldMaxSpeed);
if (type == 0) {
continue;
}
else if (type == 1) {
owner->UseEnergy(weaponDef->shieldEnergyUse);
if (weaponDef->shieldPower != 0) {
curPower -= (*pi)->weaponDef->damages[0];
}
}
else {
owner->UseEnergy(weaponDef->shieldEnergyUse / 30.0f);
if (weaponDef->shieldPower != 0) {
curPower -= (*pi)->weaponDef->damages[0] / 30.0f;
}
}
[/code]
You tested this? I've never seen it. The only thing that is constant per shot is the non-charging E cost, which is an entirely different tag.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shields! A Rant.

Post by Argh »

Google_Frog's right, it works differently with repulsers vs. destroyers. I can live with that, destroyer shields isn't a biggie.

The weirdness with mortars is just what it is. I'll do a couple more tests, see if I can narrow it down.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shields! A Rant.

Post by Argh »

Ok, just found the issue. It's the default damage value. Lowering it to 1 results in interception.

That doesn't make any sense, though. The shield has 2000 hitpoints. The MortarTank does 750.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Shields! A Rant.

Post by lurker »

I never said he was wrong. I said you were wrong. :P Quoting from much earlier, "It costs the weapon's damage to repulse for 1.0 seconds." They do lose the weapon's default damage... each 1 second = 30 frames of repulsion. It's not a wtf-fixed-rate.

Your mortar issue does sound weird. What's the max you can have for the damage for it to work? The code is a mere: if curPower > (*pi)->weaponDef->damages[0]
Post Reply

Return to “Feature Requests”