# Glint SDK (llms.txt) Glint (https://glint.joinfoundry.xyz) hosts self-contained browser games on https://games.joinfoundry.xyz inside a strict zero-network sandbox. ## Live Documentation & Studio Tools via Foundry MCP (Recommended for AI Agents) Connect to Foundry's public MCP endpoint (no sign-in required) to pull complete rules, CLI usage, publishing requirements, full TypeScript API signatures, engine guides, and error diagnostics: - Public MCP URL: https://api.joinfoundry.xyz/mcp/public - Public tools: glint_sdk_rules (sections: all, limits, sandbox, manifest, multiplayer, cli, publishing), glint_sdk_api (topic: all, overview, lifecycle, meter, demo, system, player, saves, achievements, leaderboards, multiplayer, input), glint_sdk_engine_guide, glint_sdk_diagnose - Authenticated Studio tools (https://api.joinfoundry.xyz/mcp, marketplace:read / marketplace:write): glint_list_my_games, glint_studio_game_config, glint_create_game, glint_update_game, glint_upsert_achievement, glint_upsert_leaderboard ## Always Use the Latest @joinfoundry/glint-sdk Package First Before scaffolding, validating, or publishing, verify you have the newest @joinfoundry/glint-sdk release (Node.js 20+): - Check latest version: npm view @joinfoundry/glint-sdk version - Always-latest one-off CLI (works in any folder and bypasses stale npx caches): npx --yes --prefer-online -p @joinfoundry/glint-sdk@latest glint - Update project dependency: npm install @joinfoundry/glint-sdk@latest - Update global install: npm install -g @joinfoundry/glint-sdk@latest - Note: @joinfoundry/glint-sdk is a scoped package; bare "npx glint ..." only works inside a project that already installed @joinfoundry/glint-sdk. ## Core Constraints 1. Bundle everything locally with relative paths (./assets/...). Zero external URLs, CDN scripts, Google Fonts, raw WebSockets, or WebRTC. 2. Put index.html and glint.json (schema: https://glint.joinfoundry.xyz/schemas/glint-manifest-v1.json) at the ZIP root. 3. Budgets: <= 2.0 MB compressed initial boot ("Loads Fast" badge; warning at 1.6 MB; excludes lazy-loaded 3D models/audio/textures), <= 30 MB hard initial boot cap, <= 500 MB total, <= 30 MB per file, <= 10,000 files, ready within 15s. 4. Export uncompressed by default; Glint repackages uploads (<= 128 MB) with Brotli automatically (quality 11 for text/code <= 2 MB, quality 6 for larger text, quality 9 for binary <= 256 KB, quality 5 for binary > 256 KB). 5. Package X-Ray inspects every build: normal minified web-game JS bundles are allowed (not flagged as obfuscation), and URLs inside source code comments and Foundry's $schema are ignored. 6. Call await Glint.init(), report sdk.lifecycle.loadingProgress(0..1), call sdk.lifecycle.ready(), halt rendering/audio on onPause, clamp DPR with Math.min(window.devicePixelRatio || 1, sdk.system.getHints().maxDpr), and obey sdk.system.isMuted() / onMuteChange(). 7. Use sdk.saves (4 slots, 1 MB total) instead of localStorage for isolated cloud saves. 8. Use sdk.multiplayer (2-16 players + up to 32 spectators, 20 msg/s, 4 KB/msg, host-authoritative with onHostChange) for online multiplayer. Glint automatically renders a collapsible Room, Text Chat, and Voice Chat sidebar beside the game iframe when multiplayer.online.enabled=true; do not build duplicate chat/voice UI, just handle live iframe resize smoothly. 9. Keep capabilities.threads: false unless SharedArrayBuffer / multithreaded WASM is strictly required. 10. Controller support & remapping: declare inputs.gamepad.actions in glint.json (or call sdk.input.defineActions) and read remapped inputs with sdk.input.poll(0). Glint provides an in-game Controller button and Glint Account controller hub where players can use any USB/Bluetooth controller, remap physical buttons and sticks, rebind game actions, choose Xbox/PlayStation/Nintendo glyphs, and sync mappings across devices. 11. Where It Plays (Desktop Only / Desktop and Mobile / Mobile Only): Desktop Only games are strictly hidden and blocked on mobile web and the mobile app. If your game supports mobile screens and touch controls, set inputs.mobileOptimized: true (or --mobile-optimized true / Desktop and Mobile under Where It Plays in Glint Studio) so it appears on desktop, mobile web, and the mobile app with the Optimized for Mobile badge. ## CLI Workflow (Build, Validate, and Agent-Assisted Publish) - Scaffold: npx --yes --prefer-online -p @joinfoundry/glint-sdk@latest glint init [vanilla-ts|phaser|threejs|kaplay|multiplayer-ts|godot|unity] [dir] - Local Emulator & Multi-Player Room Lab: npx --yes --prefer-online -p @joinfoundry/glint-sdk@latest glint preview [dir] [--players 2] - Certify build before upload: npx --yes --prefer-online -p @joinfoundry/glint-sdk@latest glint validate [dir|zip] --json - Inspect project & candidate cover images before asking the developer: npx --yes --prefer-online -p @joinfoundry/glint-sdk@latest glint publish [dir] --inspect --json - List Studio games: npx --yes --prefer-online -p @joinfoundry/glint-sdk@latest glint games --json - Create/update a game, upload 16:10 (>= 640x400) cover & screenshots (or --skip-cover), and push a build: npx --yes --prefer-online -p @joinfoundry/glint-sdk@latest glint publish [dir] --create --title "..." --version "1.0.0" --description "..." --genres "..." --cover ./cover.png --json - Upload a build to an existing game: npx --yes --prefer-online -p @joinfoundry/glint-sdk@latest glint upload [dir|zip] --game [--notes "..."] [--content-changed false] - Create a personal token (marketplace:write): https://joinfoundry.xyz/workspace/agents - Draft & waiting-to-publish games live in Glint Studio at https://glint.joinfoundry.xyz/studio (direct game page: https://glint.joinfoundry.xyz/studio/games/). Content rating, rights confirmation, paid seller setup, and final Publish are completed in Glint Studio.