Export settings
- Install the export templates that match your Godot version.
- Use the Compatibility renderer. C# web exports are not supported by Godot.
- Add a Web export preset and export to
index.html. Keep the generated.wasm,.pckand loader files together and do not rename them. - Leave PWA and service workers disabled.
The Godot starter is a project with a ready web preset. Open project.godot, export the Web preset to build/index.html, and copy peerless-sdk.js into build/.
Load the SDK
Add the SDK to the HTML head in your export preset (Head Include):
<script src="peerless-sdk.js"></script>Call the SDK from GDScript
Godot reaches browser APIs through JavaScriptBridge. Get the Peerless object, wrap your handlers with create_callback and keep a reference to each callback so it is not freed:
var sdk
var overlay_callback
func _ready():
if OS.has_feature("web"):
sdk = JavaScriptBridge.get_interface("Peerless")
if sdk:
overlay_callback = JavaScriptBridge.create_callback(_on_overlay)
sdk.on("overlay", overlay_callback)
JavaScriptBridge.eval("Peerless.init().catch(console.error)")
func _on_overlay(args):
var visible = args[0].visible
get_tree().paused = visibleFor promise-based calls such as achievements, evaluate the JavaScript directly:
JavaScriptBridge.eval("Peerless.achievements.unlock({ key: 'first_victory', eventId: crypto.randomUUID() }).catch(console.error)")Threaded exports
Enable Thread Support in the Web preset only when your game needs it, and mark the build Threaded in the upload form. Threaded builds need a cross-origin isolated page, so PEERLESS opens them in the full player page rather than on the store page. See Cross-origin isolation.
Upload settings
Choose Godot HTML5, set the entrypoint to your exported HTML file and ZIP the contents of the export folder. Enable Peerless rooms only if the game joins relay rooms.