param([int]$Frames=4800,[int]$Rounds=20,[string[]]$Roots=@('D:\GameCrafter_v9\raw','E:\GameCrafter_v9\raw','F:\GameCrafter_v9\raw','H:\GameCrafter_v9\raw'), [datetime]$NoStartAfter=[datetime]'2026-10-20 12:00',[int]$MinFreeGB=30,[string[]]$Only=@(),[string]$TagPrefix='P9',[int]$SeedOffset=0,[string]$ExtraEngine='') # v9 production queue: diversity first. Per run (seeded): random base appearance, layout remix strength, cross-scene donors / # strength / style donor, mirror X / Y, theme-aware dressing on / off; inside the run every camera variant gets a new random # look (post-process style, material randomisation, render tier, mip bias, colour grade, outline). Capsule character labels, # closer framed camera. After each run the cond.png images are written in the background. Stops at jobs\STOP_V9. $ErrorActionPreference='Continue' $cw='G:\GameCrafter\capture_work'; $rc=Join-Path $cw 'v6\run_capture_v6.ps1'; $py='E:\Anaconda3\python.exe' $runlog="$cw\v9\out\run_all_v9.txt" function Log([string]$m){ $line="$(Get-Date -Format o) $m"; Add-Content -Path $runlog -Value $line; Write-Output $line } function PickRoot(){ foreach($r in $Roots){ $q=$r.Substring(0,1); $f=(Get-PSDrive -Name $q).Free/1GB; if($f -ge $MinFreeGB){ New-Item -ItemType Directory -Force -Path $r | Out-Null; return $r } }; return $null } $scenes=@(Get-ChildItem $cw -Directory | Where-Object { $_.Name -match '^\d\d_' } | Sort-Object Name | ForEach-Object { $_.Name }) if($Only.Count){ $scenes=@($scenes | Where-Object { $Only -contains $_.Substring(0,2) }) } $apps=@('default','default','default','golden','overcast','snow','autumn','palette') $sig='[DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint esFlags);' $power=Add-Type -MemberDefinition $sig -Name 'PowerV9' -Namespace 'GameCrafterV9' -PassThru Log "run_all_v9 start scenes=$($scenes.Count) rounds=$Rounds frames=$Frames until $NoStartAfter prefix=$TagPrefix seedoffset=$SeedOffset extra=$ExtraEngine" for($r=1;$r -le $Rounds;$r++){ foreach($s in $scenes){ [void]$power::SetThreadExecutionState([uint32]2147483649) if(Test-Path (Join-Path $cw 'jobs\STOP_V9')){ Log 'stop flag found'; exit 0 } if((Get-Date) -gt $NoStartAfter){ Log "past $NoStartAfter, not starting more runs"; exit 0 } $root=PickRoot; if(-not $root){ Log 'no drive with enough free space, stopping'; exit 0 } $i=[int]$s.Substring(0,2); $seed=$i*1000+900+$r+$SeedOffset $rng=New-Object System.Random $seed $app=$apps[$rng.Next($apps.Count)] $others=@(1..10 | Where-Object { $_ -ne $i } | ForEach-Object { '{0:D2}' -f $_ } | Sort-Object { $rng.Next() }) $nd=2+$rng.Next(3); $donors=($others[0..($nd-1)] -join '+') $remix=[math]::Round(0.4+0.8*$rng.NextDouble(),2); $strength=[math]::Round(0.6+1.4*$rng.NextDouble(),2) $style=''; $amount=0.0; if($rng.NextDouble() -lt 0.4){ $style=$others[$nd]; $amount=[math]::Round(0.5+0.5*$rng.NextDouble(),2) } $mx=$rng.NextDouble() -lt 0.5; $my=$rng.NextDouble() -lt 0.5; $notheme=$rng.NextDouble() -lt 0.5 $eng='DatasetArtPass,DatasetV8,DatasetV8Share=1.0,DatasetV9'; if($notheme){ $eng+=',DatasetV8NoTheme' }; if($ExtraEngine){ $eng+=','+$ExtraEngine } $tag="${TagPrefix}_${app}_s$seed" $done=$false; foreach($rr in $Roots){ $res=Join-Path $rr "${s}_$tag\capture_result.json"; if(Test-Path $res){ try{ if([bool](Get-Content $res -Raw | ConvertFrom-Json).ok){ $done=$true } }catch{} } } if($done){ Log "skip $s $tag"; continue } $dir=Join-Path $root "${s}_$tag" if(Test-Path $dir){ Rename-Item $dir "${s}_${tag}_failed_$(Get-Date -Format yyyyMMddHHmmss)" } $a=@('-NoProfile','-ExecutionPolicy','Bypass','-File',$rc,'-Scene',$s,'-Frames',"$Frames",'-Tag',$tag,'-Seed',"$seed",'-LayoutSeed',"$($seed*7+3)", '-Appearance',$app,'-AppearanceSeed',"$($seed*3+1)",'-OutRoot',$root,'-Remix','-RemixStrength',"$remix",'-Cross','-Donors',$donors,'-CrossStrength',"$strength",'-EngineArgs',$eng) if($style){ $a+=@('-StyleDonor',$style,'-StyleAmount',"$amount") } if($mx){ $a+='-Mirror' }; if($my){ $a+='-MirrorY' } Log "capture $s $tag root=$root donors=$donors style=$style/$amount strength=$strength remix=$remix mx=$mx my=$my notheme=$notheme" $t0=Get-Date; & powershell.exe @a | Out-Null $okRun=$false; $extra=''; $res=Join-Path $dir 'capture_result.json' if(Test-Path $res){ try{ $j=Get-Content $res -Raw | ConvertFrom-Json; $okRun=[bool]$j.ok; $extra="looks=$($j.v9.looks) tex=$($j.v9.texture_pool) styles=$($j.v9.style_histogram | ConvertTo-Json -Compress)" }catch{} } Log "capture $s $tag exit $LASTEXITCODE ok=$okRun secs=$([int]((Get-Date)-$t0).TotalSeconds) $extra" if($okRun){ Start-Process -FilePath $py -ArgumentList @("$cw\v9\post\cond_v9.py",$dir) -WindowStyle Hidden -RedirectStandardOutput "$dir\cond_stdout.txt" -RedirectStandardError "$dir\cond_stderr.txt" | Out-Null } } } Log 'run_all_v9 done'