spoint 0.1.688 → 0.1.690

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,14 +18,17 @@ const TERRAIN = {
18
18
  // they stay a single source of truth. Singleplayer (WorkerEntry.js's in-Worker boot of this same world
19
19
  // def) also reads serverAuthoritative, but with no other client to sync to it's a no-op there in
20
20
  // practice -- the local clock behaves identically to before this feature.
21
- // AAA-push cross-piece regression (found live, round 5 of the open-landscape piece): startFraction
21
+ // AAA-push cross-piece regression (found live, round 5-7 of the open-landscape piece): startFraction
22
22
  // was bumped 0.3->0.27 by the low-sun/golden-hour piece's own round 3 so the world would boot AT
23
23
  // that piece's target lighting for easy iteration -- but this is the WORLD'S shared default time,
24
24
  // so every OTHER piece (open-landscape-midday included) got tested against golden-hour lighting by
25
- // accident, not midday. Reverted to the original near-midday default; per-piece lighting states
26
- // belong in each piece's own test setup (e.g. a critic-driven time override), never in the shared
27
- // world config that every piece's test inherits.
28
- timeOfDay: { serverAuthoritative: true, dayLengthSec: 600, startFraction: 0.3 },
25
+ // accident. Reverting to 0.3 wasn't actually a fix either: client/core/TimeOfDay.js's own
26
+ // _elevationDeg(frac)=sin((frac-0.25)*2pi)*(90-tilt) peaks at frac=0.5 (true solar noon) -- 0.3 is
27
+ // only ~18deg elevation (its own comment even says "0.3 ~ mid-morning", never claimed to be
28
+ // midday). Using 0.5 for genuine midday/high-sun testing; per-piece lighting states still belong
29
+ // in each piece's own test setup for pieces that need a DIFFERENT angle (e.g. low-sun), never in
30
+ // this shared world config that every piece's test otherwise inherits.
31
+ timeOfDay: { serverAuthoritative: true, dayLengthSec: 600, startFraction: 0.5 },
29
32
  // weather-server-driven-state-and-multiplayer-sync: same real-multiplayer-test-world rationale as
30
33
  // timeOfDay.serverAuthoritative immediately above -- every connected client's weather state
31
34
  // (client/core/Weather.js) stays a server-pushed value (src/sdk/ServerWeather.js, MSG.WEATHER_SYNC)
@@ -111,7 +111,21 @@ export function createTimeOfDay(sun, ambient, opts = {}) {
111
111
  }
112
112
  const elevDeg = _elevationDeg(t)
113
113
  const kf = _lerpKeyframes(elevDeg)
114
- if (sun) { sun.color.setHex(kf.sunColor); sun.intensity = kf.sunIntensity }
114
+ // BUG FOUND LIVE (AAA-push, startFraction changes had zero visible effect on the rendered sky/
115
+ // sun despite window.__timeOfDay.elevationDeg correctly reporting the new angle): this function
116
+ // updated sun.color/sun.intensity from the day-cycle every frame but never sun.position -- the
117
+ // DirectionalLight's direction stayed frozen at whatever the static world-config set once at
118
+ // boot, forever, regardless of the day cycle. onDirectionChange(dir) only fed the shadow-camera
119
+ // offset and the terrain sky-shader's local sun dir, neither of which is the visible THREE.js
120
+ // sun light object itself. A DirectionalLight's direction is FROM position TOWARD target (both
121
+ // default at the origin unless target is parented into the scene), so position the light along
122
+ // `dir` at a fixed distance to preserve the same effective direction the rest of the pipeline
123
+ // already computes from `dir`.
124
+ if (sun) {
125
+ sun.color.setHex(kf.sunColor); sun.intensity = kf.sunIntensity
126
+ const SUN_DIST = 200
127
+ sun.position.set(dir[0] * SUN_DIST, dir[1] * SUN_DIST, dir[2] * SUN_DIST)
128
+ }
115
129
  if (ambient) { ambient.color.setHex(kf.ambientColor); ambient.intensity = kf.ambientIntensity }
116
130
  if (typeof window !== 'undefined') {
117
131
  window.__timeOfDay = window.__timeOfDay || {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoint",
3
- "version": "0.1.688",
3
+ "version": "0.1.690",
4
4
  "description": "Physics and netcode SDK for multiplayer game servers",
5
5
  "type": "module",
6
6
  "workspaces": [