Foundry

Help Center

Godot 4.3+

Publish a Godot 4.3 or later game on Glint: add the Glint.gd AutoLoad, use the single-threaded Web export preset and the Foundry shell, call the SDK from GDScript, and package an uncompressed export.

Glint SDK · 6 min read

The Godot adapter connects a Godot 4.3 or later Web export to the Glint SDK. It has an AutoLoad script that you call from GDScript, a single-threaded export preset and an HTML shell that loads the SDK before the engine.

What's in the Adapter#

Bash
glint init godot godot-adapter
File What it is
Glint.gd The AutoLoad singleton. It talks to the SDK through Godot's JavaScriptBridge.
export_presets.cfg A Web export preset named "Glint (Web Single-Threaded)".
foundry-shell.html The custom HTML shell for the export.
glint.json A starter manifest with "engine": "godot" and "webgl2": true.
glint.js The browser build of the SDK.

Scaffold into its own folder, as above, and copy the files into your project. init overwrites files with the same names, including an existing export_presets.cfg. If your project already has export presets, copy the preset's sections into your own file instead.

Add the AutoLoad#

  1. Copy Glint.gd, foundry-shell.html, glint.js and glint.json into your project's root folder (res://).
  2. Open Project > Project Settings > Globals > Autoload, add res://Glint.gd and name it Glint.

Your scripts can now call Glint from anywhere. In the editor and on other platforms, the adapter emits sdk_ready with a placeholder player and every other call does nothing, so the same project runs everywhere.

Use the Single-Threaded Export Preset#

Copy export_presets.cfg into your project (or merge its preset), then pick Glint (Web Single-Threaded) in Project > Export. You need Godot's Web export templates installed. The preset's main settings:

TOML, also INI
[preset.0]
name="Glint (Web Single-Threaded)"
platform="Web"
runnable=true
export_filter="all_resources"
include_filter="glint.json,glint.js"
export_path="build/index.html"
[preset.0.options]
variant/extensions_support=false
variant/thread_support=false
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=true
html/custom_html_shell="res://foundry-shell.html"
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
progressive_web_app/enabled=false

The HTML Shell#

foundry-shell.html replaces Godot's default page. It fills the frame, loads ./glint.js before the engine, starts the SDK and passes the engine's download progress to Glint's loading bar, up to 95%:

HTML, XML
<canvas id="canvas"></canvas>
<script src="./glint.js"></script>
<script src="$GODOT_URL"></script>
<script>
(async () => {
const sdk = window.Glint ? await window.Glint.init() : null;
const engine = new Engine($GODOT_CONFIG);
await engine.startGame({
onProgress(current, total) {
if (sdk && total > 0) sdk.lifecycle.loadingProgress(Math.min(0.95, current / total));
},
});
})();
</script>

The shell doesn't call ready(). Your game does, from GDScript, once its first screen is interactive.

Call the SDK From GDScript#

gdscript
extends Node
var best_score := 0
func _ready() -> void:
Glint.sdk_ready.connect(_on_sdk_ready)
Glint.save_loaded.connect(_on_save_loaded)
Glint.host_paused.connect(_on_host_paused)
Glint.host_resumed.connect(_on_host_resumed)
if Glint.is_initialized:
_on_sdk_ready(Glint.player_info)
func _on_sdk_ready(player_info: Dictionary) -> void:
print("Playing as ", player_info.get("displayName", "Player"))
Glint.report_progress(1.0)
Glint.load_slot("main")
Glint.ready()
Glint.gameplay_start()
func _on_save_loaded(slot: String, data: Variant) -> void:
if slot == "main" and typeof(data) == TYPE_DICTIONARY:
best_score = int(data.get("best_score", 0))
func _on_host_paused(_reason: String) -> void:
Glint.save_slot("main", {"best_score": best_score})
func _on_host_resumed() -> void:
pass
func _on_level_complete(score: int) -> void:
best_score = max(best_score, score)
Glint.unlock_achievement("first_win")
Glint.submit_score("high_score", score)

The adapter already handles pause and mute for you:

Methods#

Method What it does
report_progress(fraction: float) sdk.lifecycle.loadingProgress(), clamped to 0 to 1.
ready() sdk.lifecycle.ready().
gameplay_start() sdk.lifecycle.gameplayStart().
gameplay_stop() sdk.lifecycle.gameplayStop().
save_slot(slot: String, data: Variant) sdk.saves.save() with data converted to JSON. Use a Dictionary or Array.
load_slot(slot: String) sdk.saves.load(). The result arrives through save_loaded.
unlock_achievement(key: String) sdk.achievements.unlock().
submit_score(board_key: String, score: float) sdk.leaderboards.submit().
create_room(mode: String = "default", max_players: int = 8) sdk.multiplayer.createRoom(), then emits room_joined.
join_room(code: String, as_spectator: bool = false) sdk.multiplayer.joinRoom(), then emits room_joined.
send_room_message(target: String, msg_type: String, payload: Variant) room.send() with a JSON payload. target is "all", "others", "host" or a player ID.
open_invite_dialog() sdk.multiplayer.openInviteDialog().

Signals#

Signal When
sdk_ready(player_info: Dictionary) The SDK is connected. player_info has isSignedIn, id, displayName and avatarUrl.
host_paused(reason: String) Glint paused the game: tab_hidden, host_overlay, demo or free-hours.
host_resumed The game may continue.
mute_changed(muted: bool) Glint's master mute changed.
save_loaded(slot: String, data: Variant) A load_slot() finished. data is null for an empty slot.
room_joined(room_info: Dictionary) A room was created or joined: id, code, selfId, hostId, isHost and players.
room_state_changed(state: Dictionary) The room's shared state changed.
room_message(from_id: String, msg_type: String, payload: Variant) A room message arrived.
host_changed(new_host_id: String, is_self_host: bool) The room's host changed.
player_joined(player: Dictionary) A player joined the room.
player_left(player_id: String, reason: String) A player left: left or timeout.

Properties#

Property Meaning
is_web true in a Web export.
is_initialized true once the SDK is connected.
is_muted Glint's current master mute.
player_info The player, as passed to sdk_ready.
pending_invite_code The room code from an invite link, or an empty string.

Multiplayer From Godot#

Set multiplayer.online.enabled to true in glint.json, then join an invite or create a room once the SDK is ready:

gdscript
func _on_sdk_ready(_player_info: Dictionary) -> void:
Glint.room_joined.connect(_on_room_joined)
Glint.room_message.connect(_on_room_message)
Glint.host_changed.connect(_on_host_changed)
if Glint.pending_invite_code != "":
Glint.join_room(Glint.pending_invite_code)
else:
Glint.create_room("arena", 4)
Glint.ready()
func _on_room_joined(room_info: Dictionary) -> void:
print("Room ", room_info.get("code", ""))
func _on_room_message(from_id: String, msg_type: String, payload: Variant) -> void:
if msg_type == "input":
print(from_id, " sent ", payload)
func _on_host_changed(_new_host_id: String, is_self_host: bool) -> void:
if is_self_host:
print("This player now runs the match")

The adapter covers the calls above. For anything else, such as quickJoin, room state or binary frames, it keeps the SDK in window.__fpSdk and the current room in window.__fpRoom, so you can call them through JavaScriptBridge:

gdscript
func set_round(round_number: int) -> void:
if Glint.is_web:
JavaScriptBridge.eval("window.__fpRoom?.setRoomState(%s)" % JSON.stringify({"round": round_number}))

See Multiplayer Rooms for what each call does.

Export and Package#

  1. Export with the Glint (Web Single-Threaded) preset. Godot writes index.html, the .js, .wasm and .pck files to build/.
  2. Copy glint.js and glint.json into build/, next to index.html. The preset's include filter adds both files to the game's data, but the shell loads glint.js from the export folder and Glint reads glint.json from the top of the ZIP. Without glint.js there, sdk_ready never fires on the Web.
  3. Preview and validate the export:
Bash
glint preview build
glint validate build
  1. Zip the contents of build/ with standard ZIP compression and upload it in Glint Studio. Don't pre-compress the exported files; Glint compresses them with Brotli on upload. See Uncompressed Export and Brotli Repackaging .

Note

The validator scans HTML and JavaScript, not GDScript inside the .pck. An online Godot game shows warning GL014 even when it handles host_changed.

The .wasm and .pck files count toward the initial boot payload. Keep the first scene light and strip unused export features to stay near the 2 MB Loads Fast budget; see Budgets.

Threads#

Leave Thread Support off. Turn it on only if the game needs WorkerThreadPool or other multithreading, and then set "capabilities": { "threads": true } in glint.json. Glint then runs the game in advanced mode, full screen with cross-origin isolation. The validator fails a threaded build that doesn't set the flag (GL012).

Still stuck? Contact Support.