Skip to content

Commit

Permalink
base grindscaler on smoothed npsbase i guess | 464
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Sep 29, 2021
1 parent 3e1c319 commit e94841b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 34 deletions.
4 changes: 2 additions & 2 deletions Themes/Til Death/BGAnimations/_calcdisplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local steplength = 0
local graphVecs = {}
local jackdiffs = {}
local ssrs = {}
local grindscaler = {Left = 0, Right = 0}
local grindscaler = 0
local activeModGroup = 1
local activeDiffGroup = 1
local debugstrings
Expand Down Expand Up @@ -1137,7 +1137,7 @@ o[#o + 1] = LoadFont("Common Normal") .. {
local reqpoints = tappoints * 0.93
self:settextf("Upper Bound: %.2f | Loss Sum L: %5.2f | Loss Sum R: %5.2f | Pt AfterLoss/Req/Max: %5.2f/%5.2f/%5.2f", lowerGraphMaxJack*0.9, jackLossSumLeft, jackLossSumRight, afterloss, reqpoints, maxpoints)
else
self:settextf("Upper Bound: %.4f | Grindscaler: %5.2f (L: %5.2f R: %5.2f)", lowerGraphMax, math.max(grindscaler["Left"], grindscaler["Right"]), grindscaler["Left"], grindscaler["Right"])
self:settextf("Upper Bound: %.4f | Grindscaler: %5.2f", lowerGraphMax, grindscaler)
end
end
end,
Expand Down
7 changes: 2 additions & 5 deletions src/Etterna/MinaCalc/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ Calc::CalcMain(const std::vector<NoteInfo>& NoteInfo,
}
}

auto length_density_scaler =
std::max(grindscaler.at(left_hand), grindscaler.at(right_hand));

// final output is the average of all skillset values of all iterations
// also applies the grindscaler
// (at the time of writing there is only 1 iteration)
Expand All @@ -202,7 +199,7 @@ Calc::CalcMain(const std::vector<NoteInfo>& NoteInfo,
for (auto& ssvals : all_skillset_values) {
iteration_ss_vals.push_back(ssvals[i]);
}
output[i] = mean(iteration_ss_vals) * length_density_scaler;
output[i] = mean(iteration_ss_vals) * grindscaler;
iteration_ss_vals.clear();
}
return output;
Expand Down Expand Up @@ -974,7 +971,7 @@ MinaSDCalcDebug(
}
}

int mina_calc_version = 463;
int mina_calc_version = 464;
auto
GetCalcVersion() -> int
{
Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/MinaCalc/MinaCalc.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ class Calc
/// Total points achievable in the current file (two per note)
float MaxPoints = 0;

/// multiplier to resultant hand difficulty roughly determined by a combination
/// multiplier to resultant roughly determined by a combination
/// of nps and file length
std::array<float, num_hands> grindscaler{};
float grindscaler = 1.F;

/** Debug values - mostly patternmod values per interval per hand.
* These are unnecessary now that the active session calc is a persistent
Expand Down
40 changes: 24 additions & 16 deletions src/Etterna/MinaCalc/SequencedBaseDiffCalc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@
* threaded calc object now, though) */

/// required percentage of average notes to pass
static const float min_threshold = 0.8F;
constexpr float min_threshold = 0.75F;
static const float downscale_logbase = std::log(6.2F);

struct nps
{
/// determine NPSBase, itv_points, and grindscaler for this hand
/// determine NPSBase, itv_points for this hand
static void actual_cancer(Calc& calc, const int& hand)
{
auto populated_intervals = 0;
auto avg_notes = 0.F;

for (auto itv = 0; itv < calc.numitv; ++itv) {

auto notes = 0;
Expand All @@ -34,8 +32,20 @@ struct nps

// set points for this interval
calc.itv_points.at(hand).at(itv) = notes * 2;
}
}

/// determine grindscaler using smoothed npsbase
static void grindscale(Calc& calc) {
auto populated_intervals = 0;
auto avg_notes = 0.F;
for (auto itv = 0; itv < calc.numitv; ++itv) {
auto notes = 0.F;

for (auto& hand : both_hands) {
notes += calc.init_base_diff_vals.at(hand).at(NPSBase).at(itv);
}

// grindscaler stuff
if (notes > 0) {
avg_notes += notes;
populated_intervals++;
Expand All @@ -51,9 +61,9 @@ struct nps

for (auto itv = 0; itv < calc.numitv; itv++) {
auto notes = 0.F;
for (auto row = 0; row < calc.itv_size.at(itv); row++) {
notes += calc.adj_ni.at(itv).at(row).hand_counts.at(hand);
}
for (auto& hand : both_hands)
notes +=
calc.init_base_diff_vals.at(hand).at(NPSBase).at(itv);

// count only intervals with notes
if (notes > 0.F && notes < avg_notes * min_threshold)
Expand All @@ -65,16 +75,14 @@ struct nps
// ask yourself... is it really worth playing?
const auto file_length =
itv_idx_to_time(populated_intervals - failed_intervals);
// log minimum but if you move this you need to move the log base
const auto ping = .3F;
const auto timescaler =
std::clamp(
0.95F + (0.05F * (file_length - 35.F) / 35.F), 0.9F, 1.F) *
std::clamp(
0.9F + (0.1F * (file_length - 25.F) / 25.F), 0.8F, 1.F) *
std::clamp(0.7F + (0.1F * (file_length - 5.F) / 5.F), 0.6F, 1.F);
(ping * (std::log(file_length + 1) / downscale_logbase)) + ping;

calc.grindscaler.at(hand) = std::clamp(timescaler, .1F, 1.F);
calc.grindscaler = std::clamp(timescaler, .1F, 1.F);
} else {
calc.grindscaler.at(hand) = .1F;
calc.grindscaler = .1F;
}
}
};
Expand Down
2 changes: 2 additions & 0 deletions src/Etterna/MinaCalc/Ulbu.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ struct TheGreatBazoinkazoinkInTheSky
// when we finish left hand
++hand;
}

nps::grindscale(_calc);
}
#pragma endregion

Expand Down
10 changes: 1 addition & 9 deletions src/Etterna/Models/StepsAndStyles/Steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,15 +1158,7 @@ class LunaSteps : public Luna<Steps>
lua_rawset(L, -3);

lua_pushstring(L, "Grindscaler");
lua_createtable(L, 0, 2);
{
lua_pushstring(L, "Left");
lua_pushnumber(L, SONGMAN->calc->grindscaler.at(0));
lua_rawset(L, -3);
lua_pushstring(L, "Right");
lua_pushnumber(L, SONGMAN->calc->grindscaler.at(1));
lua_rawset(L, -3);
}
lua_pushnumber(L, SONGMAN->calc->grindscaler);
lua_rawset(L, -3);

return 1;
Expand Down

0 comments on commit e94841b

Please sign in to comment.