Monorepo for Aesthetic.Computer
aesthetic.computer
1# Local Windows Build Script for false.work (SpiderLily)
2# Run from Windows host to build UE5 project locally (not on GCP)
3
4param(
5 [string]$Platform = "Win64",
6 [string]$Config = "Shipping",
7 [string]$Version = (Get-Date -Format "yyyy.MM.dd-HHmm"),
8 [ValidateSet("auto", "ultra", "high", "medium")]
9 [string]$Quality = "auto",
10 [switch]$AutoPackage
11)
12
13$ErrorActionPreference = "Stop"
14
15# Quality preset suffix for filename
16$QualitySuffix = if ($Quality -ne "auto") { "-$Quality" } else { "" }
17
18Write-Host "=========================================" -ForegroundColor Cyan
19Write-Host "false.work Local Windows Build" -ForegroundColor Cyan
20Write-Host "=========================================" -ForegroundColor Cyan
21Write-Host "Platform: $Platform"
22Write-Host "Config: $Config"
23Write-Host "Version: $Version"
24Write-Host "Quality: $Quality" -ForegroundColor $(if ($Quality -eq "ultra") { "Magenta" } elseif ($Quality -eq "high") { "Yellow" } else { "White" })
25Write-Host "AutoPackage: $AutoPackage"
26Write-Host ""
27
28# Configuration - Update these paths for your local setup
29$UE5Path = "C:\Program Files\Epic Games\UE_5.6"
30$ProjectRoot = "C:\Perforce\SpiderLily\SL_main" # Updated to include SL_main subdirectory
31$ProjectFile = "$ProjectRoot\SpiderLily.uproject"
32$OutputDir = "$env:USERPROFILE\Desktop\SpiderLily-$Version"
33
34# Check if UE5 exists
35if (!(Test-Path $UE5Path)) {
36 Write-Host "WARNING: UE5 not found at: $UE5Path" -ForegroundColor Yellow
37 Write-Host ""
38 Write-Host "Please update the `$UE5Path variable in this script to point to your UE5 installation."
39 Write-Host ""
40 Write-Host "Common locations:"
41 Write-Host " - C:\Program Files\Epic Games\UE_5.7"
42 Write-Host " - C:\Program Files\Epic Games\UE_5.6"
43 Write-Host " - C:\UE5"
44 Write-Host ""
45 exit 1
46}
47
48# Check if project exists
49if (!(Test-Path $ProjectFile)) {
50 Write-Host "WARNING: Project not found at: $ProjectFile" -ForegroundColor Yellow
51 Write-Host ""
52 Write-Host "Please update the `$ProjectRoot variable in this script to point to your SpiderLily project."
53 Write-Host ""
54 exit 1
55}
56
57Write-Host "[OK] Found UE5: $UE5Path" -ForegroundColor Green
58Write-Host "[OK] Found Project: $ProjectFile" -ForegroundColor Green
59Write-Host ""
60
61# Optional: Sync from Perforce if configured
62if (Get-Command p4 -ErrorAction SilentlyContinue) {
63 if ($AutoPackage) {
64 # Auto mode: sync without prompting
65 Write-Host "Auto: Syncing from Perforce..." -ForegroundColor Yellow
66 Set-Location $ProjectRoot
67 p4 sync
68 if ($LASTEXITCODE -ne 0) {
69 Write-Warning "Perforce sync failed, continuing with existing files..."
70 }
71 # Show recent changes
72 p4 changes -m 5 ...
73 Write-Host ""
74 } else {
75 # Interactive mode: prompt user
76 $response = Read-Host "Sync from Perforce? (y/N)"
77 if ($response -eq "y" -or $response -eq "Y") {
78 Write-Host "Syncing from Perforce..." -ForegroundColor Yellow
79 Set-Location $ProjectRoot
80 p4 sync
81 if ($LASTEXITCODE -ne 0) {
82 Write-Warning "Perforce sync failed, continuing with existing files..."
83 }
84 Write-Host ""
85 }
86 }
87}
88
89# Build
90Write-Host "Building $Platform package..." -ForegroundColor Yellow
91Write-Host " This may take 10-30 minutes depending on your hardware..." -ForegroundColor Gray
92Write-Host ""
93
94# Create temporary GameUserSettings.ini for quality preset if not "auto"
95$TempSettingsCreated = $false
96$GameUserSettingsPath = "$ProjectRoot\Config\DefaultGameUserSettings.ini"
97
98if ($Quality -ne "auto") {
99 Write-Host "Applying $Quality quality preset..." -ForegroundColor Cyan
100
101 # Quality level mapping: 0=Low, 1=Medium, 2=High, 3=Epic, 4=Cinematic
102 $QualityLevel = switch ($Quality) {
103 "medium" { 1 }
104 "high" { 3 } # Epic
105 "ultra" { 4 } # Cinematic
106 default { 3 }
107 }
108
109 $SettingsContent = @"
110[ScalabilityGroups]
111sg.ResolutionQuality=100
112sg.ViewDistanceQuality=$QualityLevel
113sg.AntiAliasingQuality=$QualityLevel
114sg.ShadowQuality=$QualityLevel
115sg.GlobalIlluminationQuality=$QualityLevel
116sg.ReflectionQuality=$QualityLevel
117sg.PostProcessQuality=$QualityLevel
118sg.TextureQuality=$QualityLevel
119sg.EffectsQuality=$QualityLevel
120sg.FoliageQuality=$QualityLevel
121sg.ShadingQuality=$QualityLevel
122
123[/Script/Engine.GameUserSettings]
124bUseDesiredScreenHeight=False
125DesiredScreenWidth=1920
126DesiredScreenHeight=1080
127LastUserConfirmedDesiredScreenWidth=1920
128LastUserConfirmedDesiredScreenHeight=1080
129LastRecommendedScreenWidth=-1
130LastRecommendedScreenHeight=-1
131LastCPUBenchmarkResult=-1
132LastGPUBenchmarkResult=-1
133LastCPUBenchmarkSteps=0
134LastGPUBenchmarkSteps=0
135LastGPUBenchmarkMultiplier=1
136bUseDynamicResolution=False
137bUseHDRDisplayOutput=True
138HDRDisplayOutputNits=1000
139"@
140
141 # Backup existing if present
142 if (Test-Path $GameUserSettingsPath) {
143 Copy-Item $GameUserSettingsPath "$GameUserSettingsPath.backup" -Force
144 }
145
146 Set-Content -Path $GameUserSettingsPath -Value $SettingsContent -Encoding UTF8
147 $TempSettingsCreated = $true
148 Write-Host "Created quality preset config: $GameUserSettingsPath" -ForegroundColor Green
149}
150
151# Run FMOD GenerateAssets commandlet before cooking
152# This generates FMOD bank assets that normally get created when opening the editor
153# Required for command-line builds: https://fmod.com/docs/2.03/unreal/user-guide.html#commandlet
154$UnrealEditor = "$UE5Path\Engine\Binaries\Win64\UnrealEditor-Cmd.exe"
155Write-Host ""
156Write-Host "Running FMOD GenerateAssets commandlet..." -ForegroundColor Yellow
157& $UnrealEditor $ProjectFile -run=FMODGenerateAssets
158if ($LASTEXITCODE -ne 0) {
159 Write-Warning "FMOD GenerateAssets commandlet returned non-zero exit code, continuing anyway..."
160}
161
162$RunUAT = "$UE5Path\Engine\Build\BatchFiles\RunUAT.bat"
163
164& $RunUAT BuildCookRun `
165 "-project=$ProjectFile" `
166 "-platform=$Platform" `
167 "-clientconfig=$Config" `
168 -cook `
169 -build `
170 -stage `
171 -pak `
172 -archive `
173 "-archivedirectory=$OutputDir" `
174 -noP4 `
175 -utf8output `
176 -NoLiveCoding `
177 -nocompileeditor `
178 -iterate `
179 -IgnoreCookErrors
180
181if ($LASTEXITCODE -ne 0) {
182 # Cleanup temp settings on failure
183 if ($TempSettingsCreated -and (Test-Path "$GameUserSettingsPath.backup")) {
184 Move-Item "$GameUserSettingsPath.backup" $GameUserSettingsPath -Force
185 } elseif ($TempSettingsCreated) {
186 Remove-Item $GameUserSettingsPath -Force -ErrorAction SilentlyContinue
187 }
188 Write-Host ""
189 Write-Host "[ERROR] Build failed!" -ForegroundColor Red
190 exit 1
191}
192
193# Cleanup temp settings after successful build
194if ($TempSettingsCreated) {
195 if (Test-Path "$GameUserSettingsPath.backup") {
196 Move-Item "$GameUserSettingsPath.backup" $GameUserSettingsPath -Force
197 } else {
198 Remove-Item $GameUserSettingsPath -Force -ErrorAction SilentlyContinue
199 }
200 Write-Host "Cleaned up temporary quality preset config" -ForegroundColor Gray
201}
202
203Write-Host ""
204Write-Host "[SUCCESS] Build complete!" -ForegroundColor Green
205Write-Host ""
206Write-Host "Output location:" -ForegroundColor Cyan
207Write-Host " $OutputDir"
208Write-Host ""
209
210# Optionally or automatically compress
211if ($AutoPackage) {
212 Write-Host ""
213 Write-Host "Auto: Compressing build to ZIP..." -ForegroundColor Yellow
214 $ArchiveName = "spiderlily-windows-$Version$QualitySuffix.zip"
215 $ArchivePath = "$env:USERPROFILE\Desktop\$ArchiveName"
216
217 if (Test-Path "C:\Program Files\7-Zip\7z.exe") {
218 & "C:\Program Files\7-Zip\7z.exe" a -tzip "$ArchivePath" "$OutputDir\Windows\*" | Out-Default
219 } else {
220 Compress-Archive -Path "$OutputDir\Windows\*" -DestinationPath "$ArchivePath" -CompressionLevel Optimal -Force
221 }
222
223 if (Test-Path $ArchivePath) {
224 $ArchiveSize = (Get-Item $ArchivePath).Length / 1MB
225 $SizeRounded = [math]::Round($ArchiveSize, 2)
226 Write-Host "Created: $ArchiveName ($SizeRounded MB)" -ForegroundColor Green
227 Write-Host " $ArchivePath"
228 } else {
229 Write-Host "Failed to create archive: $ArchivePath" -ForegroundColor Red
230 exit 1
231 }
232} else {
233 $response = Read-Host "Compress build to ZIP? (y/N)"
234 if ($response -eq "y" -or $response -eq "Y") {
235 Write-Host ""
236 Write-Host "Compressing..." -ForegroundColor Yellow
237
238 $ArchiveName = "SpiderLily-$Platform-$Version.zip"
239 $BuildsDir = "$ProjectRoot\Builds"
240
241 # Create Builds directory if it doesn't exist
242 if (!(Test-Path $BuildsDir)) {
243 New-Item -ItemType Directory -Path $BuildsDir -Force | Out-Null
244 }
245
246 $ArchivePath = "$BuildsDir\$ArchiveName"
247
248 if (Test-Path "C:\Program Files\7-Zip\7z.exe") {
249 & "C:\Program Files\7-Zip\7z.exe" a -tzip "$ArchivePath" "$OutputDir\*"
250 } else {
251 Compress-Archive -Path "$OutputDir\*" -DestinationPath "$ArchivePath" -CompressionLevel Optimal -Force
252 }
253
254 $ArchiveSize = (Get-Item $ArchivePath).Length / 1MB
255 $SizeRounded = [math]::Round($ArchiveSize, 2)
256 Write-Host "Created: $ArchiveName ($SizeRounded MB)" -ForegroundColor Green
257 Write-Host " $ArchivePath"
258 }
259}
260
261Write-Host ""
262Write-Host "Done!" -ForegroundColor Green
263Write-Host ""