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: 14571
Joined: 17 Nov 2005, 02:43

Is it possible to have linear edgeeffectiveness?

Post by Forboding Angel » 25 May 2018, 11:15

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?
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6100
Joined: 29 Apr 2005, 01:14

Re: Is it possible to have linear edgeeffectiveness?

Post by FLOZi » 25 May 2018, 19:20

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

Use the default value of 0 for a linear decay.
0 x

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

Re: Is it possible to have linear edgeeffectiveness?

Post by Forboding Angel » 25 May 2018, 20:56

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.
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10199
Joined: 24 Jan 2006, 21:12

Re: Is it possible to have linear edgeeffectiveness?

Post by PicassoCT » 26 May 2018, 13:41

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.
0 x

raaar
Metal Factions Developer
Posts: 805
Joined: 20 Feb 2010, 12:17

Re: Is it possible to have linear edgeeffectiveness?

Post by raaar » 26 May 2018, 14:40

if we set edge effectiveness to 0.5, shouldn't the damage drop off linearly from 100% to 50% along the blast radius?
0 x

User avatar
Silentwings
Moderator
Posts: 3577
Joined: 25 Oct 2008, 00:23

Re: Is it possible to have linear edgeeffectiveness?

Post by Silentwings » 27 May 2018, 07:41

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.
0 x

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

Re: Is it possible to have linear edgeeffectiveness?

Post by Forboding Angel » 27 May 2018, 08:03

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.
1 x

raaar
Metal Factions Developer
Posts: 805
Joined: 20 Feb 2010, 12:17

Re: Is it possible to have linear edgeeffectiveness?

Post by raaar » 27 May 2018, 16:59

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).
0 x

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

Re: Is it possible to have linear edgeeffectiveness?

Post by Forboding Angel » 27 May 2018, 23:53

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.
0 x

sprunk
Posts: 83
Joined: 29 Jun 2015, 07:36

Re: Is it possible to have linear edgeeffectiveness?

Post by sprunk » 28 May 2018, 11:22

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
1 x

Post Reply

Return to “Game Development”