# Game storage Every game on the platform has a storage limit: how much all of its files may add up to. This guide explains the limit, how it is enforced, how to build games that stay well inside it, and how to ask for more when a game truly needs it. The numbers below are the defaults. The platform's administrators can change them, and can give one game a different amount. `get_started` (under `storage`) and `game_storage {project}` always show the current values for this platform and for that game. ## The limits | Limit | Default | What counts | | --- | --- | --- | | Storage per game | 100 MB | Every file in the game's workspace, added up. Platform-hosted Three.js and `@gcp/` modules do not count. | | Largest file | 50 MB | One file, at the size it is stored: a precompressed `.br` or `.gz` file counts compressed. | | Files per game | 3000 | Every file in the workspace. | Each deployed version keeps its own frozen copy of the files, so a version is always the size the workspace was when it was deployed. ## Tell the developer early The limit is part of the design, not an upload error to discover at the end. When you plan a game with a developer: 1. Say how much storage the game has (`get_started` or `game_storage {project}`). 2. Agree a plan for assets that fits: what is generated from code, what ships in the bundle, and what (if anything) is loaded at run time from the developer's own host. 3. Whenever an answer carries `storage.warning` (from 80% used, or over), tell the developer and adjust the plan before adding more. ## How it is enforced - **Uploads.** `upload_files`, the upload URL (`PUT …?path=`) and zip uploads (`POST …/zip`) refuse a change that would take the game over its storage, the largest file, or the file count. `upload_files` checks the whole call first, deletions included, so swapping a large file for a smaller one in one call works; if anything does not fit, nothing in the call is saved. A zip's size is checked from its directory before it is unpacked, and again after. - **Only growth is refused.** If a game is already over (its storage was lowered after it was uploaded), deleting or shrinking files always works. - **Deploying.** `deploy_preview` (and its `dry_run`) reports a static-check error when the workspace is over its storage or file count, and deploys nothing. - **Publishing.** `publish` refuses a new version that is over the game's storage. A rollback to a version that was live before is allowed. - **Answers.** Every upload, `list_files`, `list_projects {project}` and `deploy_preview` answer includes `storage`: ```json "storage": { "used": "41.3 MB", "storage": "50 MB", "free": "8.7 MB", "percent_used": 83, "warning": "The game has used 83% of its 50 MB storage (8.7 MB left). Tell the developer now, ..." } ``` Refusals use the codes `storage_full`, `file_too_large` and `too_many_files` (HTTP 413 from the upload URL) and say what to do next. ## Keep the game small In the order worth trying: 1. **Generate it.** Meshes, terrain, vegetation, textures, skies, sound effects and music can be built from code at boot, from a seed. A generated forest is a few kilobytes of code instead of megabytes of models, and it can be different every run. How is up to you. 2. **Load it at run time.** Keep large or optional content (extra levels, music, high-resolution textures, cutscenes, big models) on a host the developer controls and fetch it while the game runs. See below. 3. **Compress what ships.** glTF with Draco or Meshopt geometry; KTX2 or WebP textures sized to how big they are drawn on screen; AAC (`.m4a`) or MP3 audio at 96 kbps or less (Opus or Ogg only with an `.m4a` or `.mp3` fallback: Safari on iPhone and iPad plays Ogg only from iOS 18.4); no duplicate, unused or source files (`.psd`, `.blend`, uncompressed `.wav`). `game_storage {project}` lists the largest files and the space per kind of file. 4. **Use what the platform hosts.** Three.js and the `@gcp/` modules come from the import map and do not count against the game's storage. ## Loading content at run time The game page has no Content-Security-Policy restricting connections or media, so `fetch()`, XHR, ``, `