Game time, timezones, and twilight rules
Use this when modifying game time behavior, timezone math, or twilight behavior in proofofcombat-server/constants/helpers.ts.
Key Constants
Orientation
TWILIGHT_RADIUS fraction; twilight has offset 0.Implementation Rules
time = ((timestamp % DAY_NIGHT_CYCLE) / DAY_NIGHT_CYCLE) * DAY_NIGHT_LENGTH.gameTime = time + offset * TIMEZONE_OFFSET.adjustedTime = gameTime % DAY_NIGHT_LENGTH.daytime = adjustedTime / DAY_NIGHT_LENGTH (must be 0..1).{ name: "Twilight", offset: 0 }.TIMEZONE_COUNT.TIMEZONE_COUNT.Testing Guidance
timestamp = 0, time should equal offset * 1h and daytime = offset/24.time + offset > 24h; assert daytime equals the wrapped fraction (0..1).proofofcombat-server/constants/helpers.test.ts.Gotchas
adjustedTime, not gameTime, to avoid values > 1.toBeCloseTo for fractional assertions due to float rounding.TWILIGHT_RADIUS compares to percent-radius toward the edge; small changes affect many locations.After Changes
yarn --cwd proofofcombat-server test.yarn agent:runbook:sync to update .cursor/skills/.yarn agent:check to verify no drift and guardrails.