[game] Keep world time in retail milliseconds - #324
Merged
Conversation
Eldbury
force-pushed
the
fix/world-time-real-rate
branch
from
August 25, 2026 00:20
46e19df to
ee42f3f
Compare
modawan
reviewed
Aug 25, 2026
Mod_MinPerHour shortens the game day; it does not accelerate the clock. CWorldTimer accumulates elapsed time and derives the day boundary from m_nMillisecondsInDay = MinutesPerHour * 60 * 1000 * HOURS_IN_DAY, so one world-time millisecond is one millisecond of simulation. Reone instead kept a fixed 24-hour day and advanced the counter at 60 / Mod_MinPerHour times that rate. Durations measured against it were short by that factor: exactly 30.00x on the 113 K1 and 82 K2 modules that ship Mod_MinPerHour = 2, so a scripted 30 second ActionForceMoveToObject timeout expired in one second and teleported ambient NPCs between waypoints instead of letting them walk. Make absolute world milliseconds the canonical runtime clock. Calendar day and time of day remain first-class, but derived: they are composed from the retail pair when loading and split back out when saving, and nothing rebuilds a calendar per frame. Forced-move deadlines and restored event-queue due times become absolute timestamps at those boundaries too; the queue previously compared day and time of day lexicographically, which fires an unnormalized record a whole day early. Retail day lengths genuinely differ between modules - K1 ships danm14aa at Mod_MinPerHour = 1 and danm14ab through danm14ad at 0 - so a stored day/time pair is only meaningful alongside the day length that produced it. An absolute clock cannot be displaced by rescaling the calendar. Saved records stay in retail shape and no migration is needed. A time of day larger than the current day length is unnormalized rather than invalid: it carries into later days on load, as CWorldTimer::GetWorldTime treats it, and is normalized again on the next save.
Eldbury
force-pushed
the
fix/world-time-real-rate
branch
from
August 25, 2026 10:15
ee42f3f to
c703d5b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix world time issue resulting in NPC apparent flickering/warping.
Mod_MinPerHournow controls day length instead of clock speedThis fixes the 30x-fast clock on normal
Mod_MinPerHour = 2modules, including Dantooine ambient NPCs timing out and teleporting between waypoints.Testing