Is it possible to have linear edgeeffectiveness?

Is it possible to have linear edgeeffectiveness?

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Is it possible to have linear edgeeffectiveness?

Post by Forboding Angel »

edgeeffectiveness, for whatever reason works on a curve instead of a linear dropoff. I honestly don't understand how this is preferable to a linear dropoff where you can have fine tuned damage control, but that is an argument for another time.

Is there any way to make the damage drop off linearly?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Is it possible to have linear edgeeffectiveness?

Post by FLOZi »

https://springrts.com/mediawiki/images/ ... veness.png

Use the default value of 0 for a linear decay.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Is it possible to have linear edgeeffectiveness?

Post by Forboding Angel »

Oh, well that works. Silly me then. But default used to be 0.5 (at least according to the wiki), but I see now that it is 0. Awesome, a problem that solves itself. I can dig it. Thanks :-)

Edit: I just used the waybackmachine to double check that. As of 2014 it was 0, which makes me curious where I got the firm memory of it being 0.5.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Is it possible to have linear edgeeffectiveness?

Post by PicassoCT »

Back then when the maidens where many and willing.. oh i remember the days, the fruits where plenty, the youth respected the elders, when they yelled to stop thiefing- and even the sticks where firmer and a edgeeffectiveness only costed 0.5 a factor.

Those where the days sygh, those where the days.

Now look at us, old grumpy reptiles sitting on benches, that are neither pink nor red. Yelling at the api.
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: Is it possible to have linear edgeeffectiveness?

Post by raaar »

if we set edge effectiveness to 0.5, shouldn't the damage drop off linearly from 100% to 50% along the blast radius?
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Is it possible to have linear edgeeffectiveness?

Post by Silentwings »

No, read the wiki.

A discontinuity at the edge of the blast radius, which in many cases would be very annoying to players, is avoided. The formula used is a different sort of interpolation between the 'obvious' behavior expected in the 0 and 1 cases, to what you're thinking of.

Ofc, using Unit/FeaturePreDamaged, you can also implement your own formula.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Is it possible to have linear edgeeffectiveness?

Post by Forboding Angel »

raaar wrote:if we set edge effectiveness to 0.5, shouldn't the damage drop off linearly from 100% to 50% along the blast radius?
A while back, that was a shock to me as well. It essentially makes edgeeffectiveness completely useless for all but a few applications.

Why? because LOL, that's why.

https://springrts.com/mediawiki/images/ ... veness.png << Visual illustration of how it works.
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: Is it possible to have linear edgeeffectiveness?

Post by raaar »

so that means, if one uses edge effectiveness=0.5, in practice a unit caught halfway between from the blastpoint and the blast radius will receive about 0.6*dmg instead of 0.5*dmg (edge effectiveness=0).
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Is it possible to have linear edgeeffectiveness?

Post by Forboding Angel »

Yes, it sucks because it makes your carefully tuned aoe radius completely arbitrary, damagewise. For me this makes my usage of edgeeffectiveness completely binary.

Random damage numbers may be all fine and good in a *A game, but in evo I have very painstaking damage/hp balance/amounts. It's already annoying enough that something can still be alive with 0.0 hp.
sprunk
Posts: 100
Joined: 29 Jun 2015, 07:36

Re: Is it possible to have linear edgeeffectiveness?

Post by sprunk »

Here's a gadget that should make damage fall off linearly to the value specified in the weapondef.

Code: Select all

function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID)
	if weaponID <= 0 then
		return damage -- environmental damage, no weapondef entry
	end

	local weaponDef = WeaponDefs[weaponDefID]
	local ee = weaponDef.edgeEffectiveness
	if ee == 1 then
		return damage -- already desired behaviour and would else crash due to div0
	end

	local baseDamage = weaponDef.damages[UnitDefs[unitDefID].armorType]

	local isArmored, armorMult = Spring.GetUnitArmored(unitID)
	if isArmored then
		if armorMult == 0 then
			return 0
		end
		baseDamage = baseDamage * armorMult
	end

	local fraction = damage / baseDamage
	local distance = (1 - fraction) / (1 - fraction*ee)

	return baseDamage * (1 - distance*(1 - ee))
end
Post Reply

Return to “Game Development”