Web Exportのロゴ

Web Export

コミュニティ
jame581
web-export

Use when shipping a Godot game to the browser — Web export preset options, threads vs no-threads and COOP/COEP headers, hosting on itch.io or your own server, PWA, JavaScriptBridge, user:// persistence, audio and input limits, and load size

概要

公開者jame581
リポジトリGodotPrompter
スキル名web-export
スター
896
フォーク
60
同梱ファイル
2
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    jame581がGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルWeb ExportをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/jame581/GodotPrompter/tree/master/skills/web-export
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jame581/GodotPrompter.git /tmp/GodotPrompter
mkdir -p .claude/skills
cp -r /tmp/GodotPrompter/skills/web-export .claude/skills/web-export
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでWeb Exportを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にWeb Exportを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Web Exportは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Web Export in Godot 4.3+

Ship a Godot 4.x game as HTML5/WebAssembly. This covers what is different from a desktop export: the renderer, threading and server headers, browser interop, persistence, and the input and audio rules browsers enforce. All examples target Godot 4.3+ with no deprecated APIs.

C# projects cannot export to Web in Godot 4 — the .NET editor refuses the export (still true in 4.7.2). The code in this skill is GDScript only for that reason; a C# game that needs a browser build must be ported to GDScript or stay on Godot 3.

Related skills: export-pipeline for presets, CLI export and CI/CD, web-services for HTTP and WebSockets from the browser, rendering-pipeline for what the Compatibility renderer can and cannot do, audio-system for buses and playback, save-load for save formats.


1. What Changes on Web

AreaOn Web
RendererAlways Compatibility (WebGL 2) — rendering/renderer/rendering_method.web defaults to gl_compatibility. No SDFGI, VoxelGI, volumetric fog, SSR, FSR, or screen-space AA
ScriptingGDScript and GDExtension only. No C#
ThreadsOptional. Off by default; turning them on needs special server headers (Section 3)
AudioSample playback through the Web Audio API by default — AudioEffects on buses do not apply (Section 6)
Filesuser:// lives in the browser's IndexedDB; there is no access to the player's disk except downloads and file-picker uploads
NetworkingHTTP via the browser's fetch (CORS applies), WebSockets and WebRTC only — no raw TCP/UDP, so no ENet
ProcessesNo OS.execute(), OS.create_process(), or quitting the tab

Design for this from the start if web is a primary target. Porting a Forward+ game late means re-lighting it.


2. The Export Preset

Add a Web preset in Project → Export (export templates must be installed). The options that matter:

OptionDefaultSet it when
variant/thread_supportfalseYou need threads and can serve COOP/COEP headers (Section 3)
variant/extensions_supportfalseThe project uses GDExtension (needs the extension's web build)
vram_texture_compression/for_desktoptrueS3TC/BPTC textures for desktop browsers
vram_texture_compression/for_mobilefalseTurn on for phone browsers (ETC2/ASTC); costs a second texture set in the PCK
html/canvas_resize_policyAdaptiveNone / Project when embedding in a fixed-size page element
html/focus_canvas_on_starttrueKeep on so keyboard input works without a first click
html/experimental_virtual_keyboardfalseMobile browsers need an on-screen keyboard for LineEdit
html/head_includeemptyExtra <head> tags — analytics, meta tags, fonts
html/custom_html_shellemptyReplace the whole loading page with your own template
progressive_web_app/enabledfalseInstallable, offline-capable build (Section 4)
threads/emscripten_pool_size, threads/godot_pool_size (Godot 4.5+)8, 4Only shown with thread support; lower them to reduce memory

The output is an .html page plus .js, .wasm, .pck, and audio worklet files — upload all of them together. The default filename for the page should be index.html for most hosts.

CLI export works as on desktop: godot --headless --export-release "Web" build/web/index.html.


3. Threads or No Threads

Threaded builds use SharedArrayBuffer, which browsers only enable on a cross-origin isolated page. The server must send both headers on every file of the export (the page, its scripts, and the worker scripts):

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
No threads (default, Godot 4.3+)Threads
HostingAny static hostNeeds the two headers above, or the PWA workaround
AudioSample playback, low latencySample playback by default; stream mode crackles more
Embeds, ads, third-party iframesWorkBreak unless they also send CORP/CORS headers (require-corp blocks them)
WorkerThreadPoolTasks run inline on the main thread, so heavy work stalls framesReal background threads
Threadstart() returns OK but the function never runsReal background threads
Feature tagnothreadsthreads

Default to no threads. Turn them on only when profiling shows a real need (heavy procedural generation, physics on background threads), and you control the server or use a host that sets the headers. Code that must behave differently can check OS.has_feature("threads") — and any Thread-based code (level generation, loaders) must, or it silently does nothing on the default build. WorkerThreadPool is the portable choice.

Godot's own Remote Debug → Run in Browser server sends the headers, so a threaded build can work locally and fail once uploaded. Test on the real host.


4. Hosting

HostWhat to do
itch.ioUpload a ZIP with index.html at its root, set the project kind to HTML. For threaded builds tick SharedArrayBuffer support in the embed options
GitHub Pages, plain static hostsNo custom headers: ship the no-threads build, or enable PWA with progressive_web_app/ensure_cross_origin_isolation_headers (default true) so a service worker adds the headers after the first load
Your own server / CDNSend COOP/COEP for threads, serve .wasm as application/wasm, and precompress .wasm and .pck with Brotli or gzip

Server config snippets (nginx, Apache, Netlify, Cloudflare Pages), compression, and cache headers: references/hosting.md.

The PWA option also makes the game installable and playable offline. After you publish an update, JavaScriptBridge.pwa_needs_update() turns true (and pwa_update_available is emitted); call JavaScriptBridge.pwa_update() to reload into the new version — it reloads every open tab.


5. Detecting the Platform and Talking to JavaScript

Use feature tags, not OS.get_name() string checks:

gdscript
func _ready() -> void:
    if OS.has_feature("web"):
        $QuitButton.hide() # A tab cannot be closed from inside the game.
        if OS.has_feature("web_ios") or OS.has_feature("web_android"):
            _use_touch_controls()

web_android, web_ios, web_macos, web_windows, and web_linuxbsd read the browser's user agent. Use them to pick controls or quality, never as a security check.

JavaScriptBridge calls into the page. It exists on every platform but only does something on Web, so guard calls with OS.has_feature("web").

gdscript
var _on_resize_cb: JavaScriptObject # Keep a reference, or the callback is collected and never fires.


func _ready() -> void:
    if not OS.has_feature("web"):
        return
    var window := JavaScriptBridge.get_interface("window")
    _on_resize_cb = JavaScriptBridge.create_callback(_on_browser_resize)
    window.addEventListener("resize", _on_resize_cb)
    var lang: String = JavaScriptBridge.eval("navigator.language", true)
    print("Browser language: ", lang)


func _on_browser_resize(args: Array) -> void:
    print("Browser resized: ", args[0].type)


func export_save_file(data: PackedByteArray) -> void:
    # Call from an input event (button press): browsers may block downloads that aren't.
    JavaScriptBridge.download_buffer(data, "savegame.dat")

Callbacks receive one Array holding the JavaScript arguments. eval() runs arbitrary JavaScript — never pass it strings built from player input or network data.

Uploads, calling functions defined in your HTML shell, and sending events to the embedding page: references/javascript-bridge.md.


6. Audio

  • Browsers block audio until the player interacts with the page. Start the game behind a "Click to play" screen (or the default loading page's click) so the first sound isn't swallowed.
  • audio/general/default_playback_type.web is Sample: sounds are handed to the Web Audio API for low latency. AudioEffects on buses (reverb, filters, AudioEffectCapture, AudioEffectSpectrumAnalyzer) do not apply in this mode. Forcing Stream restores effects at the cost of latency and crackling — test before choosing it.
  • Prefer Ogg Vorbis for music and short WAV for SFX; MP3 also works. See audio-system and assets-pipeline.

7. Saving and Persistence

user:// is backed by IndexedDB and synced when a file is closed. ConfigFile, FileAccess, and ResourceSaver work unchanged.

gdscript
func save_settings(cfg: ConfigFile) -> void:
    cfg.save("user://settings.cfg") # Flushed to IndexedDB when the file closes.
    if OS.has_feature("web") and not OS.is_userfs_persistent():
        $SaveWarning.text = "Saves won't survive closing this tab (private browsing or storage blocked)."
        $SaveWarning.show()
  • Private browsing, storage-blocking settings, and cleared site data wipe user://. Check OS.is_userfs_persistent() and tell the player.
  • Storage is per origin: the same game on another domain (or a new itch.io upload URL) starts with empty saves. Offer export/import of save files (Section 5) for anything players would hate to lose.
  • Browsers may evict storage under disk pressure. For accounts and cross-device saves use a backend — see web-services.

8. Input, Window, and Performance Limits

BehaviorRule
Fullscreen, mouse capture, pointer lock, clipboard writesOnly work from inside an input event handler (a click or key press), not from _ready() or a timer
Keyboard focusLost when the player clicks outside the canvas; keep html/focus_canvas_on_start on and show a "click to focus" hint
Browser shortcutsCtrl+W, Ctrl+T, F11 and similar may be handled by the browser, not the game — don't bind core actions to them
Frame rateThe browser drives frames with requestAnimationFrame; background tabs are throttled or paused, so pause the game on NOTIFICATION_WM_WINDOW_FOCUS_OUT
MemoryWebAssembly memory is limited; large levels and uncompressed textures crash low-end and mobile browsers first
Load sizeEvery megabyte of .pck and .wasm is downloaded before play — trim unused assets and compress on the server

Load-size checklist (export filters, texture formats, custom template builds without unused modules): references/hosting.md.


9. Common Pitfalls

SymptomCauseFix
Blank page, console says SharedArrayBuffer is not definedThreaded build on a server without COOP/COEPExport with thread support off, or add the headers
Works locally, fails after uploadThe editor's test server sends headers your host doesn'tTest on the real host; ship no-threads
Opening index.html from disk failsBrowsers block WebAssembly from file://Serve over HTTP, even locally
Game looks flat or dark compared to desktopCompatibility renderer drops advanced lightingBake lightmaps; design for Compatibility (see rendering-pipeline)
No sound until the second clickAutoplay policyClick-to-play screen before the first sound
Reverb/filters missingSample playback ignores bus effectsAccept it, or use Stream playback for that project
Saves gone next visitPrivate window or new originWarn via is_userfs_persistent(); offer save export
HTTP requests fail only in the browserCORS or mixed contentFix server headers; HTTPS/WSS only (see web-services)
request_fullscreen / mouse capture ignoredNot called from an input eventTrigger it from a button press
Web export fails with "not supported in Godot 4 when using C#/.NET".NET editor builds cannot target WebPort to GDScript, or export a GDScript-only project from the standard editor

10. Checklist

  • Project designed and lit for the Compatibility renderer
  • No C# in the project; GDExtension only with variant/extensions_support and web binaries
  • Thread support off unless needed and the host sends COOP/COEP (or the PWA service worker handles it)
  • vram_texture_compression/for_mobile enabled if phone browsers are a target
  • Tested on the actual host, not only the editor's Run in Browser server
  • Click-to-play screen before audio starts; game pauses when the tab loses focus
  • Fullscreen, mouse capture and downloads triggered from input events
  • OS.is_userfs_persistent() checked; players can export important saves
  • Quit button hidden on Web; platform checks use OS.has_feature("web")
  • JavaScriptBridge callbacks stored in member variables; eval() never fed untrusted strings
  • .wasm served as application/wasm; .wasm and .pck compressed on the server
  • Download size checked; unused assets excluded from the Web preset

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Web Export」では何ができますか?

Use when shipping a Godot game to the browser — Web export preset options, threads vs no-threads and COOP/COEP headers, hosting on itch.io or your own server, PWA, JavaScriptBridge, user:// persistence, audio and input limits, and load size

TypingMindでWeb Exportを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Web Exportはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにWeb Exportをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/jame581/GodotPrompter/tree/master/skills/web-exportを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Web Exportを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Web Exportは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもWeb Exportを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Web Export」は無料ですか?

はい。jame581がGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇