separation of script.js

This commit is contained in:
33333-33333 2026-05-14 20:15:23 +09:00
commit 5d09ad30d7
7 changed files with 1314 additions and 1307 deletions

110
config.js Normal file
View file

@ -0,0 +1,110 @@
const Terrain = Object.freeze({
PLAINS: 0,
FOREST: 1,
MOUNTAIN: 2,
WATER: 3,
DESERT: 4
});
const terrainInfo = [
{ name: "Plains", color: [82, 102, 74], move: 1.0, fertility: 0.55, mineral: 0.05, regen: 0.025 },
{ name: "Forest", color: [58, 91, 68], move: 1.3, fertility: 0.62, mineral: 0.08, regen: 0.038 },
{ name: "Mountains", color: [104, 105, 101], move: 2.6, fertility: 0.18, mineral: 0.78, regen: 0.012 },
{ name: "Water", color: [52, 78, 103], move: 7.0, fertility: 0.04, mineral: 0.02, regen: 0.004 },
{ name: "Desert", color: [139, 123, 86], move: 1.55, fertility: 0.16, mineral: 0.16, regen: 0.014 }
];
const WEEKS_PER_MONTH = 4;
const MONTHS_PER_YEAR = 12;
const WEEKS_PER_YEAR = MONTHS_PER_YEAR * WEEKS_PER_MONTH;
const SimConfig = Object.freeze({
population: Object.freeze({
maxAgentsFloor: 8000,
maxAgentsScale: 1.15,
softCapStart: 0.85,
hardCapScale: 1.35,
offspringCrowdingPenalty: 1.8,
minOffspringAcceptance: 0.035,
maxOffspringPerStep: 360,
carryingCapacityBase: 2.4,
carryingCapacityFertility: 7.8,
carryingCapacityMineral: 1.8,
carryingCapacityFarmland: 5.5,
pressurePenaltyBase: 0.2,
pressureReproductionPenalty: 0.16
}),
city: Object.freeze({
maxCities: 300
}),
render: Object.freeze({
graphThrottleMs: 1400,
statsThrottleMs: 900,
historyWindowYears: 2000,
historySamplePaddingYears: 240
}),
technology: Object.freeze({
cityDiffusion: 0.0022,
tradeDiffusion: 0.0032,
cityInnovation: 0.00045
}),
polity: Object.freeze({
minimumPerCapitaFood: 0.06,
logisticsDistance: 34
}),
polityAccess: Object.freeze({
enabled: true,
maxSearchDepth: 8,
indirectPenalty: 0.012,
perHopPenalty: 0.006,
noAccessPenalty: 0.045,
lowLoyaltyTransitPenalty: 0.012,
foreignTransitPenalty: 0.008
}),
culture: Object.freeze({
spreadRadius: 3,
cityWeight: 0.035,
routeWeight: 1.35,
minimumInfluence: 0.18
}),
route: Object.freeze({
maxRouteLength: 42,
pheromoneDecay: 0.996,
pheromoneDiffusion: 0.045,
maxPheromone: 18,
routePheromoneBuild: 0.18,
routePheromoneMaintain: 0.12,
routeUpkeepPerTile: 0.018,
routeWeakThreshold: 8,
routeUnsupportedDecay: 7,
routeMaintainedBoost: 10
}),
disaster: Object.freeze({
damageScale: 1.5,
majorLossRate: 0.05,
checkIntervalYears: 8,
baseChance: 0.76,
minRadius: 6,
maxRadius: 34,
rareLargeChance: 0.10,
largeRadiusMin: 28,
largeRadiusMax: 54,
minIntensity: 0.25,
maxIntensity: 0.95,
visualDurationYears: 18,
maxActiveVisuals: 12,
maxHistory: 160
}),
frontierWave: Object.freeze({
enabledAfterYears: 300,
intervalYears: 80,
chance: 0.45,
minAgents: 60,
maxAgents: 140,
maxPopulationRatio: 1.28,
edgeBand: 4,
mutation: 0.08,
minResources: 12,
maxResources: 28
})
});
function years(value) {
return value * WEEKS_PER_YEAR;
}