/** * One world seed per UTC-aligned period: floor(utcUnixSeconds / rotationSeconds). * Changing the slot triggers a full grid wipe on the server. */ export function computeWorldSeedState(rotationSeconds) { const rot = Math.max(60, Math.floor(rotationSeconds)); const nowSec = Math.floor(Date.now() / 1000); const slot = Math.floor(nowSec / rot); const periodStart = slot * rot; const periodEnd = periodStart + rot; return { worldSeed: `swg-${slot}`, seedSlot: slot, seedPeriodEndsAtUtc: new Date(periodEnd * 1000).toISOString(), seedPeriodStartsAtUtc: new Date(periodStart * 1000).toISOString(), }; }