This commit is contained in:
33333-33333 2026-09-16 20:53:17 +09:00
commit 8f80997b0d
256 changed files with 4044 additions and 966 deletions

View file

@ -1,10 +1,12 @@
const elementIds = [
"world", "toggleRun", "stepOnce", "resetWorld",
"speed", "agentCount", "worldSize", "viewMode", "year", "activeGroups", "urbanPopulation",
"world", "toggleRun", "resetWorld",
"speed", "worldSize", "viewMode", "year", "activeGroups", "urbanPopulation",
"ethnicities", "cities", "polities", "wars", "routes", "farmingKnowledge", "metallurgyKnowledge",
"deaths", "frameCost", "ethnicityList", "legend", "tooltip", "stateGraph", "historyRange",
"historyFilter", "historySort", "historyMetric", "toggleActiveStates", "togglePastStates",
"stateGraphInfo", "stateGraphTooltip"
"deaths", "frameCost", "ethnicityList", "fpsCounter", "legend", "tooltip", "worldTrendGraph", "stateGraph", "historyRange",
"currentDate", "historyFilter", "historySort", "historyMetric", "toggleActiveStates", "togglePastStates", "toggleEventIcons",
"stateGraphInfo", "stateGraphTooltip", "eventLegend",
"regenerateDialog", "confirmRegenerate", "cancelRegenerate",
"triggerDisaster", "buildCity", "connectCities", "interventionStatus"
];
const els = Object.fromEntries(elementIds.map(id => [id === "world" ? "canvas" : id, document.getElementById(id)]));
els.sim = document.querySelector(".sim");
@ -18,13 +20,15 @@ let lastSimTickAt = 0;
let renderDirty = true;
let loopTimer = null;
let loopScheduled = false;
let fpsWindowStartedAt = 0;
let fpsFrames = 0;
let hoverState = null;
let renderImage = null;
let renderImageSize = 0;
const LoopConfig = Object.freeze({
simTickMs: 33,
renderMs: 66,
stepBudgetMs: 4.5,
stepBudgetMs: 8,
idlePollMs: 180,
hiddenPollMs: 1000
});
@ -34,6 +38,7 @@ sort: "oldest",
metric: "power",
showActive: true,
showPast: true,
showEventIcons: true,
hoverPolityId: null,
rows: [],
markers: [],
@ -41,11 +46,11 @@ scale: null
};
const legendByMode = {
terrain: () => terrainInfo.map(t => `<span><i style="background: rgb(${t.color.join(",")})"></i>${t.name}</span>`).join(""),
ethnicity: () => "<span>Ethnicity</span>",
pressure: () => "<span>Pressure</span>",
polities: () => "<span>States</span>",
nomads: () => "<span>Nomads</span>",
technology: () => "<span>Technology</span>",
pheromone: () => "<span>Routes</span>",
resources: () => "<span>Resources</span>"
ethnicity: () => "<span>民族の色・濃さは人口と優勢度</span>",
pressure: () => "<span>赤いほど人口圧力が高い</span>",
polities: () => "",
nomads: () => "<span>遊牧集団</span>",
technology: () => "<span>緑:農業 / 黄土色:冶金</span>",
pheromone: () => "<span>明るい黄色ほど交通量が多い</span>",
resources: () => "<span>明るい緑ほど資源が豊富</span>"
};