Configurable level and stat/experience gain charts#590
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Configurable Character Progression + Admin Visual Editor
Replaces all hardcoded character progression constants with a fully configurable system and adds a new
/admin/progressionpage with live charts, interactive controls, and hover tooltips.Config (
GamePlay.Progression.*)ProgressionConfigstruct underGamePlayexposes every previously hardcoded progression constant as a named config keyBaseModFactor,BaseModExponent,NaturalGainsModFactor,NaturalGainsExponentcontrol the racial and flat per-level stat growth curves; exponent fields allow linear, diminishing-returns, or accelerating shapesHPBase,HPPerLevel,HPPerVitality,ManaBase,ManaPerLevel,ManaPerMysticismTrainingPointsPerLevel,TrainingPointsEveryNLevels,StatPointsPerLevel,StatPointsEveryNLevels; theEveryNLevelsfields allow burst-style rewards (e.g. 3 points every 2 levels)XPBase,XPLevelFactor,XPLevelPower(capped at 5.0 to prevent integer overflow)StatCapThreshold,StatCapAnchor,StatCapExponent,StatCapScale,StatCapExemptBonus; whenStatCapExemptBonusis enabled, only racial gains are compressed and training/equipment bonuses land on top at full valueMaxLevelfor chart rangeEngine changes
internal/stats/stats.go—GainsForLevelnow usesmath.Powwith the exponent knobs;Recalculateapplies the configurable cap formula; newNoCap boolfield onStatInfoletsHealthMax/ManaMaxbypass the stat cap (previously they were incorrectly subject to it)internal/characters/character.go—XPTL,LevelUp, andRecalculateStatsall read fromGetProgressionConfig();XPTLnow usesfloat64throughout (removing afloat32cast that caused negative XP display at high levels) and clamps the result tomath.MaxInt64before theintconversioninternal/users/userrecord.go— level-up event accumulator now snapshotsTrainingPoints/StatPointsbefore and after eachLevelUp()call and diffs them, replacing hardcoded+= 1that ignored configinternal/usercommands/experience.go—experience chartcommand now usesValueAdj(compressed effective stat) instead of rawGainsForLevel, so the table matches what the game actually usesAdmin page (
/admin/progression)/admin/progressionwith a sticky left control panel and a live chart columnProgressionConfigfield, grouped into four sections (Stat Gains, HP & Mana, XP Curve, Level-Up Rewards); charts update 150ms after any change without saving?tooltips — every control has a styled CSS tooltip explaining its intended effect and example use cases; tooltips are not clipped by the panel (overflow: hiddenremoved and replaced with targetedborder-radiuson first/last children)ResizeObserver; data is computed server-side so charts are guaranteed to match the engineGET /admin/api/v1/progression/previewaccepts all config fields as query params, runs the actual Go formulas, and returns precomputed chart series (downsampled to ≤100 points regardless of MaxLevel)Bug fixes
HealthMaxandManaMaxwere incorrectly subject to the stat cap compression formula; fixed viaStatInfo.NoCapTrainingPoints/StatPointscounts were hardcoded to 1 regardless of configexperience chartcommand showed rawValueinstead of compressedValueAdjXPTLused afloat32cast that caused precision loss and negative XP display above ~level 150; now fullyfloat64XPLevelPowervalidation cap lowered from 10.0 to 5.0 to prevent integer overflow at high levels with steep curves