Skip to content

Commit

Permalink
actual babyrage
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed May 9, 2020
1 parent dd18518 commit 424cabb
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +329,17 @@ function scoreBoard(pn, position)
local ws = "Wife" .. wv .. " J"
if params.Name == "PrevJudge" and judge > 4 then
judge = judge - 1
rescorepercent = getRescoredWife3Judge(2, judge, rescoretable)
rescorepercent = getRescoredWife3Judge(3, judge, rescoretable)
self:settextf(
"%05.2f%% (%s)", notShit.floor(rescorepercent, 2), ws .. judge
"%05.2f%% (%s) : %05.2f%%", notShit.floor(rescorepercent, 2), ws .. judge, notShit.floor(score:GetWifeScore() * 100, 2)
)
MESSAGEMAN:Broadcast("RecalculateGraphs", {judge = judge})
elseif params.Name == "NextJudge" and judge < 9 then
judge = judge + 1
rescorepercent = getRescoredWife3Judge(2, judge, rescoretable)
rescorepercent = getRescoredWife3Judge(3, judge, rescoretable)
local js = judge ~= 9 and judge or "ustice"
self:settextf(
"%05.2f%% (%s)", notShit.floor(rescorepercent, 2), ws .. js
"%05.2f%% (%s) : %05.2f%%", notShit.floor(rescorepercent, 2), ws .. js, notShit.floor(score:GetWifeScore() * 100, 2)
)
MESSAGEMAN:Broadcast("RecalculateGraphs", {judge = judge})
end
Expand Down Expand Up @@ -379,13 +379,13 @@ function scoreBoard(pn, position)
local ws = "Wife" .. wv .. " J"
if params.Name == "PrevJudge" and judge2 > 4 then
judge2 = judge2 - 1
rescorepercent = getRescoredWife3Judge(2, judge2, rescoretable)
rescorepercent = getRescoredWife3Judge(3, judge2, rescoretable)
self:settextf(
"%05.5f%% (%s)", notShit.floor(rescorepercent, 5), ws .. judge2
)
elseif params.Name == "NextJudge" and judge2 < 9 then
judge2 = judge2 + 1
rescorepercent = getRescoredWife3Judge(2, judge2, rescoretable)
rescorepercent = getRescoredWife3Judge(3, judge2, rescoretable)
local js = judge2 ~= 9 and judge2 or "ustice"
self:settextf(
"%05.5f%% (%s)", notShit.floor(rescorepercent, 5), ws .. js
Expand Down
111 changes: 21 additions & 90 deletions Themes/_fallback/Scripts/10 Scores.lua
Original file line number Diff line number Diff line change
Expand Up @@ -622,96 +622,27 @@ function erf(x)

return sign*y
end

-- note lua should always be dealing with MS not S as a unit
function wife3(maxms, ts, version) -- args are going to be set from in here for now
-- hoooooo boy shits about to get reeaaallll messy
local max_points = 0
local miss_weight = 0
local ridic = 0
local max_boo_weight = 0
local j_pow = 0
local poi = 0
local dev = 0
local magic = 0
local log_pow = 0
local lower_bound = 0

if (version == 1) or (version == 2) or (version == 3) then -- hyperbolic lower bound
if (version == 1 or (version == 2)) then
max_points = 2
miss_weight = -5.5
ridic = 5 * ts
max_boo_weight = 180 * ts
j_pow = 0.66
poi = 57 * (ts^j_pow)
dev = 22 * (ts^j_pow)

if maxms > 70 or (maxms < 57 and maxms > 20) then
max_points = 2
miss_weight = -5.5
ridic = 5 * ts
max_boo_weight = 180 * ts
j_pow = 0.66
poi = 56.5 * (ts^j_pow)
dev = 20.75 * (ts^j_pow)
end

if version == 1 then
miss_weight = -5.641623
end

if version == 1 and maxms >= 75 and maxms <= 180 then
return -0.8746 - (0.0454 * (maxms - 75))
end
elseif (version == 3) then
max_points = 2
miss_weight = -5.6
ridic = 7.5 * ts
max_boo_weight = 180 * ts
j_pow = 0.66
poi = 56.765 * (ts^j_pow)
dev = 20.89 * (ts^j_pow)
end
-- shortcut case handling
if maxms <= ridic then -- anything below this (judge scaled) threshold is counted as full pts
return max_points
end
if maxms > max_boo_weight then -- we can just set miss values manually
return miss_weight -- technically the max boo is always 180 above j4 however this is immaterial to the
end -- purpose of the scoring curve, which is to assign point values

-- lower bound calculation
lower_bound = max_points + ((miss_weight - max_points) * math.sqrt(maxms * maxms - ridic * ridic) / (max_boo_weight - ridic));
else -- logarithmic lower bound
if version == 4 then
max_points = 2
miss_weight = -5.5
ridic = 7.5 * ts
max_boo_weight = 180 * ts
j_pow = 0.66
poi = 55 * (ts^j_pow)
dev = 25 * (ts^j_pow)
magic = 39 * ts
log_pow = 8
end
-- shortcut case handling
if maxms <= ridic then -- anything below this (judge scaled) threshold is counted as full pts
return max_points
end
if maxms > max_boo_weight then -- we can just set miss values manually
return miss_weight -- technically the max boo is always 180 above j4 however this is immaterial to the
end -- purpose of the scoring curve, which is to assign point values

-- WHY is this so complicated surely there is a better way
lower_bound = max_points + ((miss_weight - max_points) * (math.log(((maxms - ridic)*magic) + 1)/math.log(((max_boo_weight - ridic)*magic) + 1))^log_pow);
end
-- calculate the actual value
if (version == 3) and (maxms > 60) then
return 3.605 - (0.05058 * maxms)
end
local y_val = (erf((poi - maxms) / dev) + 1) / 2;
return (max_points - lower_bound) * y_val + lower_bound;
function wife3(maxms, ts, version)

local max_points = 2
local miss_weight = -5.5
local ridic = 5 * ts
local max_boo_weight = 180 * ts
local ts_pow = 0.75
local zero = 65 * (ts^ts_pow)
local power = 2.5
local dev = 22.7 * (ts^ts_pow)

-- case handling
if maxms <= ridic then -- anything below this (judge scaled) threshold is counted as full pts
return max_points
elseif maxms <= zero then -- ma/pa region, exponential
return max_points * erf((zero - maxms) / dev)
elseif maxms <= max_boo_weight then -- cb region, linear
return (maxms - zero) * miss_weight / (max_boo_weight - zero)
else -- we can just set miss values manually
return miss_weight -- technically the max boo is always 180 above j4 however this is immaterial to the
end -- purpose of the scoring curve, which is to assign point values
end

-- holy shit this is fugly
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Globals/MinaCalcOld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,5 +1128,5 @@ MinaSDCalc_OLD(const vector<NoteInfo>& NoteInfo)
int
GetCalcVersion_OLD()
{
return 263;
return 292;
}
9 changes: 5 additions & 4 deletions src/Etterna/Models/Misc/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1381,15 +1381,15 @@ HighScore::RescoreToWife2Judge(int x)
bool
HighScore::RescoreToWife3(float pmax)
{
// already done
if (GetWifeVersion() == 3)
return false;
// can't do it
if (!LoadReplayData())
return false;
// we can do it, but the result won't make sense
if (!m_Impl->bNoChordCohesion)
if (!m_Impl->bNoChordCohesion) {
m_Impl->WifeVersion = 2;
return false;
}


// i don't know why this would be possible or what to do if we catch these
// cases, but it is somehow (probably exclusive to my profile)
Expand Down Expand Up @@ -1423,6 +1423,7 @@ HighScore::RescoreToWife3(float pmax)
p += m_Impl->iTapNoteScores[TNS_HitMine] * wife3_mine_hit_weight;

m_Impl->fWifeScore = p / pmax;
m_Impl->fWifePoints = p;
m_Impl->WifeVersion = 3;
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/Singletons/ScoreManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ ScoreManager::RecalculateSSRs(LoadingWindow* ld, const string& profileID)
// recalc wife3 in case wife3 has changed (which at the time of
// writing this, is likely, since it's still in flux but i've
// already set the version tag as the final)
if (hs->wife_ver != 3 || hs->GetSSRCalcVersion() != GetCalcVersion_OLD())
/* if (hs->wife_ver != 3 || hs->GetSSRCalcVersion() != GetCalcVersion_OLD())*/
remarried = hs->RescoreToWife3(static_cast<float>(maxpoints));

// if this is not a rescore and has already been run on the current calc vers, skip
Expand Down Expand Up @@ -781,7 +781,7 @@ ScoresAtRate::LoadFromNode(const XNode* node,
// be taken care of by calcplayerrating which will be called after
// recalculatessrs
bool oldcalc = scores[sk].GetSSRCalcVersion() != GetCalcVersion_OLD();
bool getremarried = scores[sk].GetWifeVersion() < 3 && scores[sk].HasReplayData();
bool getremarried = /*scores[sk].GetWifeVersion() < 3 &&*/ scores[sk].HasReplayData();

// technically we don't need to have charts loaded to rescore to wife3,
// however trying to do this might be quite a bit of work and while it
Expand Down
50 changes: 37 additions & 13 deletions src/RageUtil/Utils/RageUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,41 @@ static const float wife3_mine_hit_weight = -7.f;
static const float wife3_hold_drop_weight = -4.5f;
static const float wife3_miss_weight = -5.5f;

inline float
werwerwerwerf(float x)
{
static const float a1 = 0.254829592f;
static const float a2 = -0.284496736f;
static const float a3 = 1.421413741f;
static const float a4 = -1.453152027f;
static const float a5 = 1.061405429f;
static const float p = 0.3275911f;

int sign = 1;
if (x < 0.f)
sign = -1;
x = abs(x);

auto t = 1.f / (1.f + p * x);
auto y =
1.f - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * exp(-x * x);

return sign * y;
}

inline float
wife3(float maxms, float ts)
{
// so judge scaling isn't so extreme
static const float j_pow = 0.66f;
static const float j_pow = 0.75f;
// min/max points
static const float max_points = 2.f;
// offset at which points starts decreasing(ms)
float ridic = 3.f * ts;
float ridic = 5.f * ts;

// technically the max boo is always 180ms above j4 however this is immaterial
// to the end purpose of the scoring curve - assignment of point values
// technically the max boo is always 180ms above j4 however this is
// immaterial to the end purpose of the scoring curve - assignment of point
// values
float max_boo_weight = 180.f * ts;

// need positive values for this
Expand All @@ -156,16 +179,17 @@ wife3(float maxms, float ts)
// case optimizations
if (maxms <= ridic)
return max_points;
if (maxms > max_boo_weight)
return wife3_miss_weight;

float poi = 57.f * pow(ts, j_pow); // point of inflection for curve
float dev = 22.f * pow(ts, j_pow);
float y_val = (erf((poi - maxms) / dev) + 1.f) / 2.f;
float lower_bound = max_points + ((wife3_miss_weight - max_points) *
sqrt(maxms * maxms - ridic * ridic) /
(max_boo_weight - ridic));
return (max_points - lower_bound) * y_val + lower_bound;
// piecewise inflection
float zero = 65.f * pow(ts, j_pow);
float dev = 22.7f *pow(ts, j_pow);

if (maxms <= zero)
return max_points * werwerwerwerf((zero - maxms) / dev);
else if (maxms <= max_boo_weight)
return (maxms - zero) * wife3_miss_weight / (max_boo_weight - zero);
else
return wife3_miss_weight;
}

inline void
Expand Down

0 comments on commit 424cabb

Please sign in to comment.