@@ -10,6 +10,15 @@ let PRESETS = {};
1010let PRESETS_RAW = [ ] ;
1111let buildableLandPolygon = [ ] ;
1212
13+ const PRESET_SIGMAS = {
14+ phase1 : 200 ,
15+ phase2 : 300 ,
16+ phase3 : 400 ,
17+ phase4 : 600 ,
18+ phase5 : 800 ,
19+ collectibles : 1000 ,
20+ } ;
21+
1322// Resource Registry and Stylings
1423const RESOURCES = [
1524 // Core Resources
@@ -49,7 +58,7 @@ const RESOURCES = [
4958const state = {
5059 rawNodes : [ ] ,
5160 config : {
52- sigma : 700 ,
61+ sigma : 200 ,
5362 utilityFunc : "cobb_douglas" ,
5463 decayFunc : "gaussian" ,
5564 purityOverride : "default" ,
@@ -81,6 +90,8 @@ const els = {
8190 paramDecay : document . getElementById ( "param-decay" ) ,
8291 paramPurity : document . getElementById ( "param-purity" ) ,
8392 paramStrategy : document . getElementById ( "param-strategy" ) ,
93+ paramSigma : document . getElementById ( "param-sigma" ) ,
94+ paramSigmaValue : document . getElementById ( "param-sigma-value" ) ,
8495 paramIgnoreSpawns : document . getElementById ( "param-ignore-spawns" ) ,
8596 btnCompute : document . getElementById ( "btn-compute" ) ,
8697} ;
@@ -322,6 +333,7 @@ async function runGlobalOptimization() {
322333 purity_override : config . purityOverride ,
323334 strategy : config . strategy ,
324335 game_phase : config . gamePhase ,
336+ sigma : config . sigma ,
325337 ignore_spawns : config . ignoreSpawns ,
326338 weights : Object . fromEntries ( Object . entries ( config . weights ) . filter ( ( [ _ , v ] ) => v !== 0 ) ) ,
327339 } ;
@@ -770,6 +782,13 @@ function clearComputation() {
770782 renderResultsPanel ( ) ;
771783}
772784
785+ function setWalkingRadius ( value ) {
786+ const sigma = Math . max ( 50 , Math . min ( 1000 , Math . round ( Number ( value ) / 50 ) * 50 ) ) ;
787+ state . config . sigma = sigma ;
788+ els . paramSigma . value = String ( sigma ) ;
789+ els . paramSigmaValue . textContent = `${ sigma } m` ;
790+ }
791+
773792// Preset loader for Game Phase
774793function applyPhasePreset ( phaseId ) {
775794 state . config . gamePhase = phaseId ;
@@ -787,7 +806,7 @@ function applyPhasePreset(phaseId) {
787806 }
788807 }
789808
790- // Apply preset spawn behavior dynamically; walking radius stays fixed at 700m .
809+ // Apply preset spawn behavior and walking radius dynamically .
791810 const rawPreset = PRESETS_RAW . find ( ( p ) => p . id === phaseId ) ;
792811 if ( rawPreset ) {
793812 state . config . ignoreSpawns = rawPreset . ignore_spawns ;
@@ -797,7 +816,7 @@ function applyPhasePreset(phaseId) {
797816 state . config . ignoreSpawns = false ;
798817 els . paramIgnoreSpawns . value = "false" ;
799818 }
800- state . config . sigma = 700 ;
819+ setWalkingRadius ( PRESET_SIGMAS [ phaseId ] ?? rawPreset ?. sigma ?? 200 ) ;
801820
802821 // Redraw weight sliders UI
803822 renderWeightSliders ( ) ;
@@ -854,6 +873,13 @@ function setupEvents() {
854873 clearComputation ( ) ;
855874 } ) ;
856875
876+ const onSigmaInput = ( e ) => {
877+ setWalkingRadius ( e . target . value ) ;
878+ clearComputation ( ) ;
879+ } ;
880+ els . paramSigma . addEventListener ( "input" , onSigmaInput ) ;
881+ els . paramSigma . addEventListener ( "change" , onSigmaInput ) ;
882+
857883 els . paramIgnoreSpawns . addEventListener ( "change" , ( e ) => {
858884 state . config . ignoreSpawns = e . target . value === "true" ;
859885 clearComputation ( ) ;
0 commit comments