From 52744f943fc304bb3134749617ef6eb629351b14 Mon Sep 17 00:00:00 2001 From: nicidob Date: Mon, 28 Sep 2020 14:15:20 -0400 Subject: [PATCH 1/6] some data-centric player prog updates --- .../core/player/developSeason.basketball.ts | 208 ++++++------------ .../core/player/genRatings.basketball.ts | 73 +++--- 2 files changed, 101 insertions(+), 180 deletions(-) diff --git a/src/worker/core/player/developSeason.basketball.ts b/src/worker/core/player/developSeason.basketball.ts index d0d2feaf73..d348db8a35 100644 --- a/src/worker/core/player/developSeason.basketball.ts +++ b/src/worker/core/player/developSeason.basketball.ts @@ -10,158 +10,76 @@ type RatingFormula = { changeLimits: (age: number) => [number, number]; }; -const shootingFormula: RatingFormula = { - ageModifier: (age: number) => { - // Reverse most of the age-related decline in calcBaseChange - if (age <= 27) { - return 0; - } - - if (age <= 29) { - return 0.5; - } - - if (age <= 31) { - return 1.5; - } - - return 2; - }, - changeLimits: () => [-3, 13], -}; -const iqFormula: RatingFormula = { - ageModifier: (age: number) => { - if (age <= 21) { - return 4; - } - - if (age <= 23) { - return 3; - } - - // Reverse most of the age-related decline in calcBaseChange - if (age <= 27) { - return 0; - } - - if (age <= 29) { - return 0.5; - } - - if (age <= 31) { - return 1.5; - } - - return 2; - }, - changeLimits: age => { - if (age > 24) { - return [-3, 9]; - } - - // For 19: [-3, 32] - // For 23: [-3, 12] - return [-3, 7 + 5 * (24 - age)]; - }, -}; const ratingsFormulas: Record, RatingFormula> = { stre: { - ageModifier: () => 0, + ageModifier: () => -0.5, changeLimits: () => [-Infinity, Infinity], }, spd: { ageModifier: (age: number) => { - if (age <= 27) { + if (age <= 24) { return 0; } - - if (age <= 30) { - return -2; - } - - if (age <= 35) { - return -3; - } - - if (age <= 40) { - return -4; - } - - return -8; + return -0.2 * (age - 24); }, changeLimits: () => [-12, 2], }, jmp: { ageModifier: (age: number) => { - if (age <= 26) { + if (age <= 24) { return 0; } - - if (age <= 30) { - return -3; - } - - if (age <= 35) { - return -4; - } - - if (age <= 40) { - return -5; - } - - return -10; + return -0.2 * (age - 24); }, changeLimits: () => [-12, 2], }, endu: { ageModifier: (age: number) => { - if (age <= 23) { - return random.uniform(0, 9); + if (age <= 20) { + return 4; } - - if (age <= 30) { - return 0; - } - - if (age <= 35) { - return -2; - } - - if (age <= 40) { - return -4; - } - - return -8; + return -0.5 * (age - 20) + 4; }, changeLimits: () => [-11, 19], }, dnk: { - ageModifier: (age: number) => { - // Like shootingForumla, except for old players - if (age <= 27) { - return 0; - } - - return 0.5; - }, - changeLimits: () => [-3, 13], + ageModifier: () => 0, + changeLimits: () => [-2, 5], + }, + ins: { + ageModifier: () => 0, + changeLimits: () => [-2, 5], + }, + ft: { + ageModifier: () => 0, + changeLimits: () => [-2, 5], + }, + fg: { + ageModifier: () => 0, + changeLimits: () => [-2, 5], + }, + tp: { + ageModifier: () => 0, + changeLimits: () => [-2, 5], + }, + oiq: { + ageModifier: () => 0, + changeLimits: () => [-2, 5], + }, + diq: { + ageModifier: () => 0, + changeLimits: () => [-2, 5], }, - ins: shootingFormula, - ft: shootingFormula, - fg: shootingFormula, - tp: shootingFormula, - oiq: iqFormula, - diq: iqFormula, drb: { - ageModifier: shootingFormula.ageModifier, + ageModifier: () => 0, changeLimits: () => [-2, 5], }, pss: { - ageModifier: shootingFormula.ageModifier, + ageModifier: () => 0, changeLimits: () => [-2, 5], }, reb: { - ageModifier: shootingFormula.ageModifier, + ageModifier: () => 0, changeLimits: () => [-2, 5], }, }; @@ -169,33 +87,19 @@ const ratingsFormulas: Record, RatingFormula> = { const calcBaseChange = (age: number, coachingRank: number): number => { let val: number; - if (age <= 21) { + if (age <= 20) { val = 2; - } else if (age <= 25) { - val = 1; - } else if (age <= 27) { - val = 0; - } else if (age <= 29) { - val = -1; - } else if (age <= 31) { - val = -2; - } else if (age <= 34) { - val = -3; - } else if (age <= 40) { - val = -4; - } else if (age <= 43) { - val = -5; } else { - val = -6; + val = -0.33 * (age - 20) + 2; } // Noise if (age <= 23) { - val += helpers.bound(random.realGauss(0, 5), -4, 20); - } else if (age <= 25) { - val += helpers.bound(random.realGauss(0, 5), -4, 10); + val += helpers.bound(random.realGauss(0, 7), -10, 20); + } else if (age <= 28) { + val += helpers.bound(random.realGauss(0, 6), -15, 15); } else { - val += helpers.bound(random.realGauss(0, 3), -2, 4); + val += helpers.bound(random.realGauss(0, 5), -15, 10); } // Modulate by coaching. g.get("numActiveTeams") doesn't exist when upgrading DB, but that doesn't matter @@ -227,8 +131,26 @@ const developSeason = ( ratings.hgt += 1; } } - - const baseChange = calcBaseChange(age, coachingRank); + const baseChange1 = calcBaseChange(age, coachingRank); + const baseChange2 = calcBaseChange(age, coachingRank); + + const ratingsNumbers: Record, number> = { + stre: baseChange1, + spd: baseChange2, + jmp: baseChange2, + endu: baseChange1, + dnk: baseChange1, + ins: baseChange1, + ft: baseChange2, + fg: baseChange2, + tp: baseChange2, + oiq: baseChange1, + diq: baseChange1, + drb: baseChange2, + pss: baseChange2, + reb: baseChange1, + }; + const mult = 1.4; for (const key of helpers.keys(ratingsFormulas)) { const ageModifier = ratingsFormulas[key].ageModifier(age); @@ -237,9 +159,9 @@ const developSeason = ( ratings[key] = limitRating( ratings[key] + helpers.bound( - (baseChange + ageModifier) * random.uniform(0.4, 1.4), + (ratingsNumbers[key] + ageModifier) * random.uniform(0.4, 1.4), changeLimits[0], - changeLimits[1], + mult * changeLimits[1], ), ); } diff --git a/src/worker/core/player/genRatings.basketball.ts b/src/worker/core/player/genRatings.basketball.ts index 05d76b19f9..5230160e88 100644 --- a/src/worker/core/player/genRatings.basketball.ts +++ b/src/worker/core/player/genRatings.basketball.ts @@ -14,34 +14,31 @@ const typeFactors: Record< Partial> > = { point: { - jmp: 1.65, - spd: 1.65, - drb: 1.5, - pss: 1.5, - ft: 1.4, - fg: 1.4, - tp: 1.4, - oiq: 1.2, - endu: 1.4, - }, - wing: { - drb: 1.2, - dnk: 1.5, - jmp: 1.4, - spd: 1.4, + jmp: 1.2, + spd: 1.1, + drb: 1.1, + pss: 1.2, + reb: 0.9, + ins: 0.9, ft: 1.2, fg: 1.2, tp: 1.2, + endu: 1.1, + dnk: 0.9, }, + wing: {}, big: { - stre: 1.2, - ins: 1.6, - dnk: 1.5, - reb: 1.4, + stre: 1.1, + ins: 1.1, + dnk: 1.1, + endu: 0.9, + reb: 1.1, + spd: 0.9, + jmp: 0.9, + pss: 0.8, ft: 0.8, fg: 0.8, tp: 0.8, - diq: 1.2, }, }; @@ -100,37 +97,38 @@ const genRatings = ( // Tall players are less talented, and all tend towards dumb and can't shoot because they are rookies const rawRatings = { - stre: 37, - spd: 40, - jmp: 40, - endu: 17, - ins: 27, - dnk: 27, - ft: 32, - fg: 32, - tp: 32, - oiq: 22, - diq: 22, - drb: 37, + stre: 44, + spd: 47, + jmp: 47, + endu: 33, + ins: 39, + dnk: 43, + ft: 39, + fg: 39, + tp: 41, + oiq: 37, + diq: 39, + drb: 46, pss: 37, reb: 37, }; // For correlation across ratings, to ensure some awesome players, but athleticism and skill are independent to // ensure there are some who are elite in one but not the other + const factorBig = helpers.bound(random.realGauss(1, 0.2), 0.2, 1.2); const factorAthleticism = helpers.bound(random.realGauss(1, 0.2), 0.2, 1.2); const factorShooting = helpers.bound(random.realGauss(1, 0.2), 0.2, 1.2); const factorSkill = helpers.bound(random.realGauss(1, 0.2), 0.2, 1.2); - const factorIns = helpers.bound(random.realGauss(1, 0.2), 0.2, 1.2); - const athleticismRatings = ["stre", "spd", "jmp", "endu", "dnk"]; + const bigRatings = ["stre", "ins", "reb", "endu", "dnk"]; + const athleticismRatings = ["spd", "jmp"]; const shootingRatings = ["ft", "fg", "tp"]; - const skillRatings = ["oiq", "diq", "drb", "pss", "reb"]; // ins purposely left out + const skillRatings = ["oiq", "diq", "drb", "pss"]; for (const key of helpers.keys(rawRatings)) { const typeFactor = typeFactors[type].hasOwnProperty(key) ? typeFactors[type][key] : 1; - let factor = factorIns; + let factor = 1; if (athleticismRatings.includes(key)) { factor = factorAthleticism; @@ -138,8 +136,9 @@ const genRatings = ( factor = factorShooting; } else if (skillRatings.includes(key)) { factor = factorSkill; + } else if (bigRatings.includes(key)) { + factor = factorBig; } - // For TypeScript // https://github.com/microsoft/TypeScript/issues/21732 if (typeFactor === undefined) { From 9fb82f3a930d8ffbf8b8f0dc0fee5c22c3962687 Mon Sep 17 00:00:00 2001 From: nicidob Date: Fri, 2 Oct 2020 18:52:00 -0400 Subject: [PATCH 2/6] bit of balance --- .../core/player/developSeason.basketball.ts | 82 +++++++------------ .../core/player/genRatings.basketball.ts | 57 +++++++------ 2 files changed, 62 insertions(+), 77 deletions(-) diff --git a/src/worker/core/player/developSeason.basketball.ts b/src/worker/core/player/developSeason.basketball.ts index d348db8a35..49e9dd18d9 100644 --- a/src/worker/core/player/developSeason.basketball.ts +++ b/src/worker/core/player/developSeason.basketball.ts @@ -10,28 +10,35 @@ type RatingFormula = { changeLimits: (age: number) => [number, number]; }; +const defaultFormula: RatingFormula = { + ageModifier: (age: number) => { + return 0; + }, + changeLimits: () => [-10, 10], +}; + const ratingsFormulas: Record, RatingFormula> = { stre: { ageModifier: () => -0.5, - changeLimits: () => [-Infinity, Infinity], + changeLimits: () => [-10, 10], }, spd: { ageModifier: (age: number) => { if (age <= 24) { return 0; } - return -0.2 * (age - 24); + return -0.25 * (age - 24); }, - changeLimits: () => [-12, 2], + changeLimits: () => [-10, 10], }, jmp: { ageModifier: (age: number) => { if (age <= 24) { return 0; } - return -0.2 * (age - 24); + return -0.25 * (age - 24); }, - changeLimits: () => [-12, 2], + changeLimits: () => [-10, 10], }, endu: { ageModifier: (age: number) => { @@ -40,48 +47,18 @@ const ratingsFormulas: Record, RatingFormula> = { } return -0.5 * (age - 20) + 4; }, - changeLimits: () => [-11, 19], - }, - dnk: { - ageModifier: () => 0, - changeLimits: () => [-2, 5], - }, - ins: { - ageModifier: () => 0, - changeLimits: () => [-2, 5], - }, - ft: { - ageModifier: () => 0, - changeLimits: () => [-2, 5], - }, - fg: { - ageModifier: () => 0, - changeLimits: () => [-2, 5], - }, - tp: { - ageModifier: () => 0, - changeLimits: () => [-2, 5], - }, - oiq: { - ageModifier: () => 0, - changeLimits: () => [-2, 5], - }, - diq: { - ageModifier: () => 0, - changeLimits: () => [-2, 5], - }, - drb: { - ageModifier: () => 0, - changeLimits: () => [-2, 5], - }, - pss: { - ageModifier: () => 0, - changeLimits: () => [-2, 5], - }, - reb: { - ageModifier: () => 0, - changeLimits: () => [-2, 5], + changeLimits: () => [-20, 20], }, + dnk: defaultFormula, + ins: defaultFormula, + ft: defaultFormula, + fg: defaultFormula, + tp: defaultFormula, + oiq: defaultFormula, + diq: defaultFormula, + drb: defaultFormula, + pss: defaultFormula, + reb: defaultFormula, }; const calcBaseChange = (age: number, coachingRank: number): number => { @@ -90,16 +67,16 @@ const calcBaseChange = (age: number, coachingRank: number): number => { if (age <= 20) { val = 2; } else { - val = -0.33 * (age - 20) + 2; + val = -0.35 * (age - 20) + 2; } // Noise if (age <= 23) { - val += helpers.bound(random.realGauss(0, 7), -10, 20); + val += helpers.bound(random.realGauss(0, 7), -5, 20); } else if (age <= 28) { - val += helpers.bound(random.realGauss(0, 6), -15, 15); + val += helpers.bound(random.realGauss(0, 6), -7, 20); } else { - val += helpers.bound(random.realGauss(0, 5), -15, 10); + val += helpers.bound(random.realGauss(0, 5), -10, 10); } // Modulate by coaching. g.get("numActiveTeams") doesn't exist when upgrading DB, but that doesn't matter @@ -144,13 +121,12 @@ const developSeason = ( ft: baseChange2, fg: baseChange2, tp: baseChange2, - oiq: baseChange1, + oiq: baseChange2, diq: baseChange1, drb: baseChange2, pss: baseChange2, reb: baseChange1, }; - const mult = 1.4; for (const key of helpers.keys(ratingsFormulas)) { const ageModifier = ratingsFormulas[key].ageModifier(age); @@ -161,7 +137,7 @@ const developSeason = ( helpers.bound( (ratingsNumbers[key] + ageModifier) * random.uniform(0.4, 1.4), changeLimits[0], - mult * changeLimits[1], + changeLimits[1], ), ); } diff --git a/src/worker/core/player/genRatings.basketball.ts b/src/worker/core/player/genRatings.basketball.ts index 5230160e88..3b44eb6644 100644 --- a/src/worker/core/player/genRatings.basketball.ts +++ b/src/worker/core/player/genRatings.basketball.ts @@ -14,19 +14,28 @@ const typeFactors: Record< Partial> > = { point: { - jmp: 1.2, + jmp: 1.3, spd: 1.1, drb: 1.1, - pss: 1.2, - reb: 0.9, + pss: 1.3, + reb: 0.8, ins: 0.9, - ft: 1.2, - fg: 1.2, - tp: 1.2, + ft: 1.3, + fg: 1.3, + tp: 1.3, endu: 1.1, + dnk: 0.8, + }, + wing: { dnk: 0.9, + drb: 0.9, + fg: 0.9, + jmp: 0.9, + pss: 0.9, + spd: 0.9, + stre: 0.9, + tp: 0.9, }, - wing: {}, big: { stre: 1.1, ins: 1.1, @@ -35,10 +44,10 @@ const typeFactors: Record< reb: 1.1, spd: 0.9, jmp: 0.9, - pss: 0.8, - ft: 0.8, - fg: 0.8, - tp: 0.8, + pss: 0.7, + ft: 0.7, + fg: 0.7, + tp: 0.7, }, }; @@ -97,19 +106,19 @@ const genRatings = ( // Tall players are less talented, and all tend towards dumb and can't shoot because they are rookies const rawRatings = { - stre: 44, - spd: 47, - jmp: 47, - endu: 33, - ins: 39, - dnk: 43, - ft: 39, - fg: 39, - tp: 41, - oiq: 37, - diq: 39, - drb: 46, - pss: 37, + stre: 43, + spd: 46, + jmp: 46, + endu: 30, + ins: 37, + dnk: 42, + ft: 37, + fg: 38, + tp: 40, + oiq: 36, + diq: 37, + drb: 45, + pss: 42, reb: 37, }; From 1f365bac0c79bee7df560f127fb7b3f1d74aa7f5 Mon Sep 17 00:00:00 2001 From: nicidob Date: Fri, 2 Oct 2020 19:30:38 -0400 Subject: [PATCH 3/6] more uniform limits --- .../core/player/developSeason.basketball.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/worker/core/player/developSeason.basketball.ts b/src/worker/core/player/developSeason.basketball.ts index 49e9dd18d9..0313a7eb35 100644 --- a/src/worker/core/player/developSeason.basketball.ts +++ b/src/worker/core/player/developSeason.basketball.ts @@ -14,13 +14,19 @@ const defaultFormula: RatingFormula = { ageModifier: (age: number) => { return 0; }, - changeLimits: () => [-10, 10], + changeLimits: (age: number) => { + if (age <= 25) { + return [-8, 10]; + } + const age_adj = -0.5 * (age - 25); + return [-10 + age_adj, 10 + age_adj]; + }, }; const ratingsFormulas: Record, RatingFormula> = { stre: { ageModifier: () => -0.5, - changeLimits: () => [-10, 10], + changeLimits: (age: number) => defaultFormula.changeLimits(age), }, spd: { ageModifier: (age: number) => { @@ -29,7 +35,7 @@ const ratingsFormulas: Record, RatingFormula> = { } return -0.25 * (age - 24); }, - changeLimits: () => [-10, 10], + changeLimits: (age: number) => defaultFormula.changeLimits(age), }, jmp: { ageModifier: (age: number) => { @@ -38,7 +44,7 @@ const ratingsFormulas: Record, RatingFormula> = { } return -0.25 * (age - 24); }, - changeLimits: () => [-10, 10], + changeLimits: (age: number) => defaultFormula.changeLimits(age), }, endu: { ageModifier: (age: number) => { @@ -47,7 +53,7 @@ const ratingsFormulas: Record, RatingFormula> = { } return -0.5 * (age - 20) + 4; }, - changeLimits: () => [-20, 20], + changeLimits: (age: number) => defaultFormula.changeLimits(age), }, dnk: defaultFormula, ins: defaultFormula, @@ -74,7 +80,7 @@ const calcBaseChange = (age: number, coachingRank: number): number => { if (age <= 23) { val += helpers.bound(random.realGauss(0, 7), -5, 20); } else if (age <= 28) { - val += helpers.bound(random.realGauss(0, 6), -7, 20); + val += helpers.bound(random.realGauss(0, 6), -7, 15); } else { val += helpers.bound(random.realGauss(0, 5), -10, 10); } From 629f778a94b1be74281317736d39cde44ce0e353 Mon Sep 17 00:00:00 2001 From: nicidob Date: Fri, 2 Oct 2020 22:24:57 -0400 Subject: [PATCH 4/6] more tweaks --- .../core/player/developSeason.basketball.ts | 123 +++++++++++++----- .../core/player/genRatings.basketball.ts | 64 +++++---- 2 files changed, 124 insertions(+), 63 deletions(-) diff --git a/src/worker/core/player/developSeason.basketball.ts b/src/worker/core/player/developSeason.basketball.ts index 0313a7eb35..67f2d6f83e 100644 --- a/src/worker/core/player/developSeason.basketball.ts +++ b/src/worker/core/player/developSeason.basketball.ts @@ -15,74 +15,139 @@ const defaultFormula: RatingFormula = { return 0; }, changeLimits: (age: number) => { - if (age <= 25) { - return [-8, 10]; + if (age <= 23) { + return [-2, 10]; + } else if (age <= 25) { + return [-10, 5]; } const age_adj = -0.5 * (age - 25); - return [-10 + age_adj, 10 + age_adj]; + return [-15 + age_adj, 3 + age_adj]; }, }; const ratingsFormulas: Record, RatingFormula> = { stre: { - ageModifier: () => -0.5, + ageModifier: (age: number) => { + return -0.4; + }, changeLimits: (age: number) => defaultFormula.changeLimits(age), }, spd: { ageModifier: (age: number) => { - if (age <= 24) { - return 0; + if (age <= 20) { + return -0.1; } - return -0.25 * (age - 24); + return -0.2 * (age - 20) + -0.1; }, changeLimits: (age: number) => defaultFormula.changeLimits(age), }, - jmp: { + jmp: defaultFormula, + endu: { ageModifier: (age: number) => { - if (age <= 24) { - return 0; + if (age <= 20) { + return 3.7; } - return -0.25 * (age - 24); + return -0.5 * (age - 20) + 3.7; }, changeLimits: (age: number) => defaultFormula.changeLimits(age), }, - endu: { + dnk: { + ageModifier: (age: number) => { + if (age <= 20) { + return -0.2; + } + return 0.1 * (age - 20) + -0.2; + }, + changeLimits: (age: number) => defaultFormula.changeLimits(age), + }, + ins: { + ageModifier: (age: number) => { + if (age <= 20) { + return -1.1; + } + return 0.2 * (age - 20) + -1.1; + }, + changeLimits: (age: number) => defaultFormula.changeLimits(age), + }, + ft: { ageModifier: (age: number) => { if (age <= 20) { - return 4; + return -0.4; } - return -0.5 * (age - 20) + 4; + return 0.1 * (age - 20) + -0.4; }, changeLimits: (age: number) => defaultFormula.changeLimits(age), }, - dnk: defaultFormula, - ins: defaultFormula, - ft: defaultFormula, fg: defaultFormula, - tp: defaultFormula, - oiq: defaultFormula, - diq: defaultFormula, - drb: defaultFormula, - pss: defaultFormula, - reb: defaultFormula, + tp: { + ageModifier: (age: number) => { + if (age <= 20) { + return -1.2; + } + return 0.2 * (age - 20) + -1.2; + }, + changeLimits: (age: number) => defaultFormula.changeLimits(age), + }, + oiq: { + ageModifier: (age: number) => { + return 0; + }, + changeLimits: (age: number) => defaultFormula.changeLimits(age), + }, + diq: { + ageModifier: (age: number) => { + if (age <= 20) { + return -0.7; + } + return 0.1 * (age - 20) + -0.7; + }, + changeLimits: (age: number) => defaultFormula.changeLimits(age), + }, + drb: { + ageModifier: (age: number) => { + if (age <= 20) { + return -1.4; + } + return 0.2 * (age - 20) + -1.4; + }, + changeLimits: (age: number) => defaultFormula.changeLimits(age), + }, + pss: { + ageModifier: (age: number) => { + if (age <= 20) { + return -1.1; + } + return 0.2 * (age - 20) + -1.1; + }, + changeLimits: (age: number) => defaultFormula.changeLimits(age), + }, + reb: { + ageModifier: (age: number) => { + if (age <= 20) { + return -0.7; + } + return 0.1 * (age - 20) + -0.7; + }, + changeLimits: (age: number) => defaultFormula.changeLimits(age), + }, }; const calcBaseChange = (age: number, coachingRank: number): number => { let val: number; - if (age <= 20) { - val = 2; + if (age <= 19) { + val = 2.2; } else { - val = -0.35 * (age - 20) + 2; + val = -0.3 * (age - 19) + 2.2; } // Noise if (age <= 23) { val += helpers.bound(random.realGauss(0, 7), -5, 20); } else if (age <= 28) { - val += helpers.bound(random.realGauss(0, 6), -7, 15); + val += helpers.bound(random.realGauss(0, 6), -10, 15); } else { - val += helpers.bound(random.realGauss(0, 5), -10, 10); + val += helpers.bound(random.realGauss(0, 5), -15, 10); } // Modulate by coaching. g.get("numActiveTeams") doesn't exist when upgrading DB, but that doesn't matter @@ -141,7 +206,7 @@ const developSeason = ( ratings[key] = limitRating( ratings[key] + helpers.bound( - (ratingsNumbers[key] + ageModifier) * random.uniform(0.4, 1.4), + (ratingsNumbers[key] + ageModifier) * random.uniform(0.7, 1.3), changeLimits[0], changeLimits[1], ), diff --git a/src/worker/core/player/genRatings.basketball.ts b/src/worker/core/player/genRatings.basketball.ts index 3b44eb6644..c0e4425d13 100644 --- a/src/worker/core/player/genRatings.basketball.ts +++ b/src/worker/core/player/genRatings.basketball.ts @@ -14,26 +14,21 @@ const typeFactors: Record< Partial> > = { point: { - jmp: 1.3, + jmp: 1.2, spd: 1.1, - drb: 1.1, - pss: 1.3, + drb: 1.2, + pss: 1.2, reb: 0.8, ins: 0.9, - ft: 1.3, - fg: 1.3, - tp: 1.3, + ft: 1.2, + fg: 1.2, + tp: 1.2, endu: 1.1, - dnk: 0.8, + dnk: 0.9, }, wing: { - dnk: 0.9, - drb: 0.9, - fg: 0.9, jmp: 0.9, pss: 0.9, - spd: 0.9, - stre: 0.9, tp: 0.9, }, big: { @@ -44,10 +39,11 @@ const typeFactors: Record< reb: 1.1, spd: 0.9, jmp: 0.9, - pss: 0.7, - ft: 0.7, - fg: 0.7, - tp: 0.7, + pss: 0.8, + drb: 0.9, + ft: 0.8, + fg: 0.8, + tp: 0.8, }, }; @@ -106,28 +102,28 @@ const genRatings = ( // Tall players are less talented, and all tend towards dumb and can't shoot because they are rookies const rawRatings = { - stre: 43, - spd: 46, - jmp: 46, - endu: 30, - ins: 37, - dnk: 42, - ft: 37, - fg: 38, - tp: 40, - oiq: 36, - diq: 37, - drb: 45, - pss: 42, - reb: 37, + stre: 45, + spd: 49, + jmp: 49, + endu: 32, + ins: 39, + dnk: 45, + ft: 41, + fg: 41, + tp: 42, + oiq: 38, + diq: 39, + drb: 47, + pss: 44, + reb: 46, }; // For correlation across ratings, to ensure some awesome players, but athleticism and skill are independent to // ensure there are some who are elite in one but not the other - const factorBig = helpers.bound(random.realGauss(1, 0.2), 0.2, 1.2); - const factorAthleticism = helpers.bound(random.realGauss(1, 0.2), 0.2, 1.2); - const factorShooting = helpers.bound(random.realGauss(1, 0.2), 0.2, 1.2); - const factorSkill = helpers.bound(random.realGauss(1, 0.2), 0.2, 1.2); + const factorBig = helpers.bound(random.realGauss(1, 0.4), 0.2, 1.2); + const factorAthleticism = helpers.bound(random.realGauss(1, 0.4), 0.2, 1.2); + const factorShooting = helpers.bound(random.realGauss(1, 0.4), 0.2, 1.2); + const factorSkill = helpers.bound(random.realGauss(1, 0.4), 0.2, 1.2); const bigRatings = ["stre", "ins", "reb", "endu", "dnk"]; const athleticismRatings = ["spd", "jmp"]; const shootingRatings = ["ft", "fg", "tp"]; From e5dfb806a2b00863dd380b5fe4b5591350dcd504 Mon Sep 17 00:00:00 2001 From: nicidob Date: Fri, 9 Oct 2020 20:04:32 -0400 Subject: [PATCH 5/6] another day, another tweak, now with 3 sets --- .../core/player/developSeason.basketball.ts | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/worker/core/player/developSeason.basketball.ts b/src/worker/core/player/developSeason.basketball.ts index 67f2d6f83e..3decf1ba91 100644 --- a/src/worker/core/player/developSeason.basketball.ts +++ b/src/worker/core/player/developSeason.basketball.ts @@ -18,10 +18,10 @@ const defaultFormula: RatingFormula = { if (age <= 23) { return [-2, 10]; } else if (age <= 25) { - return [-10, 5]; + return [-5, 5]; } const age_adj = -0.5 * (age - 25); - return [-15 + age_adj, 3 + age_adj]; + return [-5 + age_adj, 5 + age_adj]; }, }; @@ -179,24 +179,25 @@ const developSeason = ( ratings.hgt += 1; } } - const baseChange1 = calcBaseChange(age, coachingRank); - const baseChange2 = calcBaseChange(age, coachingRank); + const baseChangeStre = calcBaseChange(age, coachingRank); + const baseChangeFin = calcBaseChange(age, coachingRank); + const baseChangeSho = calcBaseChange(age, coachingRank); const ratingsNumbers: Record, number> = { - stre: baseChange1, - spd: baseChange2, - jmp: baseChange2, - endu: baseChange1, - dnk: baseChange1, - ins: baseChange1, - ft: baseChange2, - fg: baseChange2, - tp: baseChange2, - oiq: baseChange2, - diq: baseChange1, - drb: baseChange2, - pss: baseChange2, - reb: baseChange1, + stre: baseChangeStre, + spd: baseChangeFin, + jmp: baseChangeFin, + endu: baseChangeStre, + dnk: baseChangeStre, + ins: baseChangeStre, + ft: baseChangeSho, + fg: baseChangeSho, + tp: baseChangeSho, + oiq: baseChangeFin, + diq: baseChangeStre, + drb: baseChangeFin, + pss: baseChangeFin, + reb: baseChangeStre, }; for (const key of helpers.keys(ratingsFormulas)) { From e72e8d591dd4ed726050cd86d8d5eadd7a8c588c Mon Sep 17 00:00:00 2001 From: nicidob Date: Wed, 3 Feb 2021 17:58:04 -0500 Subject: [PATCH 6/6] trying to move to single prog --- .../core/player/developSeason.basketball.ts | 33 ++++------------ .../core/player/genRatings.basketball.ts | 38 +++++++++---------- 2 files changed, 26 insertions(+), 45 deletions(-) diff --git a/src/worker/core/player/developSeason.basketball.ts b/src/worker/core/player/developSeason.basketball.ts index 3decf1ba91..bf2c7d1d0b 100644 --- a/src/worker/core/player/developSeason.basketball.ts +++ b/src/worker/core/player/developSeason.basketball.ts @@ -16,9 +16,9 @@ const defaultFormula: RatingFormula = { }, changeLimits: (age: number) => { if (age <= 23) { - return [-2, 10]; + return [-2, 20]; } else if (age <= 25) { - return [-5, 5]; + return [-5, 10]; } const age_adj = -0.5 * (age - 25); return [-5 + age_adj, 5 + age_adj]; @@ -143,11 +143,11 @@ const calcBaseChange = (age: number, coachingRank: number): number => { // Noise if (age <= 23) { - val += helpers.bound(random.realGauss(0, 7), -5, 20); + val += helpers.bound(random.realGauss(0, 8), -2, 8); } else if (age <= 28) { - val += helpers.bound(random.realGauss(0, 6), -10, 15); + val += helpers.bound(random.realGauss(0, 6), -2, 6); } else { - val += helpers.bound(random.realGauss(0, 5), -15, 10); + val += helpers.bound(random.realGauss(0, 4), -2, 4); } // Modulate by coaching. g.get("numActiveTeams") doesn't exist when upgrading DB, but that doesn't matter @@ -179,26 +179,7 @@ const developSeason = ( ratings.hgt += 1; } } - const baseChangeStre = calcBaseChange(age, coachingRank); - const baseChangeFin = calcBaseChange(age, coachingRank); - const baseChangeSho = calcBaseChange(age, coachingRank); - - const ratingsNumbers: Record, number> = { - stre: baseChangeStre, - spd: baseChangeFin, - jmp: baseChangeFin, - endu: baseChangeStre, - dnk: baseChangeStre, - ins: baseChangeStre, - ft: baseChangeSho, - fg: baseChangeSho, - tp: baseChangeSho, - oiq: baseChangeFin, - diq: baseChangeStre, - drb: baseChangeFin, - pss: baseChangeFin, - reb: baseChangeStre, - }; + const baseChange = calcBaseChange(age, coachingRank); for (const key of helpers.keys(ratingsFormulas)) { const ageModifier = ratingsFormulas[key].ageModifier(age); @@ -207,7 +188,7 @@ const developSeason = ( ratings[key] = limitRating( ratings[key] + helpers.bound( - (ratingsNumbers[key] + ageModifier) * random.uniform(0.7, 1.3), + (baseChange + ageModifier) * random.uniform(0.1, 1.7), changeLimits[0], changeLimits[1], ), diff --git a/src/worker/core/player/genRatings.basketball.ts b/src/worker/core/player/genRatings.basketball.ts index c0e4425d13..4a435970d7 100644 --- a/src/worker/core/player/genRatings.basketball.ts +++ b/src/worker/core/player/genRatings.basketball.ts @@ -102,28 +102,28 @@ const genRatings = ( // Tall players are less talented, and all tend towards dumb and can't shoot because they are rookies const rawRatings = { - stre: 45, - spd: 49, - jmp: 49, - endu: 32, - ins: 39, - dnk: 45, - ft: 41, - fg: 41, - tp: 42, - oiq: 38, - diq: 39, - drb: 47, - pss: 44, - reb: 46, + stre: 44, + spd: 48, + jmp: 48, + endu: 31, + ins: 38, + dnk: 44, + ft: 40, + fg: 40, + tp: 41, + oiq: 37, + diq: 37, + drb: 46, + pss: 43, + reb: 45, }; // For correlation across ratings, to ensure some awesome players, but athleticism and skill are independent to // ensure there are some who are elite in one but not the other - const factorBig = helpers.bound(random.realGauss(1, 0.4), 0.2, 1.2); - const factorAthleticism = helpers.bound(random.realGauss(1, 0.4), 0.2, 1.2); - const factorShooting = helpers.bound(random.realGauss(1, 0.4), 0.2, 1.2); - const factorSkill = helpers.bound(random.realGauss(1, 0.4), 0.2, 1.2); + const factorBig = helpers.bound(random.realGauss(1, 0.5), 0.2, 1.8); + const factorAthleticism = helpers.bound(random.realGauss(1, 0.5), 0.2, 1.8); + const factorShooting = helpers.bound(random.realGauss(1, 0.5), 0.2, 1.8); + const factorSkill = helpers.bound(random.realGauss(1, 0.5), 0.2, 1.8); const bigRatings = ["stre", "ins", "reb", "endu", "dnk"]; const athleticismRatings = ["spd", "jmp"]; const shootingRatings = ["ft", "fg", "tp"]; @@ -151,7 +151,7 @@ const genRatings = ( } rawRatings[key] = limitRating( - factor * typeFactor * random.realGauss(rawRatings[key], 3), + factor * typeFactor ** 3 * random.realGauss(rawRatings[key], 5), ); }