1.5
This commit is contained in:
parent
c9dd7182aa
commit
acf93ec6df
22 changed files with 320 additions and 261 deletions
|
|
@ -55,6 +55,13 @@
|
|||
].join(":");
|
||||
}
|
||||
|
||||
function scheduleDelay(item, interval, initial = false) {
|
||||
const key = item?.id || item?._schedulerToken || item?.type || "item";
|
||||
const salt = initial ? "item-scheduler-initial" : `item-scheduler:${Math.floor((item?._schedulerLastAt || 0) * 3)}`;
|
||||
const unit = typeof stableUnit === "function" ? stableUnit(key, salt) : Math.random();
|
||||
const spread = initial ? (0.42 + unit * 1.18) : (0.88 + unit * 0.24);
|
||||
return interval * spread;
|
||||
}
|
||||
|
||||
function scheduleItem(state, item, now, interval = itemUpdateInterval(item)) {
|
||||
if (!item || item.dead || !Number.isFinite(interval)) return false;
|
||||
|
|
@ -64,8 +71,9 @@
|
|||
}
|
||||
const token = (item._schedulerToken || 0) + 1;
|
||||
item._schedulerToken = token;
|
||||
if (!Number.isFinite(item._schedulerLastAt)) item._schedulerLastAt = now;
|
||||
heapPush(state.heap, { time: now + interval, item, token });
|
||||
const initial = !Number.isFinite(item._schedulerLastAt);
|
||||
if (initial) item._schedulerLastAt = now;
|
||||
heapPush(state.heap, { time: now + scheduleDelay(item, interval, initial), item, token });
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -145,13 +153,9 @@
|
|||
}
|
||||
|
||||
function physicsBudgetFor(worldRef) {
|
||||
const tier = global.TarinaiPerf.simulationQualityTier?.() || "high";
|
||||
const itemCount = (worldRef?.items || []).length || 0;
|
||||
const activeHint = worldRef?._itemUpdateRealtime?.length || 0;
|
||||
const mobile = Boolean(global.TarinaiInputMode.snapshot().touchFirst || (global.innerWidth || 9999) <= 760);
|
||||
if (mobile && tier !== "high") return { maxPairs: 112, maxLinks: 72, postMaxPairs: 28, maxSubsteps: 2 };
|
||||
if (mobile) return { maxPairs: 150, maxLinks: 96, postMaxPairs: 40, maxSubsteps: 2 };
|
||||
if (tier === "low") return { maxPairs: 140, maxLinks: 90, postMaxPairs: 36, maxSubsteps: 2 };
|
||||
return itemCount > 80
|
||||
? { maxPairs: 240, maxLinks: 170, postMaxPairs: 78, maxSubsteps: 4 }
|
||||
: { maxPairs: 300, maxLinks: 210, postMaxPairs: 100, maxSubsteps: 5 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue