Skip to main content
Games

Developer Docs

Zamgot Quick Creation Guide

Achievements

An achievement is recorded when the game reports it. The game decides when it is earned.

Send the cumulative progress total at meaningful intervals, rather than on every screen update.

Achievements are records with no rewards.

Runtime memory budgets

When a game runs out of memory · Asset optimization standards · Studio memory measurement and device optimization

This common feature is available from engine 2.7.6. New Script projects default to 2.8.14; existing project engine pins are preserved. Older public versions including 2.8.9 through 2.8.13, 2.8.8, 2.8.7 and 2.8.4 remain selectable, while 2.7.0, 2.8.0–2.8.3, 2.8.5 and 2.8.6 stay hidden. On 2.8.7 and earlier, near the device's runtime/GPU estimate budget, the engine pauses heavy work in the fastest growing measured category (from 2.8.8 the default only warns; see the preloading and releasing section below). Players see what paused and what to do; the Studio console shows category, numbers and activity names.

The platform sets budgets for each physical device class and adjusts them from measurements. Budgets arrive in the boot config, so later adjustments do not require republishing a supporting engine. The defaults are phone 768 / 512MiB, tablet 1024 / 768MiB and PC 3072 / 2048MiB (runtime / GPU estimate), with an 85% reference ratio. Creators cannot increase these budgets. This policy does not increase iOS WebContent or OS limits.

A decoded RGBA image needs width × height × 4 bytes: one 4096² image is 64MiB. Load only needed assets, trim unused materials/animations/variants, and process changed vertex ranges instead of copying every vertex each frame.

Optionally call zamgot.set_activity_name("Scene generation") before heavy work and zamgot.clear_activity_name() when done. On false or () check zamgot.resource_last_error() and the mesh error, then stop retrying. A leftover run marker indicates an unexpected ending; it does not establish OOM. Some formats and browser allocations remain unmeasured. Activity names stay local; server reports contain anonymous numbers, device class, OS/browser families, the previous run's applied budget and fixed categories. They exclude raw UA, versions and personal/game/project identifiers.

Preloading, releasing and device memory

Available from engine 2.8.8. The engine releases images nothing on screen uses, by total size; there is no image count limit. Preload effects, UI images and models that must appear the moment they are first used, and release them when done.

English names: zamgot.preload_images(paths[, #{ full_size: true }]), zamgot.release_images(paths), zamgot.preload_models(paths), zamgot.release_models(paths). Each takes one path or an array and returns how many entries changed. Preloaded assets keep using memory until released; an asset still in use never disappears when released. zamgot.asset_load_status() counts preloaded assets too.

From 2.8.8 the engine logs a warning in the Studio run log and performance record when the device passes its memory reference. The game keeps running. Starting with 2.8.10, the engine shows an exit screen when the game ends because it could not allocate essential memory. How much to use and where to reduce is the creator's decision. From 2.8.9, the engine ignores the old setting for pausing work.

Measured device reference

Reference only. The engine does not enforce these values. They vary by device, browser and other open tabs; each row is a single measurement. iPhone 17 Pro Max (Safari): one tab survived about 1680–1696MiB and was closed at about 1696–1712MiB (2026-10-26, whole-tab total). No other devices have been measured yet.

Incoming assets that would cross the reference trigger a warning. Next engine release: set integer MiB in [performance] memory_budget_mib to raise or lower the warning reference. The server policy has no creator bounds yet, so the temporary range is 0.25 to 4 times the server total reference budget. Other values are ignored with one console warning. zamgot.memory_status() / zamgot.메모리상태() returns used and limit as integer bytes, stage (ok/pressure/limit), and source (platform/creator/device). Define fn on_memory_pressure(stage) or fn on_메모리압박(stage) in the game; the Korean hook takes precedence when both exist. It runs once on entering a pressure stage. Release preloaded images for distant scenes there. Automatic eviction follows separate per-device cache rules. Recovery permits another entry notification. The current pressure and limit boundaries coincide, so entry goes directly to limit. Select the new release after publication; published versions 2.8.9 and earlier stay unchanged.

[performance]
memory_budget_mib = 512

Studio memory measurement and device optimization

Reviewed 2026-10-13. MB/GB are source units; engine charts use MiB.

DeviceReported quantitySource dateConfidence / scopeSource
iPhone / WebKit~1.5 GB2024-08-09WebKit engineer; variable soft thresholdsource
iPhone 17 Pro / iOS 26.3–26.4.1ActiveHard 2048 MB2026-04 (case report)Low: single-device-family report, not a platform guaranteesource
iPad / WebKitUnknown / 미확정2026-10-11 reviewNo universal hard maximum establishedsource
PC / Chrome runtime memory4 GiB addressability2020-05-14High for runtime-memory addressing; not a safe process budgetsource
Android / Chrome (historical)~256–300 MB allocation issues2020-11-30 / 2021-02-15Low for current devices: historical firsthand reportssource / case
Safari / Unity WebGL practice300–500 MB target2023-10-03Medium: engine developer recommendation, not OS limitsource
iOS / PlayCanvas GPU practice300–350 MB risk range2022-12-28Low: developer observation of estimated VRAMsource
Engine policyRuntime memory MiBGPU estimate MiB
phone768512
tablet1024768
pc30722048

Admission ratio: 0.85; fallback policy only.

Device AI tools are available only when the feature is enabled. run_device_check returns a runId immediately; poll get_device_check(run_id) at intervals of at least two seconds for running/done/failed. Review the done receipt before preparing supported devices.

There is no guaranteed universal per-device maximum. Source MB/GB figures are not interchangeable with MiB/GiB. Do not probe browser limits by repeatedly allocating large buffers.

Engine memory total estimates simultaneous measured game runtime memory capacity plus estimated GPU usage. It is not process RSS. Game runtime memory includes allocator overhead, spare pages and its high-water mark. Do not add CPU categories to game runtime memory again. JS heap and UA memory may overlap game runtime memory and are displayed separately, never added to the total.

Per-component interval maxima differ from the maximum simultaneous total. Sampling every 250ms and asynchronous UA measurements can miss transient peaks. GPU accounting estimates engine images/meshes, excluding guaranteed coverage of driver/browser overhead or all render targets. Unavailable is not zero; browsers such as iOS show engine accounting only when browser APIs are missing. Checks retain boot peaks/errors, but sample counts, frame performance and coverage gates use only the requested interval, including leading and trailing gaps. The UI shows the last 200 samples; maxima belong to the current preview document.

performance.memory is nonstandard implementation information. measureUserAgentSpecificMemory is optional and requires browser support and isolation. Detect support; API failures must not erase engine accounting. API scope/timing differs from engine samples.

Budget lines show actual-device and simulated-target runtime memory/GPU budgets plus admission at 85%. The platform-controlled SiteSetting.runtimeMemoryBudget boot policy takes precedence over defaults below. Receipts preserve applied budgets and their source. Lower project budgets cause a policy mismatch during a server-budget check; creators cannot increase platform budgets.

The V107 opt-in inline Studio preview adapter selects existing engine device detection inputs. This applies engine budgets, phone texture downscaling and related device policy; it cannot reproduce real Safari, GPU, RAM, OS termination limits or touch performance. Existing viewport device selection alone does not do this. Close external/phone sessions and live playback first.

run_device_check hashes every synced HEAD path, byte size and SHA256 plus engine/runtime version, then runs an analysis preview reading only that captured HEAD for 10–60 seconds. steps use the existing preview scenario format. Omitting steps checks idle execution, not complete gameplay. Reuse important loading, restore and cleanup scenarios across targets.

Passing requires separate runtime memory/GPU peaks at or below budget × admitRatio, at least three complete memory samples per second, sample gaps at most 1.5 seconds, average at least 30FPS, frame p95 at most 33.34ms, at least 60 frames spanning 80% of the interval with gaps at most 1.5 seconds, matching policy/runtime, no protection/errors, and scenario success. Missing data never passes. Missing GPU accounting or unknownFormats/unknownMeshes also prevent passing. Frame gates use the greater of engine frame time and actual RAF interval; fast CPU work cannot hide slow display cadence.

scope=simulated_engine_policy and hardwareVerified=false describe browser-reported simulated-policy observations, not hardware certification or a tamper-proof benchmark. set_supported_devices(receipt_ids) replaces the whole list using only server-stored passed receipts for the identical source; [] clears it. Recheck after edits/runtime changes. The immutable publication manifest pins receipts to the game or live version. Device classes phone/tablet/pc are not certified hardware models. A changed target budget/admission ratio requires rechecking before support list updates. Human publication may continue with the stale list omitted. Already published lists record that version and the policy at check time.

AI checks, edits generic project files, rechecks and updates the list. Device tools never publish. Humans decide deployment through existing publication/approval controls; ownership and authorization remain required. Unlisted devices receive advice without a play block. A hand-built native executable lacks the engine GPU/policy contract and explicitly fails receipt qualification.

Stale or unreadable support is omitted with a warning while human publication continues. Public manifests contain only device class, receipt ID, source SHA, policy version and pass status. Asset paths, errors and full diagnostics remain in private R2 receipts.

The performance panel reads browser reference quantities only from browserLimits in this source. Preserve source units and distinguish them from engine budgets. Update browserLimits after V315 measurements.

iPhone / WebKit: A WebContent soft threshold varies with memory pressure, other tabs and device RAM. It is not a guaranteed allocation; termination or reload can occur.

iPhone 17 Pro / iOS 26.3–26.4.1: A developer-reported Jetsam log. Apple confirms different iPhone/iPad policies, not this number as a universal ceiling.

iPad / WebKit: Do not copy iPhone figures. Check actual hardware; display engine accounting only when browser memory APIs are unavailable.

PC / Chrome runtime memory: Browser-engine addressing capacity for game runtime memory, not process RAM, GPU budget, safe allocation or a memory64 ceiling. Allocations can fail earlier.

Android / Chrome (historical): Historical growth/allocation failures around 256–300 MB, involving address-space fragmentation and 32-bit browsers. This is not a current Android hard cap.

Safari / Unity WebGL practice: An experienced Unity developer target, not an official Safari ceiling or a guarantee for other engines.

iOS / PlayCanvas GPU practice: A developer observation during large-model loading, not an established physical VRAM ceiling on unified-memory devices.

When a game runs out of memory

In the next Script engine release, platform, creator and learned device reference values drive warnings and observations. The game keeps running above the reference, and asset caches use their own per-device eviction rules. Creator settings adjust the warning reference.

In a browser, the engine ends the run when it cannot allocate memory required to load a model or image, render a scene or execute the game. Gameplay stops while the engine checks previously requested saves for up to 30 seconds. Check the save result before restarting. Players can copy diagnostics from the game’s exit screen.

In Studio preview, choose View error to see the run log entry and its diagnostic. It includes the activity at exit, observed and peak runtime and estimated graphics memory, device check references and the save result. Run again opens a new preview.

After running a device check, see the result under Performance in Studio’s run log. A check that ends because memory could not be allocated records a failure. The preview uses the selected device settings. Repeat the same scene on physical devices.

The exit screen may be unavailable if the browser or operating system closes the tab immediately. A previous-run marker calls for further investigation of the cause. Start by reducing the largest images and models and loading fewer assets together, then recheck the same scene.

Compressed and decoded image sizes

Do not estimate runtime RAM from PNG/JPEG/GLB download size. Base-level RGBA8 is width × height × 4: 4096²=64MiB, 2048²=16MiB; add mips, layers and copies separately. Largest-image rgbaBytes is this hypothetical RGBA8 equivalent, not actual usage for compressed or floating-point GPU formats. Inspect dimensions, GPU estimates and category growth together. Author suitably sized sources and choose supported GPU compression with acceptable quality. Engine 2.7.6 uses [performance] mobile_texture_downscale=true and mobile_texture_max_size=2048 (256..2048); false opts out. Read #mobile-texture-downscale for transient original-decode costs and exclusions.

CPU and GPU copies

Retaining decoded CPU pixels and GPU textures duplicates storage. Engine 2.7.6 releases ordinary model/external-image CPU pixels after upload, except required editing paths. Avoid creating new copies; inspect categories. Game runtime memory capacity may stay high after objects are freed, so distinguish capacity from live ownership.

Hidden objects and retained copies

Hidden does not mean freed. Load visible assets on demand instead of preloading every variant/candidate. Prefer a baked single model and smaller textures on phones. Bound pools and destroy excess objects when finished. Rising model counts only suggest hidden/pool ownership; inspect code before attributing cause.

Whole meshes and large data exchanges

Reading all mesh vertices every frame or round-tripping large JSON maps creates temporary buffers and copies. Read only required vertex ranges, update changed ranges, and reuse stable values. Compare mesh-category growth with frame p95; counters alone do not establish API-call counts.

Bulk restoration spikes

Queue save restoration, scene creation and candidate generation in small batches across frames. Check remaining budget before admitting work. Frame delays suggest a spike, not proof of a restoration cause; compare scenario timing and code.

Concurrent decoding and loading

Original bytes, decoded pixels, reduced pixels and uploads can overlap even for small files. Limit concurrent loads and load candidates on demand. Compare assetDecodeLeaseCount peaks with model_loading/textures growth; verify cancellation also releases resources.

AI checklist

  1. Read engine total, separate runtime memory/GPU peaks and category growth against actual/target budget lines.
  2. Inspect largest images: resolution, decoded RGBA and CPU/GPU estimates.
  3. Check the warning category and usage. Reduce the assets that grew most. The 2.8.9 engine logs the warning and continues running.
  4. Inspect confirmed allocation failures in Studio error details and the device check result. Investigate previous-run breadcrumbs separately.
  5. Only when enabled, start run_device_check with important loading, restoration and cleanup scenarios, then poll get_device_check(run_id) for the result.
  6. Separate observations from suspected causes; read linked guide sections and code, then make generic optimizations.
  7. Repeat the same scenarios on all remaining targets. After the final edit obtain new receipts for every supported target.
  8. Pass only final-source passed receipt IDs to set_supported_devices and await human publication/approval.

Memory API reference / Memory API reference

Asset optimization standards

For phones, prefer 1024–2048 textures and avoid 4096. PCs should normally use 2048; reserve 4096 for close views. RGBA8 screen memory = width × height × 4 bytes; with mipmaps use ×4/3 (about 1.33). 1024² = 4MiB (5.33 with mips), 2048² = 16MiB (21.33), 4096² = 64MiB (85.33). MiB = 1,048,576 bytes. Download size is not decoded memory. Thin textures can exceed the 1.33 mip factor; inspection uses the larger of the full mip-chain sum and that approximation.

Scene texture targets including conservative mip estimates: phone 128MiB, PC 512MiB. These conservative targets were set at two thirds of the pre-2026-11-15 192/768MiB GPU budgets and are kept after the default rose to 512/2048MiB, leaving room for meshes, render targets and post-processing. They are not OS limits. The 300–500MB total game recommendation and iPhone roughly 1.5GB soft/2GB termination reports below are guidance and cases, not guaranteed allocations; confirm on hardware.

Load only visible character parts and outfits. Bake the default outfit, remove hidden body/hair/clothing meshes and duplicate textures in occlusion variants. Merging parts alone does not save texture memory. Load replacement variants on demand and release old resources; hidden pools can still retain memory.

Atlas small images by material with padding and UV/mipmap checks. A giant 4096 atlas does not guarantee savings. Prefer at most 8 images per model on phones and 16 on PCs, with model texture targets of 32/128MiB including mips. Meet resolution and memory budgets before reducing image count or draw calls.

Use PNG for alpha or precise data, JPEG/WebP to reduce opaque color downloads. File compression does not reduce RGBA memory. KTX2/Basis GPU compression requires proven runtime, extension and transcoder support; do not assume KHR_texture_basisu GLB support in the current scripted runtime. Inspection reads KTX2 vkFormat/typeSize: RGBA8/16F/32F use 4/8/16 bytes per texel times faces, layers and depth; BCn/ASTC use block sizes. Unknown formats stay unverified. Support warnings apply only to KHR_texture_basisu in GLB and BCn/ASTC. Uncompressed KTX2 cubemaps for skybox, environment_map and environment probes require no support warning. Verify Draco/meshopt loader support and decode cost too.

Recommended download size per model: phone 10MiB, PC 25MiB; per audio file: 2/5MiB. Keep effects short, mono where suitable and remove silence. Verify music codecs such as Ogg/MP3 on hardware. PCM memory = seconds × sample rate × channels × bytes per sample; compressed audio may grow when decoded. File and count limits are platform recommendations for download and decode cost.

Older engines can stop heavy asset work at their memory guard. In the next release, crossing the warning reference leaves the game running. If essential allocation fails and the game ends, check the activity and measurements in the exit diagnostic. Reduce large textures, variants, simultaneous parts, hidden pools and audio; then measure again. Do not hide the banner or disable safety budgets/downscaling. Original 4096 decoding still needs temporary memory even with runtime downscaling.

Before publishing, call audit_assets(target:"phone") and audit_assets(target:"pc") and inspect rows and warnings. Optional paths selects candidate assets used together. Inventory sums are not measured scene residency; external image paths are deduplicated. GLB image headers (PNG/JPEG/WebP/KTX2), counts and RGBA/mipmap estimates require no decoding or edits. Standalone and external GLB images read at most 64KiB of headers; .gltf/.obj/.fbx are marked unverified without reading their bodies. JPEG dimensions beyond the prefix remain unverified. Unsupported headers/models, external URLs, read failure or limits (64MiB/GLB, 256MiB read total, 2000 files, 25 seconds) produce incomplete warnings, never a zero-memory pass.

The default policy warns and permits deployment. Changing only assetBudget.enforcement to block stops Studio deployment preparation; server publishing authority and runtime protection remain separate policies. Responses include policyVersion, target, complete, scope, sceneMeasured:false, totals, rows, warnings, warningCount, truncated and blocksDeployment. An open Studio tab executes requests from browser-local/server files for scripted projects. Native disk inspection and the daemon AI tab bridge require daemon 0.36.192 or later plus confirmed audit-list/audit-read and header-read support. Unsupported daemons show an update-required message. Server MCP uses this tab bridge; standalone stdio or absent tabs report explicit errors. Recheck final edits and, if device tools are enabled, measure boot, replacements and crowded scenes with run_device_check/get_device_check.

Results are capped at 1000 rows, 200 warnings and 32 image details per asset; check truncated and split requests with paths. PNG/JPEG/WebP use RGBA8 planning estimates and KTX2 uses known texel/block formats, not a guaranteed upper bound. Mips use the larger of the full chain and a 4/3 approximation; actual GPU formats, mip generation, sampler/color-space copies, dynamic loads and temporary buffers require runtime measurement. Inspection reads current files and is advice, not an immutable source certificate. Do not raise budgets merely to pass. Native projects inspect the visible inventory from the existing daemon API, which excludes hidden/build folders; omissions not reported by that API cannot be detected.

RGBA8 texel bytes / Mipmaps add about one third / glTF 2.0 and GLB format

Automatic phone texture downscaling

Engine 2.7.6 enables this for every Script game by default. On physical phones, ordinary images with a longest edge above 2048 pixels are reduced proportionally. PCs and tablets retain originals; Studio device emulation does not change this policy. Embedded GLB images, external PNG/JPEG/WebP and ordinary sprites share the rule. SVG is rasterized directly at the target size.

One 4096×4096 RGBA image uses 64MiB; at 2048×2048 it uses 16MiB. Three images use 192MiB and 48MiB respectively. This describes decoded/upload pixels, excluding file size, mip overhead and total process memory. Fine detail and small text may soften when enlarged. Prefer suitably sized source assets.

Model and external image textures release their CPU pixel copy after GPU upload. A pixel read/edit API must request CPU retention when loading (the current script API has no pixel reader). Mesh editing data and generated font atlases stay available. This release does not reduce GPU storage or the game runtime memory high-water mark.

Use Studio project settings or the TOML below. Defaults are true and 2048; the maximum edge accepts integers from 256 to 2048. Set false to retain originals. Memory budget checks remain active: large originals can pause work or lead to browser/OS termination. Restart preview after changes and publish a new game version for public players.

[performance]
mobile_texture_downscale = true # false keeps originals
mobile_texture_max_size = 2048 # integer 256..2048

Exemptions: [game] pixel_art=true, nearest sampling, external paths with ui/fonts/pixel_art/atlases folder components, pixel-coordinate Sprite.region/nine_slice, generated font atlases/render targets, array/cubemap layouts, and KTX2/Basis/DDS containers including existing mips. Normalized model UVs stay valid. Embedded UI/text images need a nearest sampler or the project toggle because they have no external folder identity.

Use fullres://assets/detail.png for another precision image. Choose a consistent path: loading the same file through normal and fullres identities creates separate image assets. Read-only zamgot.mobile_texture_policy() / zamgot.휴대폰텍스처정책() returns enabled, applied, max_size, physical_device and reason. The Studio console and __zamgot2_resources expose the policy, downscaled count and saved bytes. A raster decoder still needs one original image temporarily; source plus output is admitted before decoding. This cannot guarantee protection from every memory termination.

Logging caught errors

오류를 try/catch로 붙잡아 화면에 그릴 때는 같은 내용을 로그 함수로도 남기세요. 제작소 콘솔과 인공지능 도구가 원인을 확인할 수 있습니다. 함수는 프로젝트에 고정된 엔진 판의 함수 판 표기를 확인한 뒤 사용하세요.

When showing a caught error in the game, log the same message so the Studio console and assistant tools can read the cause. Check each function's release label against the project's pinned engine version before using it.

try {
    load_stage();
} catch (error) {
    let message = "시작하다 멈췄어요: " + error.to_string();
    zamgot.log(message);
    zamgot.set_text("error", message);
}

Crossfades, spatial sound and effects

Available from Script engine 2.8.9. Games on 2.8.8 and earlier keep their existing audio behaviour.

Music can play on several named tracks at once and crossfade at equal power (crossfade_music). Layered music raises and lowers stems that share a tempo, and streaming plays long songs without decoding them whole (recommended for songs over one minute). Each sound can return a handle to stop it or change its volume, pitch and pan.

Spatial sound pans and attenuates by position. The listener follows the camera by default, and a sound can follow an entity. In 3D, head-related (hrtf) panning costs more per sound; keep it to a few dozen sounds.

Each bus (music, sound effects, voice, ambience, or your own) can take a filter, reverb and echo, and music can duck automatically while voice plays. Reverb is generated by the engine without files, and one reverb shape uses its memory once (about 0.14MB to 1.4MB). The engine does not cap how many sounds play at once; you can set your own limit.

Sound defaults

In 2D, sound stays at full volume up to half the screen's half-width and stops getting quieter at four times the half-width. In 3D, those distances are 5 m and 100 m at the scene's scale. A crossfade requires a duration. Use 0 seconds to switch immediately.

Ducking defaults to a 60% volume reduction over 0.08 seconds and restores the volume over 0.4 seconds. Every reverb preset starts with a mix of 0.3. When effects are reconnected during playback, the bus fades down and back up over 8 ms each. Newly connected reverb reaches the chosen mix over 58 ms.

More sound effects

With an engine release that includes the new effects, you can apply a chain of effects to a bus in order. Vary the volume or pitch, shift pitch by semitones, or change playback speed while keeping the pitch steady.

Use a file that captures a space's reverb on a bus, or apply effects to an individual sound. Plot changes over time for volume and effects, or make laser, hit and engine sounds without audio files.

Functions and examples are in section 6.1 of the Quick Build guide below, together with five behaviour changes when upgrading from 2.8.8 or earlier.

Multiplayer servers

Failures and responsibility

Failure explanationAttribution
The server could not startZamgot server
The server connection or process stoppedZamgot server
The spectator feed stoppedZamgot server
The game stopped or stopped respondingGame code
The game did not send the spectator viewGame code
A player could not connect or reconnectPlayers
Players left the gamePlayers

Failures before start are not charged. Unresolved matches are held until the next invoice closes. If the cause is still unresolved, we charge it with an invoice item and a notice, and allow disputes for 60 days.

Create Room

Leave this chat room?