@tpgames/bridge-godot
v0.3.2
Published
Initial TPG bridge for Godot Web exports.
Readme
@tpgames/bridge-godot
Initial TPG bridge for Godot Web exports.
Supported Runtime
- TPG SDK contract:
1.0.0 - Godot target: Godot 4.x Web exports that can call browser JavaScript through
JavaScriptBridge - Export preset: HTML5/Web export with the generated HTML,
.js,.wasm, and.pckassets served from the same TPG bundle directory
How It Works
Host/controller pages boot a normal TPG game runtime and call createGodotBridgeGame(). On boot, the bridge exposes window.TPG_GODOT for exported Godot scripts and relays TPG runtime updates as browser events:
tpg:lifecycletpg:loadingtpg:settingstpg:participantstpg:shared-statetpg:player-statetpg:message
Godot scripts can call the exposed runtime API to report readiness, update shared/player state, broadcast controller actions, target a participant, or ask the shell to return to the lobby. Shared state is authority-only, player state is participant-owned, mutation promises return typed acknowledgement results, and sharedStateSnapshot() / playerStateSnapshot() expose revisions for optimistic concurrency.
Minimal Host Surface
import { createGodotBridgeGame } from "@tpgames/bridge-godot";
import { bootGameRuntime } from "@tpgames/runtime-game";
bootGameRuntime(createGodotBridgeGame(), {
bridge,
initialContext
});Manifest Helper
import { createGodotManifest } from "@tpgames/bridge-godot";
const manifest = createGodotManifest({
gameId: "godot-bounce",
version: "0.1.0",
title: "Godot Bounce",
hostEntry: "/godot/host.html",
controllerEntry: "/controller.html"
});Current Limitations
- This package provides the browser-side TPG bridge and manifest helper. It does not run the Godot editor or export a
.pckfile. - Godot scripts still need a small project-side script that calls
window.TPG_GODOTthroughJavaScriptBridge. - Threaded/WebGL export settings must stay compatible with the target browser and TPG iframe sandbox.
- The first full Godot sample game and tutorial are tracked separately so this bridge can remain a small, reusable contract package.
