Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research: Falloff - How is calculated/how to change #16

Closed
MikeJeffers opened this issue Dec 16, 2017 · 2 comments
Closed

Research: Falloff - How is calculated/how to change #16

MikeJeffers opened this issue Dec 16, 2017 · 2 comments

Comments

@MikeJeffers
Copy link
Contributor

MikeJeffers commented Dec 16, 2017

Balance team request: Falloff is convoluted curve,
A) what is it exactly?
B) can we customize?
C) set floor? (end at x% of damage, instead of 0%)

@MikeJeffers MikeJeffers added this to the Feasibility Studies milestone Dec 16, 2017
@MikeJeffers MikeJeffers added this to TODO in SERVER Dec 28, 2017
@MikeJeffers MikeJeffers removed this from the Feasibility Studies milestone Dec 29, 2017
@Sellafield Sellafield self-assigned this Dec 30, 2017
@Sellafield Sellafield moved this from TODO to Doing in SERVER Dec 30, 2017
@Sellafield
Copy link

assuming we have Opt as optimal range, Fall as falloff, O-F as total range, and Dist - as actual diatance to target, we can calculate damage modifier Mod as multiplier using these rules:

if Dist < Opt then Mod = 1;
if Dist > O-F then Mod = 0;
if Dist > Opt and < O-F then Mod = (Sin((Dist - Opt) / (O-F - Opt) * 3.14159265358979 + 1.5707963267949) + 1) / 2

unfirtunately there is no way to change that until we get the source code. after that, we can just switch formula to

Mod = (Sin((Dist - Opt) / (O-F - Opt) * 1.5707963267949 + 1.5707963267949) + 1) / 2

, which will limit the results between 1 and 0.5

keep in mind tho, that it's affect not only just damage calculation but also terraforming.

SERVER automation moved this from Doing to Done Jan 3, 2018
@Sellafield
Copy link

Upd:

That's be MathHelper.cs line 46 (DistanceFalloff method)

here it takes 6 params which are:

double nearRadius - that'd be Opt
double farRadius - that'd be O-F
double originX, originY - your position coords
double targetX, targetY - target's position coords

Dist is calculated inside the method by hypotenuse formula, using both your and you target's coords to get the sides of the triangle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SERVER
  
Done - Patched to Live
Development

No branches or pull requests

2 participants