Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions extensions/renderers/unity/scripts/paint_combat_v1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@
} catch {}
if(!string.IsNullOrEmpty(_locPlate)) PLATE=_locPlate;
else { var _abs="/home/unity/worldos-unity/Assets/painterly/backdrops/_active_combat.txt"; if(System.IO.File.Exists(_abs)){ var _n=System.IO.File.ReadAllText(_abs).Trim(); if(_n.Length>0) PLATE=_n; } }
// #1291: day-state plate selection. A sentinel (_time_of_day.txt, written by the deploy/driver step —
// NOT the engine directly; today's engine time_of_day is not yet surfaced on /combat-surface) says
// "day"/"night". When it says day AND a naming-convention sibling "<room>_day_v1.png" exists (room =
// the resolved PLATE's prefix up to its first underscore, e.g. tavern_layered_v1.png -> tavern), prefer
// it. ADDITIVE + default-off: no sentinel file, sentinel != "day", or missing day plate all fall through
// to today's PLATE unchanged (night/current behavior stays the default).
try {
var _todF="/home/unity/worldos-unity/Assets/painterly/backdrops/_time_of_day.txt";
if(System.IO.File.Exists(_todF)){
var _tod=System.IO.File.ReadAllText(_todF).Trim().ToLowerInvariant();
if(_tod=="day"){
var _us=PLATE.IndexOf('_');
var _room=_us>0?PLATE.Substring(0,_us):PLATE.Replace(".png","");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Room-prefix extraction drops plate version; day lookup is pinned to v1 regardless of night version

_room is PLATE.Substring(0,_us) — for crypt_firelit_v2.png this yields crypt (correct), but the version segment (firelit_v2) is discarded and the day name is rebuilt as crypt_day_v1.png with a hardcoded _v1. As night plates advance to v2/v3, their day counterparts stay pinned to v1 by this code, so a freshly regenerated day plate at a higher version would be ignored. At minimum, if the _day_v1.png convention is intentional, add a comment stating the version is intentionally fixed; otherwise derive the day name from the full non-extension stem or a registry field.

Category: Runtime correctness

var _dayName=_room+"_day_v1.png";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Day-plate name hardcodes _v1, diverges from curated _v2 default plate

The day variant is derived as <room>_day_v1.png regardless of the source plate's revision. The default PLATE is crypt_firelit_v2.png (v2), so a day switch to crypt_day_v1.png would load a different art revision than the curated v2 plate. This is gated by an explicit deploy-written sentinel file and an existence check, so it only fires when a v1 day plate is intentionally present — but the suffix is not derived from (or validated against) the resolved PLATE's revision. If an operator ships only _day_v2.png, the day state silently falls through to the night plate. Consider deriving the revision from the source PLATE (e.g. capture the trailing _vN) or documenting the _v1 convention where the sentinel is written.

Category: Unity scene/prefab

Why this matters: A room whose curated plate is v2 but whose only available day art is v2 would get no day plate at all (silent fallback to night), or a v1 day plate of inconsistent quality — both are silent operator surprises rather than errors. Low blast radius since it's additive and default-off.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Day-plate filename convention is hardcoded and unverified vs the generator/deploy step

The renderer hardcodes the day sibling as <room>_day_v1.png. The room prefix is derived from the resolved PLATE (everything before the first underscore), so the active night default crypt_firelit_v2.png -> crypt -> looks for crypt_day_v1.png. But (a) the generator half (generate_room.py --day) and the deploy/driver that actually writes plates into Assets/painterly/backdrops/ are NOT in this diff and no tracked file enforces the _day_v1.png naming; (b) the _v1 suffix is hardcoded while the night plate is already on _v2, so a v2+ day plate (or any non-_day_v1.png name like tavern_layered_day_v1.png) silently never matches and the feature is an invisible no-op. If the deploy step names day plates differently, day-state selection fails safe to night with zero diagnostic. Either resolve the day plate via the SAME plate map the night plate uses (_location_plates.json, extended with a day variant), or assert/document the exact deploy-time filename contract and emit a one-line sb.AppendLine when sentinel==day but no day sibling is found so a misnamed plate is diagnosable instead of silent.

Category: Unity scene/prefab

Why this matters: A day/night render feature that silently never activates because of an unverified filename coupling is a classic release-regression/proof-gap: it looks wired but produces no visible day evidence, and the absence of evidence is indistinguishable from 'sentinel not set'.

var _dayPath="Assets/painterly/backdrops/"+_dayName;
if(System.IO.File.Exists("/home/unity/worldos-unity/"+_dayPath)) PLATE=_dayName;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: No editor/fixture smoke evidence for day-state render behavior in this diff

This PR adds runtime render behavior (conditional day-plate selection that changes the painted backdrop) but the diff carries no focused Unity editor smoke, fixture, or a captured day-vs-night plate pair proving the sentinel path resolves and renders the day sibling. Repo proof expectations call for editor/play-mode/fixture evidence when runtime behavior changes. No tracked test exercises this branch (qa/* time_of_day references are engine state, not this renderer sentinel). Add at minimum a one-off editor capture log showing sentinel=day + present *_day_v1.png -> PLATE reassigned and rendered, and sentinel absent/night -> unchanged, so the additive/default-off contract is evidenced rather than asserted.

Category: Unity scene/prefab

}
}
} catch {}
string PLATE_PATH="Assets/painterly/backdrops/"+PLATE;
// New backdrop plates default to NPOT=ToNearest, which square-distorts a 1344x768 plate and breaks the
// camera-pin aspect. Force NPOT=None so the plate keeps native dims (idempotent — only reimports if needed).
Expand Down
Loading