Checking a Godot 4 web export: threads, file sizes, loading, and audio
When a working desktop game stalls in its web export, first separate file delivery, export requirements, and game startup. Rebuilding the engine before identifying which layer failed can add work without fixing the cause.
This case uses Last Pitch Derby’s committed files and settings at revision 4a7aec3. File sizes and loader code were checked on September 21, 2026; iPhone performance was not retested. Earlier abandonment-rate, instant-loading, and 35-to-8 MB claims lacked supporting measurements and have been removed.
Start with the export configuration
The site’s export_presets.cfg leaves custom_template/release empty and sets both variant/thread_support and variant/extensions_support to false. This is not evidence of a custom stripped template. Record the editor, export template, and feature flags before applying advice from a different export configuration.
custom_template/release=""
variant/extensions_support=false
variant/thread_support=falseGodot documents cross-origin isolation requirements for Thread Support and Extensions Support. When enabling either, verify the actual HTTP response and embedding environment rather than merely finding a _headers file. A single-threaded export still needs gameplay and audio checks.
The “Serving the files” section of the Godot 4.7 docs lists two headers: Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp. With Thread or Extensions Support enabled, the docs say a page without those headers means “the project will not run.” A service-worker workaround can supply them instead. This site’s page sets GODOT_THREADS_ENABLED = false (live index.html, line 197). It passes that value to Engine.getMissingFeatures (lines 247–249). With threads set to false, the cross-origin isolation check in lines 97–104 of the same folder’s index.js does not run. Only WebGL2, Fetch and a secure context are checked (lines 87–95). The page installs a service worker only when GODOT_CONFIG has a serviceWorker key (line 252). This site’s GODOT_CONFIG has no such key (line 196). So when a feature is missing, the page shows an error directly (lines 277–280).
Measure the compressed file, engine, and game data separately
In this revision, index.wasm.gz is 10,052,173 bytes, its decoded WASM is 39,509,339 bytes, and index.pck is 371,884 bytes. These are file measurements, not browser-memory measurements or load times. Network conditions, caches, hardware, and server configuration affect the waiting time.
The Godot 4.7 docs give a reference figure: gzip shrinks the WASM module “down to around a quarter of its original size.” This site’s files agree: 10,052,173 ÷ 39,509,339 is about 25.4%. The same section says a .wasm file served with a type other than application/wasm “can prevent some start-up optimizations.” The loader on this site sets Content-Type to that value when it builds the response.
import { readFileSync } from 'node:fs';
import { gunzipSync } from 'node:zlib';
import { createHash } from 'node:crypto';
const root = 'public/games/last-pitch-derby/';
for (const file of ['index.wasm.gz', 'index.pck']) {
const bytes = readFileSync(root + file);
console.log(file, bytes.length,
createHash('sha256').update(bytes).digest('hex'));
if (file.endsWith('.gz')) {
console.log('decoded WASM bytes', gunzipSync(bytes).length);
}
}Save the code as measure.mjs. The site repository is not public, so download /games/last-pitch-derby/index.wasm.gz and index.pck from this site. Put them in public/games/last-pitch-derby/ under a working folder, then run node measure.mjs from that folder. If results differ, compare hashes and revisions before attributing the change to compression. When the PCK grows, inspect project resources and export filters instead of focusing only on the engine binary.
Download the measurements, hashes, and reproduction stepsVerify the path through the loader
The packaging script produces a gzip-compressed WASM file. The generated HTML intercepts requests for index.wasm and fetches index.wasm.gz. When the server declares Content-Encoding: gzip, the loader avoids manually decoding again; otherwise it uses DecompressionStream and constructs an application/wasm response. Renaming a gzip file does not implement that delivery path.
For a blank screen, inspect WASM and PCK responses in Network: status, body, and size. An incorrect path may deliver an HTML error page, or the loader may receive bytes it cannot decode. This loader explicitly requires DecompressionStream; its absence is a compatibility boundary of this deployment approach.
A server returning HTML for a missing path is shown with download links in “Why downloads break on English pages”.Downloaded is not the same as interactive
The HTML uses current/total from onProgress and removes its loading screen after engine.startGame resolves. It does not measure compilation as 80–95% or shader work as the final 5%. Use an indeterminate startup message when no stage progress exists. Measuring the first interactive frame requires a separate signal from the game.
Record request start, download completion, and the first input that produces a game response. Compare cold and warm cache runs on the same device with network conditions noted. That separates transfer delay from startup work; smaller gzip bytes alone cannot establish a fourfold speedup.
Example: a total of 0 turns the progress bar indeterminate
The Godot HTML5 shell docs describe onProgress: a total of 0 means the size is “impossible to calculate.” One listed cause is “Files are delivered with server-side compression on Chromium.” On the 4.7 docs site, this page carries a notice that it was not yet updated for 4.7, so treat it with care.
Lines 285–292 of this site’s page handle that case. The bar shows numbers only when current and total are both above 0. Otherwise the code removes value and max, and the bar becomes indeterminate. This code comes from the HTML that Godot exports. In the source kit, lines 68–99 of package-web.mjs change only the language and viewport, then insert styles, a rotate notice and the fetch shim. They do not touch this code. This site has not measured the total value on Chromium.
Diagnose audio and mobile failures with observable steps
Test audio from a fresh page: press an explicit start control, check sound, switch away, and return. Do not take over the engine using an assumed Engine.getAudioContext API, or label every silent run a permanent deadlock. Inspect the configured audio mode and actual console errors first.
A reload near 90% does not by itself establish an out-of-memory failure. Record hardware and software versions, verify assets, and compare reduced texture, scene, or rendering workloads. Change one factor at a time and record whether the failure remains. This article supplies neither a universal iPhone memory ceiling nor a magic audio-buffer size.
Keep this release record
Keep export settings, WASM/PCK hashes, the production URL, browser version, and results for loading, first input, audio, backgrounding, and reload. File and configuration checks can run locally. Whether an iPhone Safari session is playable still requires interaction on that device.
Another Godot project: how Sokoban levels are checked automatically, in “I did not hand-build 100 levels”.Sources
- Godot:Web 匯出與功能限制
- Godot 4.7 文件:Exporting for the Web(Serving the files,2026-11-04 讀取)
- Godot 4.7 文件:HTML5 shell class reference(onProgress;該頁標註尚未依 4.7 更新,2026-11-04 讀取)
- 本站遊戲頁 Last Pitch Derby(index.html 載入程式,2026-11-04 版)
- 本站固定版匯出設定與打包、載入程式(4a7aec3 原始檔證據包) / Export preset, packaging and loader (source kit)