Minigames
The Minigames plugin is for everything that is not the adventure itself: a lock, some pipes, a jigsaw, a skill game, a 3D arcade… Every minigame is an HTML file that runs isolated inside the game: the game only sends it parameters and what has been prepared, and gets back a result: won, lost or cancelled, plus a score and outputs of its own.
Each HTML file can bring its Setup part: the minigame's admin (the lock code, how the puzzle starts, the piece images, the background…). In the studio you see the game big on top and its Setup below. That part never ships with the exported game.
Since not everyone needs it, it is not on by default: each project installs it separately (Plugins → Minigames), and a game without the plugin does not change at all.

Four ways to create one
| Way | What for |
|---|---|
| A template | The usual way, in a minute: lock, light sequence, pipes, jigsaw, match pairs, timing bar, cannon. Each with its Setup. |
| Ask an AI | Anything else: copy the prompt, change the boxes, paste it into ChatGPT, Claude or Gemini and paste the HTML it gives back into VERB. |
| The AI agent | Ask in one sentence ("make me a 4×4 pipes minigame with a sewer background") and it is done, with its Setup, its images and the proof that it can be won. |
| Write it yourself | An HTML file with the VERB.* API; any library VERB ships works (Three.js, Phaser, p5…). Bring it in with Import .html. |
All four are the same thing: an HTML file with its game and its Setup, launched the same way and returning the same to the game.
Start from the door
You usually start where you think of the minigame: "this door has a lock". In the panel of the hotspot or scene object, 🧩 Add a minigame here (also with the plugin off) opens Choose a minigame:
- On the left: the templates with their description, Create with AI…, Blank (HTML) and your minigames (with a search box when there are many).
- On the right: the name and a playable preview.
Add here (or Enter) turns the plugin on if needed, creates the minigame and connects it to the hotspot in a single step: one Ctrl+Z undoes it all. Its code, solution or images are changed afterwards in its Setup, in the studio.
Also from Ctrl+K: Add minigame… or Minigame: Lock (and the other templates); with a hotspot or object selected in the scene, it is connected to it. And from Plugins → Minigames, after creating it, Connect to… takes you to the panel of the hotspot you choose.
Launch a minigame with no scripts
The panel of a hotspot or scene object has a Minigame group:
- Launches: which minigame (with + New… to pick another) and how it looks, with a drawing of each layout.
- The parameters of the minigame (for example the lock code) show in grey with their value; Change only for this hotspot changes them for this door without touching the minigame (so one lock serves three doors with different codes), and ↺ goes back to the minigame's value.
- If won / if lost / if given up: what happens in each case, without writing Logic. Each can say a line and give an item; set a variable; switch an object to another state; turn hotspots on or off and make objects appear or disappear, in this scene or another; run a script (or create one); go to another scene.
- Can be played again after winning: by default, once won it is not launched again.
Use or open launches it. If the hotspot has a lock, it must be opened first and, in the same action, the minigame is played. A "Use" script of its own takes priority.
An exit with a minigame is a lock
If the hotspot is an exit, the minigame locks it: it cannot be crossed until it is won, not even with a double click. The On winning selector says what happens then:
| On winning | What happens |
|---|---|
| cross (default) | the protagonist crosses as soon as they win, like opening a lock |
| stay open | they do not cross: the exit stays open and is crossed when used again |
- With Played every time it is crossed, the minigame is played every time and, on winning, it always crosses.
- If "If won" already changes scene ("Go to scene" or a script that does it), that wins and the exit is not crossed.
- If lost or given up, the exit stays closed.
With Logic blocks
For finer control there are two blocks (only with the plugin on): Play the minigame ‹minigame› (launches it and waits for it to end) and if the last result of ‹minigame› was ‹won / lost / cancelled›.
How it looks
| Layout | What it does |
|---|---|
| Frame over the scene | A frame over the scene, with its title and Give up. |
| Zoom towards the clicked spot | Bigger and towards the clicked point. |
| First person | Almost full screen: things are touched directly. |
| Full screen | Covers everything. |
| Separate scene | The minigame brings its own project scene and, when it ends, the protagonist returns to where they were. |
VERB draws the frame, the title, the give-up button and the background: the minigame's HTML fills its whole frame, edge to edge, and is transparent. There is one single background (a colour or an image from Assets): it is changed in the minigame's sheet or from its Setup, and it is the same one.
While a minigame is on screen, the keys are its own (the game behind does not react). What characters say during the minigame is painted by the game engine, with the character's voice, colour and language.
The Minigames studio
Plugins → Minigames → Open minigames (or "Minigames" in the left menu) opens the full-screen studio. It edits the project directly, with undo and redo, and F5 brings you back to the same place.
- On the left, the list: New minigame (the templates, Create with AI…, Blank, Import .html and Import .verbmini) and, right-clicking one, duplicate, rename, export
.verbminior.html, and delete (it tells you where it is launched from). - In the middle, on top, the game big, playable, with its background. Restart starts another round and Check it can be won plays it by itself with its
VERB.test.solveand says whether it wins. If the HTML has a JavaScript error, it shows below. - Below, Setup: first the automatic form of the settings the HTML declares with
VERB.defineConfigand, below it, its own part (what is marked withdata-verb-admin), in the editor language. What you change is saved in the project (undoable) and the game above gets it at once or restarts. - On the right, the sheet: name, how it looks, frame proportion, background, give-up button, seconds the ending is shown, parameters (set by whoever launches it), outputs (the variables that go back to the game) and a note.
- On top: Code (the whole HTML, game and Setup together, with colours for HTML, CSS and JavaScript, line numbers, folding and search with Ctrl+F, to read, paste, import or export it; Tidy the code indents and formats it, and what you paste from an AI is saved already tidied), With AI (remake it with the prompt), Play (in a box, with the language, layout and a background scene), the game language, undo and redo.
While the studio is open, the editor underneath cannot be touched and Tab does not leave the studio. With the focus inside the game, Ctrl+Z and Ctrl+Y undo and redo in the editor, and Esc takes the focus out of the game.
Templates: six ready-made minigames
Each template is a complete HTML game that looks like a game (glass screens, keys with relief, lights, animations and sounds), in Spanish and English depending on the game language, with its Setup. In all of them, besides what the table says, every sound can be changed (the Sounds card: pressing a key, a miss, opening, winning…; empty = the default sound), and so can every on-screen text ("ENTER THE CODE", "OPEN!"…; see On-screen texts) and the background:
| Template | How it plays | What is prepared |
|---|---|---|
| Lock | A safe with a keypad: type the code. History of tries and try lights. | The code (or the code parameter per hotspot), the hints on a miss —strict (only says whether it is right), higher or lower (each digit says ↑ or ↓) or Mastermind (● in place, ○ elsewhere)—, the tries, the line the protagonist says on a miss, and the background. |
| Light sequence | Buttons light up with their note: repeat the sequence, which grows one light per round. | How many buttons, the length, the speed and the lives. |
| Pipes | Straights, elbows, Ts and crosses that turn with a click; the water flows live from the inlet and you win when it reaches the outlet. | The size (3×3, 4×4 or 5×5), the solved view (the solution, piece by piece), the inlet and outlet, Random path and the start view (scramble randomly each time or always the same). It warns if the water does not get through. |
| Jigsaw | The pieces of a picture are scrambled: tap two (or drag one) to swap them. It comes with a default picture (an autumn street) in 6×4; the pieces take the picture's proportion. | Columns and rows (up to 8×8), one whole image (cut while playing), an image cut into pieces (saved as assets) or one image per piece (click the piece), the solved view and the start view with its scrambles: random, reverse, corners or one swap away. |
| Match pairs | Face-down cards turned two at a time. | The pairs (a symbol or emoji, or one image per pair), the card back, the time and how long they show on a miss. |
| Timing bar | A needle sweeps back and forth: press when it is in the green zone. | Hits to win, misses to lose, the speed, the zone width and whether it narrows and moves. |
| Cannon | From the wall, at the pirate ships crossing the bay: aim with the mouse or the arrows and fire with a click, space or FIRE!. The ball flies in an arc to where you aim (farther means longer in the air) and the wind pushes it, so you have to lead the ship; a circle marks where it will land. Sloops (one hit) and frigates (two) at three distances; at the end the flagship arrives, fires back (its side glows before it shoots) and takes lives off the wall. You lose with no shots or no wall left. | The ships to sink (or the targets parameter on each hotspot), the shots, the wall lives, the speed, the top wind, the flagship, whether they fire back, the aiming help, the sea and sail colours, the ship image and the cannon image (drawn by default) and the sunset veil over the background. Variables: hundidos and balas. |
They are also the example of how a minigame is written: open them in Code and copy them.
Ask an AI
The prompt below carries all the rules and the whole API, so the AI does not have to guess anything. Copy it, change what is in brackets ([CHANGE THIS: …]), paste it into ChatGPT, Claude, Gemini or the AI you use and paste what it gives back into VERB: Plugins → Minigames → Create with AI… (or in the studio, Create with AI…, or With AI to remake one). You have the game and its Setup. If the AI wraps it in a code block or adds explanations, VERB keeps only the HTML.
The same prompt is on the plugin page (Copy prompt), in case you do not have the documentation at hand.
You are an expert game developer. Make me a minigame for VERB Studio (a point-and-click graphic adventure maker): ONE HTML file with the game and its "Setup" part.
WHAT I WANT
- The minigame: [CHANGE THIS: describe it, e.g. "a lock with three rotating symbol wheels"]
- How it is won: [CHANGE THIS: e.g. "leave the three wheels on moon, sun and star"]
- How it is lost: [CHANGE THIS: e.g. "it cannot be lost" or "after 60 seconds"]
- The look: [CHANGE THIS: e.g. "brass and old wood, like a pirate chest, with warm lights"]
- What is prepared in "Setup": [CHANGE THIS: e.g. "the combination, how many symbols each wheel has, the image of each symbol and the background"]
- Languages of the labels: [CHANGE THIS: English and Spanish]
- Library: [CHANGE THIS: none (HTML, CSS and canvas) or Three.js / Phaser / p5.js / PixiJS…]
RULES (all required)
1. ONE HTML file, no <html>/<head> needed. The GAME is everything that is not marked. The SETUP part (the minigame's own admin/backend, shown in the editor under the game, NEVER exported with the game) is every element with the attribute data-verb-admin: <style data-verb-admin>, <section data-verb-admin>, <script data-verb-admin>. The two parts never see each other: share data only through VERB.config. Setup is optional, but write one whenever there is something to prepare.
2. Start everything inside VERB.onReady(function () { … }). Call VERB.win(score?) when the player wins (REQUIRED) and VERB.lose() if it can be lost; let the win/lose animation play ~1 s before calling it.
3. EDGE TO EDGE: the game fills its frame. No page background, no card/container/box around it, no title or header, no page margins or padding; html and body stay transparent (VERB paints THE background behind: VERB.background). Your HUD (score, tries, lives, timer) goes inside the game area. Size with vmin / % or VERB.size + VERB.onResize: the frame can be any size.
4. IT MUST LOOK AND FEEL LIKE A GAME, not a web page: tactile buttons with relief that press down, glass screens, glow, smooth animations for success, error (shake) and victory, synthesized sounds with WebAudio (no audio files), mouse + touch + keyboard. Never system-looking form controls in the game part. On a phone (VERB.device.touch, VERB.device.class) everything must work with a finger: big targets, nothing that needs hover or a key. A keyboard-only game gets an on-screen d-pad, stick or buttons from VERB (the minigame's touchControls, which press keys inside the page); set VERB.handlesTouch = true when your page already has its own touch controls.
5. NO INTERNET in the game part: no CDN, no Google Fonts, no external images, no fetch/XHR/WebSocket. Your own CSS, system fonts, inline SVG/canvas, emoji. Images come from the project: their asset ids live in VERB.config and you load them with VERB.asset(id) or VERB.loadImage(id). The only libraries allowed are the ones VERB ships (write their CDN address exactly like this and VERB embeds its own copy, offline):
- Three.js 0.160: <script src="https://cdn.jsdelivr.net/npm/three@0.160.1/build/three.min.js"></script>
- Three.js r128: <script src="https://cdn.jsdelivr.net/npm/three@0.128.0/build/three.min.js"></script>
- Phaser 3: <script src="https://cdn.jsdelivr.net/npm/phaser@3.90.0/dist/phaser.min.js"></script>
- p5.js 1: <script src="https://cdn.jsdelivr.net/npm/p5@1.11.13/lib/p5.min.js"></script>
- PixiJS 8: <script src="https://cdn.jsdelivr.net/npm/pixi.js@8/dist/pixi.min.js"></script>
- Matter.js 0.20: <script src="https://cdn.jsdelivr.net/npm/matter-js@0.20.0/build/matter.min.js"></script>
- GSAP 3: <script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
- Howler 2: <script src="https://cdn.jsdelivr.net/npm/howler@2.2.4/dist/howler.min.js"></script>
- jQuery 3: <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
The Setup part may use those libraries too (for example a 3D view of the solution).
6. CONFIG = what is prepared in Setup (the code, the solved layout, the start layout, piece images, difficulty…). Declare it with VERB.defineConfig({ key: { type, default, label, min, max, options } }) in the game part (defaults + the automatic form + the AI agent know it); pass { form: false } when your own Setup edits it. Setup changes it with VERB.setConfig(patch) (undoable; the game preview gets VERB.onConfig or restarts). PARAMS are different: values a hotspot or a Logic block sends each time it is played (VERB.params), e.g. a code that depends on the player.
7. IMAGES: in Setup, VERB.pickImage({ for: 'piece 3' }) lets the user choose from Assets or upload from disk (stored in Assets, folder Minigames/<name>) and resolves to the asset id; VERB.pickImage({ slice: { cols: 3, rows: 3 } }) cuts one image into pieces and resolves to their ids (row by row). Save ids in config. Background: VERB.setBackground(colour | assetId | null) changes THE background (the same one the editor changes): never paint another one.
SOUNDS: make every sound replaceable, like the images. Keep config.sounds = { key: id, wrong: id, win: id… } (one asset id per moment of the game: pressing a key, a miss, unlocking, winning, losing…); play it with VERB.sound(id) and fall back to your own synthesized sound when a slot is empty. In Setup, list those moments with a button each that calls VERB.pickSound({ for: 'On a miss' }) (Assets or upload from disk), a ▶ that plays it with VERB.sound(id) and a Remove. The same goes for anything else the user may want to change: images (VERB.pickImage), colours, the on-screen texts.
8. LINES the characters say: in Setup VERB.texts.define({ wrong: 'That is not it' }) creates translatable project texts; the game says them with VERB.say('', 'wrong') ('' = the protagonist) or VERB.narrate('wrong'). ON-SCREEN TEXTS of the game (titles, HUD, messages): declare them ALL with var T = VERB.defineLabels({ es: { win: '¡Abierto!' }, en: { win: 'Open!' } }) and show T.win; VERB paints a Texts card in Setup where the user changes them in any language (empty = yours). Write at least Spanish and English. The Setup part's own labels: a { es: …, en: … } dictionary chosen by VERB.lang (the editor language).
9. TEST HOOKS (required): VERB.test.solve = function () { …plays the perfect moves and ends calling VERB.win()… }; VERB.test.state = function () { return { …JSON state… }; }. The AI agent and the tests use them to prove the minigame can be won.
10. Outputs: VERB.set('name', value) stores a minigame variable; the ones listed as outputs go back to the game with the result.
11. Return ONLY the complete HTML, with no explanations and no Markdown code fences.
THE API (TypeScript: window.VERB is loaded before your code)
/**
* VERB minigame SDK (`window.VERB`), version 2.
*
* A VERB minigame is ONE HTML file. It runs in a sandboxed iframe with no network and talks to VERB only through `window.VERB`, which is
* already loaded before your scripts run. Mark the "Setup" part (the minigame's own admin/backend, shown only in the editor under the
* game and NEVER exported) with the attribute `data-verb-admin` on any element: `<section data-verb-admin>`, `<script data-verb-admin>`,
* `<style data-verb-admin>`. Everything else is the game.
*
* The same page code runs twice in the editor: once as the game (`VERB.mode === 'play'`, only the unmarked part) and once as Setup
* (`VERB.mode === 'admin'`, only the marked part). In the exported game and in Play only `play` exists.
*/
type Json = string | number | boolean | null | Json[] | { [k: string]: Json };
type Value = string | number | boolean;
type Localized = string | Record<string, string>;
interface VerbConfigField {
/** `sound`: an audio asset id (the form lets the user choose or upload one). `list`: any JSON value (a list or an object). */
type: 'text' | 'number' | 'boolean' | 'select' | 'color' | 'image' | 'images' | 'sound' | 'list';
/** Label for the automatic form (a string or `{ es, en }`). */
label?: Localized;
/** Value used while the setting is not set. */
default?: Json;
min?: number;
max?: number;
step?: number;
/** `select`: the options (value or `{ value, label }`). */
options?: (string | number | { value: string | number; label?: Localized })[];
hint?: Localized;
}
interface VerbConfig {
[key: string]: any;
/** Same as `VERB.setConfig(patch)` (Setup only). Not enumerable. */
set(patch: Record<string, Json | undefined>): void;
}
interface VerbTestHooks {
/** Wins the minigame as a perfect player would (call VERB.win inside). Used by the AI agent and the tests to prove it can be won. */
solve?: () => unknown | Promise<unknown>;
/** A JSON snapshot of the current state (for the agent and the tests). */
state?: () => Json;
[op: string]: ((...args: any[]) => unknown) | undefined;
}
interface Verb {
/** SDK version (2). */
readonly version: number;
/** `'play'`: the game. `'admin'`: the Setup part (editor only). */
readonly mode: 'play' | 'admin';
/** True inside the editor (game preview or Setup), false in the real game. */
readonly editor: boolean;
/** True once `onReady` has fired. */
readonly ready: boolean;
/** Launch parameters (declared in the minigame's `params`; a hotspot or a Logic block may change them each time). */
readonly params: Record<string, Value>;
/** The minigame's own variables (`set`/`get`). The ones listed in `outputs` go back to the game. */
readonly vars: Record<string, Value>;
/** Item ids the player carries. */
readonly items: string[];
/** Language code: the game language in `play`, the editor language in `admin`. */
readonly lang: string;
/** What was prepared in Setup (saved with the project), with the defaults of `defineConfig` filled in. */
readonly config: VerbConfig;
/** The single background: a colour or an image asset id, painted by VERB behind the frame (keep your page transparent). */
readonly background: string | null;
/** Size of the frame in px (CSS pixels of the iframe). */
readonly size: { width: number; height: number };
/**
* The player's device. `touch`: played with a finger (or simulated in the editor); `class`: `phone`, `tablet` or `desktop`;
* `portrait`: the game screen is taller than wide; `width`/`height`: the game screen in CSS px. Updated before `onResize` fires.
* Use it to make targets bigger or to show your own on-screen buttons on a phone.
*/
readonly device: { touch: boolean; input: 'mouse' | 'touch' | 'keyboard' | 'gamepad'; portrait: boolean; width: number; height: number; class: 'phone' | 'tablet' | 'desktop' };
/**
* Set `VERB.handlesTouch = true` if your page already plays well with a finger (its own buttons, tap or drag): VERB then hides the
* minigame's on-screen touch controls (`touchControls`: d-pad, stick or buttons that press keys inside your page for keyboard games).
*/
handlesTouch: boolean;
/** Test hooks the game sets: `VERB.test.solve = () => { …; VERB.win(); }`, `VERB.test.state = () => ({…})`. */
test: VerbTestHooks;
/** Runs `fn` once the SDK has its data (params, config, lang…). Start your game inside it. */
onReady(fn: () => void): void;
/** End the minigame. REQUIRED: the game must call `win` somewhere. `score` is optional. */
win(score?: number): void;
lose(): void;
cancel(): void;
/** A line said by a character (project character id; '' = the protagonist), painted by the game with its voice and colour. `text` is a text name from `texts.define` or a project text key. */
say(character: string, text: string): void;
narrate(text: string): void;
/**
* Plays a project sound asset (an id from `config`, chosen with `pickSound`). Make every sound replaceable: keep `config.sounds` =
* `{ key: id, ok: id, fail: id, win: id… }` and fall back to your own synthesized sound when a slot is empty. In Setup it plays as a preview.
*/
sound(assetId: string): void;
/** Gives a project item (real item id). */
giveItem(itemId: string): void;
hasItem(itemId: string): boolean;
set(name: string, value: Value): void;
get(name: string): Value | undefined;
/** Translated text (a name from `texts.define` or a project text key) in the current language. */
t(text: string): Promise<string>;
/** A `data:` URL for a project asset (an image id from `config`, `pickImage`…). '' if it does not exist. */
asset(assetId: string): Promise<string>;
/** `asset` + a loaded `HTMLImageElement`. */
loadImage(assetId: string): Promise<HTMLImageElement>;
onPause(fn: () => void): void;
onResume(fn: () => void): void;
/** Called when the config changes while the game is shown in the editor. Without it, the editor restarts the game instead. */
onConfig(fn: (config: VerbConfig) => void): void;
onBackground(fn: (background: string | null) => void): void;
/** Runs `fn` when the frame changes size or the device changes (`VERB.device`, e.g. the phone is turned). */
onResize(fn: (size: { width: number; height: number }) => void): void;
/** Vibrates the device (if it can). */
vibrate(ms?: number): void;
/** Shakes the minigame frame (power in px, duration in ms). */
shake(power?: number, ms?: number): void;
/**
* Declares the settings: VERB paints a form for them in Setup (above your own Setup part, if any) and the AI agent knows them. Fills the
* `config` defaults. Call it from the game part (and from Setup if it needs the defaults too). `{ form: false }`: declare them for the
* defaults and the agent, but do not paint the automatic form (your own Setup part edits them).
*/
defineConfig(schema: Record<string, VerbConfigField>, opts?: { form?: boolean }): VerbConfig;
/**
* Declares the on-screen texts of the game, in every language you write: `{ es: { win: '¡Abierto!' }, en: { win: 'Open!' } }`. Returns
* an object with each text in the game language, taking first what the user wrote in Setup (config.labels[lang][name]; VERB paints a
* Texts card for it, where any supported language can be added), then yours (that language, its short form, English, the first one).
* Use it for EVERY text the game shows. Call it from the game part (in Setup it only resolves, it does not paint the card).
*/
defineLabels(texts: Record<string, Record<string, string>>): Record<string, string>;
/** One on-screen text resolved now (same rules as defineLabels). */
label(name: string): string;
// ── Setup only (`mode === 'admin'`); in the game they do nothing ──
/** Merges a patch into the saved config (null deletes a key). Undoable in the editor; the game preview gets it (onConfig or restart). */
setConfig(patch: Record<string, Json | undefined>): void;
/** Opens "Choose from Assets" / "Upload from disk". Uploads go to Assets, folder Minigames/<name>. Returns the asset id (null if cancelled). With `slice`, VERB cuts the image into cols×rows pieces and returns their ids (row by row). */
pickImage(opts?: { for?: string; slice?: { cols: number; rows: number } }): Promise<string | string[] | null>;
/** Opens "Choose from Assets" / "Upload from disk" for a SOUND (uploads go to Assets, folder Minigames/<name>). Returns the audio asset id (null if cancelled). Store it in config (e.g. `config.sounds.win`). */
pickSound(opts?: { for?: string }): Promise<string | null>;
/** Changes THE background (colour, image asset id or null): the same one the editor changes. */
setBackground(value: string | null): void;
preview: {
/** Restarts the game preview above. */
restart(): void;
};
texts: {
/** Creates (or updates) translatable project texts for the minigame's lines: `{ wrong: 'That is not it' }` → use `VERB.say('', 'wrong')`. Resolves to name → project key. */
define(texts: Record<string, string>): Promise<Record<string, string>>;
};
/** A short message in the editor. */
toast(text: string): void;
}
declare const VERB: Verb;
interface Window {
VERB: Verb;
}
Write it yourself
A minigame is one HTML file (no <html> or <head> needed). The game is everything unmarked; Setup is every element with the data-verb-admin attribute:
<style>
html, body { margin: 0; height: 100%; background: transparent; }
.stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.go { font: 800 6vmin system-ui; padding: 3vmin 7vmin; border: 0; border-radius: 3vmin; color: #fff;
background: linear-gradient(#22c55e, #15803d); box-shadow: 0 1vmin 0 #0b3b1d; }
.go:active { transform: translateY(.8vmin); box-shadow: 0 .2vmin 0 #0b3b1d; }
</style>
<div class="stage"><button class="go" id="go"></button></div>
<script>
VERB.onReady(function () {
VERB.defineConfig({ taps: { type: 'number', default: 3, min: 1, max: 20, label: { es: 'Toques', en: 'Taps' } } });
var left = VERB.config.taps, b = document.getElementById('go');
function paint() { b.textContent = (VERB.lang === 'es' ? '¡Pulsa! ' : 'Tap! ') + left; }
b.onclick = function () { left--; paint(); if (left <= 0) VERB.win(); };
VERB.test.solve = function () { while (left > 0) b.onclick(); };
VERB.test.state = function () { return { left: left }; };
paint();
});
</script>
<section data-verb-admin>
<button id="easy">Easy (1 tap)</button>
</section>
<script data-verb-admin>
VERB.onReady(function () {
document.getElementById('easy').onclick = function () { VERB.setConfig({ taps: 1 }); };
});
</script>When saved, VERB splits it in two: the game (the only thing exported) and Setup (editor only). In Code it is shown again as one file. The two parts do not see each other: they share data only through VERB.config.
Three levels, from less to more work:
- Just the game, with
VERB.params(what each hotspot sends). - Declared settings:
VERB.defineConfig({...})and VERB paints a form in Setup (and the agent knows which settings there are). - Your own Setup, with
data-verb-admin, with whatever you want (views, editors, 3D views…). It can live together with the form: the form on top and yours below. If your Setup already edits those settings, declare them with{ form: false }.
The rules that make it look and work right:
- Edge to edge: the game fills its whole frame. No page background, no card or container around it, no title or header, no margins;
htmlandbodytransparent. VERB paints the background (VERB.background). The HUD (score, tries, lives) does go inside the game. Size withvmin/%or withVERB.sizeandVERB.onResize. - Make it feel like a game, not a web page: buttons with relief that press down, glass screens, glow, animations for success, error and victory, sounds synthesized with WebAudio, mouse, touch and keyboard.
- No internet: the exported game must work offline. No CDN, Google Fonts, external images or
fetch; images come from the project (VERB.asset) and libraries are the ones VERB ships. The game's security policy blocks everything else. Setup only lives in the editor and may load from the trusted CDNs, but better not. - Make everything changeable: what the game shows or plays (images, the sound of each moment —pressing a key, a miss, unlocking, winning—, the on-screen texts with
VERB.defineLabels, colours) lives in the setup and is changed in Setup. Sounds go inconfig.sounds(one id per moment) withVERB.pickSound; if a slot is empty, the game uses its default sound. - Test hooks:
VERB.test.solve(wins as a perfect player would) andVERB.test.state(its state). Check it can be won and the AI agent use them. VERB.onReadybefore starting, andVERB.win()on winning (leave ~1 s of animation before calling it).
The API
Everything the code sees as window.VERB. In the game, VERB.mode is 'play'; in Setup, 'admin'.
For the game (and Setup):
| Call | What it does |
|---|---|
VERB.onReady(fn) | Runs fn when the SDK has its data (start there). |
VERB.mode · VERB.editor · VERB.lang | The part (play / admin), whether it runs in the editor, and the language (the game's; in Setup, the editor's). |
VERB.config · VERB.onConfig(fn) | What was prepared (with the defineConfig defaults) and a notice of changes in the editor (without it, the editor restarts the game). |
VERB.params | The launch parameters (each hotspot or a Logic block can change them). |
VERB.win(score?) · VERB.lose() · VERB.cancel() | End the minigame. |
VERB.say(character, line) · VERB.narrate(line) | A line painted by the game engine ('' = the protagonist). line is a name from texts.define or a Texts key. |
VERB.t(line) | The translated line (a promise). |
VERB.sound(asset) · VERB.giveItem(item) · VERB.hasItem(item) · VERB.items | Plays a project sound (in Setup, to listen to it), give an item, know whether it is carried. |
VERB.set(name, value) · VERB.get(name) · VERB.vars | Variables; the ones marked as outputs go back to the game. |
VERB.asset(id) · VERB.loadImage(id) | A project asset as data: or as a loaded image. |
VERB.background · VERB.onBackground(fn) | The single background (colour or asset). |
VERB.size · VERB.onResize(fn) | The frame size (onResize also fires when the device changes, e.g. when the phone is turned). |
VERB.device | The device: touch (played with a finger), class (phone, tablet or desktop), portrait and the size of the game screen. See On mobile. |
VERB.handlesTouch = true | The page already plays with a finger: VERB does not put its touch controls over it. |
VERB.vibrate(ms) · VERB.shake(power, ms) | Vibrate the device and shake the frame. |
VERB.onPause(fn) · VERB.onResume(fn) | Pause and resume. |
VERB.defineLabels({ es: {…}, en: {…} }) · VERB.label(name) | Declares the on-screen texts in their languages and returns them in the game's, with what was changed in Setup on top (VERB paints the Texts card). |
VERB.defineConfig(settings, { form? }) | Declares the settings (automatic form). Types: text, number, boolean, select, color, image, images, sound, list (any JSON). |
VERB.test.solve · VERB.test.state | The test hooks the game sets. |
Setup only (in the game they do nothing):
| Call | What it does |
|---|---|
VERB.setConfig(changes) (or VERB.config.set) | Saves into the setup; null deletes a key. Undoable. |
VERB.pickImage({ for, slice }) | Opens Choose from Assets / Upload from disk; uploads go to Assets, folder Minigames/‹name›. Returns the id; with slice: { cols, rows } it cuts the image and returns the piece ids, row by row. |
VERB.pickSound({ for }) | The same for a sound: returns the audio asset id. |
VERB.setBackground(colour | id | null) | Changes the background (the same as the sheet). |
VERB.texts.define({ name: 'line' }) | Creates project texts, translatable in Texts, for the minigame's lines. |
VERB.preview.restart() | Restarts the game above. |
VERB.toast(text) | A notice in the editor. |
The complete types (the AI reads them too):
/**
* VERB minigame SDK (`window.VERB`), version 2.
*
* A VERB minigame is ONE HTML file. It runs in a sandboxed iframe with no network and talks to VERB only through `window.VERB`, which is
* already loaded before your scripts run. Mark the "Setup" part (the minigame's own admin/backend, shown only in the editor under the
* game and NEVER exported) with the attribute `data-verb-admin` on any element: `<section data-verb-admin>`, `<script data-verb-admin>`,
* `<style data-verb-admin>`. Everything else is the game.
*
* The same page code runs twice in the editor: once as the game (`VERB.mode === 'play'`, only the unmarked part) and once as Setup
* (`VERB.mode === 'admin'`, only the marked part). In the exported game and in Play only `play` exists.
*/
type Json = string | number | boolean | null | Json[] | { [k: string]: Json };
type Value = string | number | boolean;
type Localized = string | Record<string, string>;
interface VerbConfigField {
/** `sound`: an audio asset id (the form lets the user choose or upload one). `list`: any JSON value (a list or an object). */
type: 'text' | 'number' | 'boolean' | 'select' | 'color' | 'image' | 'images' | 'sound' | 'list';
/** Label for the automatic form (a string or `{ es, en }`). */
label?: Localized;
/** Value used while the setting is not set. */
default?: Json;
min?: number;
max?: number;
step?: number;
/** `select`: the options (value or `{ value, label }`). */
options?: (string | number | { value: string | number; label?: Localized })[];
hint?: Localized;
}
interface VerbConfig {
[key: string]: any;
/** Same as `VERB.setConfig(patch)` (Setup only). Not enumerable. */
set(patch: Record<string, Json | undefined>): void;
}
interface VerbTestHooks {
/** Wins the minigame as a perfect player would (call VERB.win inside). Used by the AI agent and the tests to prove it can be won. */
solve?: () => unknown | Promise<unknown>;
/** A JSON snapshot of the current state (for the agent and the tests). */
state?: () => Json;
[op: string]: ((...args: any[]) => unknown) | undefined;
}
interface Verb {
/** SDK version (2). */
readonly version: number;
/** `'play'`: the game. `'admin'`: the Setup part (editor only). */
readonly mode: 'play' | 'admin';
/** True inside the editor (game preview or Setup), false in the real game. */
readonly editor: boolean;
/** True once `onReady` has fired. */
readonly ready: boolean;
/** Launch parameters (declared in the minigame's `params`; a hotspot or a Logic block may change them each time). */
readonly params: Record<string, Value>;
/** The minigame's own variables (`set`/`get`). The ones listed in `outputs` go back to the game. */
readonly vars: Record<string, Value>;
/** Item ids the player carries. */
readonly items: string[];
/** Language code: the game language in `play`, the editor language in `admin`. */
readonly lang: string;
/** What was prepared in Setup (saved with the project), with the defaults of `defineConfig` filled in. */
readonly config: VerbConfig;
/** The single background: a colour or an image asset id, painted by VERB behind the frame (keep your page transparent). */
readonly background: string | null;
/** Size of the frame in px (CSS pixels of the iframe). */
readonly size: { width: number; height: number };
/**
* The player's device. `touch`: played with a finger (or simulated in the editor); `class`: `phone`, `tablet` or `desktop`;
* `portrait`: the game screen is taller than wide; `width`/`height`: the game screen in CSS px. Updated before `onResize` fires.
* Use it to make targets bigger or to show your own on-screen buttons on a phone.
*/
readonly device: { touch: boolean; input: 'mouse' | 'touch' | 'keyboard' | 'gamepad'; portrait: boolean; width: number; height: number; class: 'phone' | 'tablet' | 'desktop' };
/**
* Set `VERB.handlesTouch = true` if your page already plays well with a finger (its own buttons, tap or drag): VERB then hides the
* minigame's on-screen touch controls (`touchControls`: d-pad, stick or buttons that press keys inside your page for keyboard games).
*/
handlesTouch: boolean;
/** Test hooks the game sets: `VERB.test.solve = () => { …; VERB.win(); }`, `VERB.test.state = () => ({…})`. */
test: VerbTestHooks;
/** Runs `fn` once the SDK has its data (params, config, lang…). Start your game inside it. */
onReady(fn: () => void): void;
/** End the minigame. REQUIRED: the game must call `win` somewhere. `score` is optional. */
win(score?: number): void;
lose(): void;
cancel(): void;
/** A line said by a character (project character id; '' = the protagonist), painted by the game with its voice and colour. `text` is a text name from `texts.define` or a project text key. */
say(character: string, text: string): void;
narrate(text: string): void;
/**
* Plays a project sound asset (an id from `config`, chosen with `pickSound`). Make every sound replaceable: keep `config.sounds` =
* `{ key: id, ok: id, fail: id, win: id… }` and fall back to your own synthesized sound when a slot is empty. In Setup it plays as a preview.
*/
sound(assetId: string): void;
/** Gives a project item (real item id). */
giveItem(itemId: string): void;
hasItem(itemId: string): boolean;
set(name: string, value: Value): void;
get(name: string): Value | undefined;
/** Translated text (a name from `texts.define` or a project text key) in the current language. */
t(text: string): Promise<string>;
/** A `data:` URL for a project asset (an image id from `config`, `pickImage`…). '' if it does not exist. */
asset(assetId: string): Promise<string>;
/** `asset` + a loaded `HTMLImageElement`. */
loadImage(assetId: string): Promise<HTMLImageElement>;
onPause(fn: () => void): void;
onResume(fn: () => void): void;
/** Called when the config changes while the game is shown in the editor. Without it, the editor restarts the game instead. */
onConfig(fn: (config: VerbConfig) => void): void;
onBackground(fn: (background: string | null) => void): void;
/** Runs `fn` when the frame changes size or the device changes (`VERB.device`, e.g. the phone is turned). */
onResize(fn: (size: { width: number; height: number }) => void): void;
/** Vibrates the device (if it can). */
vibrate(ms?: number): void;
/** Shakes the minigame frame (power in px, duration in ms). */
shake(power?: number, ms?: number): void;
/**
* Declares the settings: VERB paints a form for them in Setup (above your own Setup part, if any) and the AI agent knows them. Fills the
* `config` defaults. Call it from the game part (and from Setup if it needs the defaults too). `{ form: false }`: declare them for the
* defaults and the agent, but do not paint the automatic form (your own Setup part edits them).
*/
defineConfig(schema: Record<string, VerbConfigField>, opts?: { form?: boolean }): VerbConfig;
/**
* Declares the on-screen texts of the game, in every language you write: `{ es: { win: '¡Abierto!' }, en: { win: 'Open!' } }`. Returns
* an object with each text in the game language, taking first what the user wrote in Setup (config.labels[lang][name]; VERB paints a
* Texts card for it, where any supported language can be added), then yours (that language, its short form, English, the first one).
* Use it for EVERY text the game shows. Call it from the game part (in Setup it only resolves, it does not paint the card).
*/
defineLabels(texts: Record<string, Record<string, string>>): Record<string, string>;
/** One on-screen text resolved now (same rules as defineLabels). */
label(name: string): string;
// ── Setup only (`mode === 'admin'`); in the game they do nothing ──
/** Merges a patch into the saved config (null deletes a key). Undoable in the editor; the game preview gets it (onConfig or restart). */
setConfig(patch: Record<string, Json | undefined>): void;
/** Opens "Choose from Assets" / "Upload from disk". Uploads go to Assets, folder Minigames/<name>. Returns the asset id (null if cancelled). With `slice`, VERB cuts the image into cols×rows pieces and returns their ids (row by row). */
pickImage(opts?: { for?: string; slice?: { cols: number; rows: number } }): Promise<string | string[] | null>;
/** Opens "Choose from Assets" / "Upload from disk" for a SOUND (uploads go to Assets, folder Minigames/<name>). Returns the audio asset id (null if cancelled). Store it in config (e.g. `config.sounds.win`). */
pickSound(opts?: { for?: string }): Promise<string | null>;
/** Changes THE background (colour, image asset id or null): the same one the editor changes. */
setBackground(value: string | null): void;
preview: {
/** Restarts the game preview above. */
restart(): void;
};
texts: {
/** Creates (or updates) translatable project texts for the minigame's lines: `{ wrong: 'That is not it' }` → use `VERB.say('', 'wrong')`. Resolves to name → project key. */
define(texts: Record<string, string>): Promise<Record<string, string>>;
};
/** A short message in the editor. */
toast(text: string): void;
}
declare const VERB: Verb;
interface Window {
VERB: Verb;
}Libraries VERB ships
3D minigames and other engines are fine. Write their CDN address as is and VERB embeds its own copy inside the minigame, also in the exported game (offline). While the browser reads a big library, the minigame shows a loading wheel.
| Library | Address |
|---|---|
| Three.js 0.160 | https://cdn.jsdelivr.net/npm/three@0.160.1/build/three.min.js |
| Three.js r128 | https://cdn.jsdelivr.net/npm/three@0.128.0/build/three.min.js |
| Phaser 3 | https://cdn.jsdelivr.net/npm/phaser@3.90.0/dist/phaser.min.js |
| p5.js 1 | https://cdn.jsdelivr.net/npm/p5@1.11.13/lib/p5.min.js |
| PixiJS 8 (and 7) | https://cdn.jsdelivr.net/npm/pixi.js@8/dist/pixi.min.js |
| Matter.js 0.20 | https://cdn.jsdelivr.net/npm/matter-js@0.20.0/build/matter.min.js |
| GSAP 3 | https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js |
| Howler.js 2 | https://cdn.jsdelivr.net/npm/howler@2.2.4/dist/howler.min.js |
| jQuery 3 | https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js |
The cdnjs and unpkg addresses of those same libraries work too. Three.js needs the exact version (it changes from one version to the next). A 3D minigame can have its Setup like any other, and Setup can use these libraries too (for example a 3D view of the solution).
Texts and languages
On-screen texts
What the game shows (titles, HUD, messages like "OPEN!") is declared by the HTML with VERB.defineLabels, in the languages it brings (the templates, Spanish and English). With that, Setup shows by itself, under the game's own part, the On-screen texts card:
- One tab per language: the ones the HTML brings and the ones you add. + Add a language… offers any of VERB's (French, German, Italian, Portuguese, Catalan, Galician, Basque, Dutch, Polish, Russian, Turkish, Japanese, Korean, Chinese) and your project's.
- One box per text. Empty = the default text (the HTML's in that language or, if it does not bring it, English). Back to the defaults empties them all and Remove this language removes an added one.
- In the game, each text shows in the game's language: yours if you wrote it, otherwise the HTML's.
It is saved with the project (config.labels), undoable, and the AI agent does it with minigame_labels.
Lines and labels
- Your Setup's own labels are chosen by its HTML according to
VERB.lang(the editor language). - What characters say are project texts: they are created with
VERB.texts.define(or the agent'sminigame_textstool), translated in Texts with the rest and painted by the game engine with their voice and language.
Play, import and export
- Check it can be won (in the studio) plays the minigame with its
VERB.test.solve; Play plays it by hand in a box and says the result it would return. - Export .verbmini saves the minigame (game, Setup and setup values) with its lines to take it to another project; Import .verbmini brings it with a new id. Export .html and Import .html carry the whole HTML.
- When exporting the game, only the game of each minigame goes: its Setup stays in the editor, however it is exported (zip,
.verbgame, Publish on the web).
On mobile
A minigame played by tapping (buttons, pieces, dragging) works the same with a finger: the seven templates, for example. One played with the keyboard (arrows, Space) needs on-screen controls:
- Touch controls, in the minigame's sheet: D-pad (four directions and the diagonals), Stick (the same, with a knob that follows the finger) or Buttons only. The directions press the arrows or W A S D, and you can add up to four buttons, each with its text and key (
Space,Enter,Escape, a letter or a digit). - They show only when playing with a finger (or with the Mobile plugin set to "Always"), over the minigame: the d-pad bottom left and the buttons bottom right, finger-sized. They press keys inside the page, with
key,codeandkeyCode, so Phaser, p5, Three.js and hand-written code get them as if they came from the keyboard. - With a finger, the header and Give up also grow to finger size.
- To test it in the editor, use Play with the Device selector on a phone or a tablet.
- From code:
VERB.devicesays whether it is played with a finger and on what screen (to make targets bigger on a phone, for example), andVERB.handlesTouch = trueremoves the controls when the page already has its own touch controls. - With the Mobile plugin on, Diagnostics warns about minigames that only listen to keys and have no touch controls.
The checks know about it
- The solvability checker and test walkthroughs count what winning a minigame gives (an item, a variable, a script, a scene, an object state and what it turns on or makes appear). A minigame is assumed winnable (whether it really is gets checked by Check it can be won and the agent's
minigame_test). - Diagnostics warns if a hotspot's minigame no longer exists or a result uses something deleted, and Texts shows the "If won / lost / given up" lines and the minigame's lines with where they are.
- Test walkthroughs have the steps "Play the minigame X", "Win", "Lose" and "Cancel the minigame X".
With the AI agent
The AI agent can do and read everything done in the interface, and knows how to write a whole minigame (game and Setup) with the API:
| Tool | What it does |
|---|---|
get_minigame_guide | The guide: the two parts, the rules, the whole API, the levels and the workflow. |
minigame_prompt | The prompt above, to give it to another AI. |
minigame_templates · minigame_from_template | The templates, and creating one with its setup (config). |
minigame_list · minigame_read | Lists the minigames and reads one: the whole HTML (or just the game, or just Setup), the setup and its lines. |
minigame_write | Creates or changes a minigame from its HTML (both parts together or separately), its setup, parameters, outputs, presentation, lines and touch controls (touchControls). |
minigame_config | Reads or changes the setup without touching the HTML. |
minigame_texts | The minigame's lines (project texts). |
minigame_image | Puts an image in its Assets folder (from an asset or a data: URL), cut into pieces if asked, and stores it in the setup or as the background. |
minigame_labels | Reads the on-screen texts (the HTML's and the changed ones) and writes them per language, also in languages the HTML does not bring. |
minigame_sound | Puts a sound (from an asset or a data: URL) into its config.sounds slot (key, wrong, unlock, win…) or removes it. |
minigame_background | The single background. |
minigame_check | Checks the HTML and runs it hidden: errors, declared settings and whether it has VERB.test. |
minigame_test | Plays it with VERB.test.solve and says whether it wins (minigame_solve does the same). |
minigame_link | Connects it to a hotspot or object and says what happens on winning, losing or giving up. |
minigame_open | Opens it in the studio. |
minigame_export · minigame_import | .verbmini package. |
minigame_delete | Deletes it. |