sky(phase-3c.1): feed AbsoluteYear (Year+ZeroYear) to retail LCG picker
Live verification (2026-04-23, Phase 3c launch): acdream picked DayGroup[17] "Rainy" for PY106 day46 while retail at the same server tick showed clear blue sky with white clouds (Sunny-ish). Root cause: our port passed the RELATIVE year (106, i.e. years since tick-0) into the LCG seed, while retail's TimeOfDay+0x64 is ABSOLUTE Year = floor(...) + ZeroYear (baseYear=10 for Dereth GameTime). The offset seeds the LCG with `seed = 106×7620+46` vs retail's `seed = 116×7620+46` — `10 × SecondsPerDay = 76200` apart, guaranteed to land on a different DayGroup index. Fix: - DerethDateTime.ZeroYear constant (= 10) + AbsoluteYear(ticks) helper. - GameWindow.RefreshSkyForCurrentDay feeds AbsoluteYear into the picker. - LoadedSkyDesc.ActiveDayGroup(ticks) same. - Calendar display and generic Year(ticks) stay relative; only the LCG-seed path uses the offset. Matches retail FUN_005a7510:5300 which explicitly adds baseYear to the relative year before stashing in TimeOfDay+0x64. Build + 717 tests green. Next visual check should show matching weather with retail client side-by-side. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6ea87b7ea8
commit
f466c337ce
3 changed files with 43 additions and 20 deletions
|
|
@ -4316,21 +4316,26 @@ public sealed class GameWindow : IDisposable
|
|||
if (_loadedSkyDesc is null || _loadedSkyDesc.DayGroups.Count == 0)
|
||||
return;
|
||||
|
||||
// Retail FUN_00501990 uses the full (Year, SecondsPerDay, DayOfYear)
|
||||
// triple — NOT a flat dayIndex. The SecondsPerDay multiplier is
|
||||
// load-bearing: without it, adjacent years map to adjacent LCG
|
||||
// seeds and convergence to acdream != retail would recur every
|
||||
// year. We use the retail calendar constants from DerethDateTime.
|
||||
// Retail FUN_00501990 seeds the LCG with
|
||||
// (Year_absolute, SecondsPerDay, DayOfYear)
|
||||
// where Year_absolute = TimeOfDay+0x64 = floor(...) + baseYear
|
||||
// (baseYear=10 for Dereth per GameTime.ZeroYear). Our port uses
|
||||
// AbsoluteYear which includes the +10 offset; without it, our
|
||||
// seed would differ from retail's by `10 × SecondsPerDay` and we'd
|
||||
// pick a different DayGroup (verified mismatch in the 2026-04-23
|
||||
// live session — acdream picked "Rainy"[17] while retail showed
|
||||
// "Sunny" at PY 116 ColdMeet 17).
|
||||
double ticks = WorldTime.NowTicks;
|
||||
int year = AcDream.Core.World.DerethDateTime.Year(ticks);
|
||||
int absYear = AcDream.Core.World.DerethDateTime.AbsoluteYear(ticks);
|
||||
int dayOfYear = AcDream.Core.World.DerethDateTime.DayOfYear(ticks);
|
||||
int secondsPerDay = (int)AcDream.Core.World.DerethDateTime.DayTicks; // 7620
|
||||
|
||||
// Compute a composite "dayIndex" for our own change-detection
|
||||
// and logging (doesn't feed into the roll itself).
|
||||
long dayIndex = (long)year * 360 + dayOfYear;
|
||||
// Composite day key for change-detection and logging only; the
|
||||
// LCG seed is computed inside SelectDayGroupIndex from (absYear,
|
||||
// secondsPerDay, dayOfYear).
|
||||
long dayIndex = (long)absYear * 360 + dayOfYear;
|
||||
|
||||
int idx = _loadedSkyDesc.SelectDayGroupIndex(year, secondsPerDay, dayOfYear);
|
||||
int idx = _loadedSkyDesc.SelectDayGroupIndex(absYear, secondsPerDay, dayOfYear);
|
||||
var grp = idx >= 0 && idx < _loadedSkyDesc.DayGroups.Count
|
||||
? _loadedSkyDesc.DayGroups[idx]
|
||||
: null;
|
||||
|
|
@ -4350,7 +4355,7 @@ public sealed class GameWindow : IDisposable
|
|||
grp.SkyTimes.Select(s => s.Keyframe).ToList()));
|
||||
|
||||
Console.WriteLine(
|
||||
$"sky: PY{year} day{dayOfYear} → DayGroup[{idx}] \"{grp.Name}\" " +
|
||||
$"sky: PY{absYear} day{dayOfYear} → DayGroup[{idx}] \"{grp.Name}\" " +
|
||||
$"(Chance={grp.ChanceOfOccur:F2}, {grp.SkyObjects.Count} objects, " +
|
||||
$"{grp.SkyTimes.Count} keyframes)");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue