The manifest (juego.json)
Every property of juego.json with a real example, and the rules for the id, cover, controls, difficulties, score tables and texts in two languages.
DescribesFormat 1, API 1 For those who write code
On this page
juego.json is the game's card: what it is called, who made it, what you play it with, which difficulties and score tables it has, and every text it shows. It sits at the root of the game's folder.
Every property is required except dificultadInicial, multijugador, autor.contacto and $schema. Unknown properties are not accepted: a misspelled key is a validator error, not something that gets ignored.
A real manifest#
This is the manifest of the template that greengames crear uses to build a new game (packages/toolkit/plantilla/juego.json in the Green Games repository). On creation, the tool replaces the id with the name you gave. It is a real file, quoted as it is: the keys of the format are in Spanish.
{
"$schema": "../../packages/sdk/esquemas/juego.schema.json",
"formato": 1,
"id": "plantilla",
"version": "0.1.0",
"nombre": { "es": "Mi juego", "en": "My game" },
"descripcion": {
"es": "Junta todas las monedas antes de que se acabe el tiempo. No pises la lava.",
"en": "Collect every coin before time runs out. Do not step on the lava."
},
"autor": { "nombre": "Tu nombre" },
"portada": "recursos/portada.svg",
"jugadores": { "min": 1, "max": 1 },
"controles": {
"teclado": true,
"tactil": true,
"mando": true,
"acciones": {
"saltar": { "es": "Saltar", "en": "Jump" }
}
},
"etiquetas": ["recoleccion"],
"dificultades": [
{ "id": "facil", "nombre": { "es": "Fácil", "en": "Easy" } },
{ "id": "normal", "nombre": { "es": "Normal", "en": "Normal" } },
{ "id": "dificil", "nombre": { "es": "Difícil", "en": "Hard" } }
],
"dificultadInicial": "normal",
"puntajes": [
{ "id": "puntos", "nombre": { "es": "Mejores puntajes", "en": "High scores" }, "orden": "mayor", "formato": "numero" }
],
"escenaInicial": "principal",
"script": "scripts/principal.ts",
"textos": {
"es": {
"objetivo": "¡Junta las {total} monedas!",
"monedas": "{n} de {total}",
"lava": "¡Lava! Pierdes {seg} segundos.",
"caida": "Te caíste. Vuelves al inicio.",
"ganaste": "Te sobraron {seg} segundos",
"perdiste": "Juntaste {n} de {total} monedas"
},
"en": {
"objetivo": "Collect all {total} coins!",
"monedas": "{n} of {total}",
"lava": "Lava! You lose {seg} seconds.",
"caida": "You fell. Back to the start.",
"ganaste": "You had {seg} seconds left",
"perdiste": "You collected {n} of {total} coins"
}
}
}Keys carry no accents and no ñ (descripcion, tactil, dificultades). The values the player reads do carry accents.
Properties#
| Property | Type | What it is |
|---|---|---|
$schema | text | Optional. Path to the JSON schema, so that your text editor completes and flags errors. |
formato | 1 | Format version. Always 1. |
id | text | The game's identifier. Lowercase letters, numbers and hyphens, up to 48 characters. Same as the name of the directory. |
version | text | The game's version: three numbers separated by dots, like "1.0.0". |
nombre | { es, en } | The game's name in both languages. Up to 240 characters each. |
descripcion | { es, en } | What you have to do, in one or two sentences. |
autor | { nombre, contacto? } | Who made it. nombre up to 80 characters; contacto is optional, up to 120. |
portada | text | Path to an image inside recursos/. |
jugadores | { min, max } | How many players the match accepts, from 1 to 16. With max greater than 1, the game player offers playing with bots. |
multijugador | { local?, enLinea? } | Optional. How the game is played by several people. See Multiplayer. |
controles | object | What you play it with (teclado, tactil, mando) and what each button does (acciones). |
etiquetas | list of texts | For the catalog: ["obstaculos", "carrera"]. Up to 8, no repeats. |
dificultades | list | Each one with an id and a nombre in two languages. Up to 5; it can be []. |
dificultadInicial | text | Optional. The id of the difficulty that shows up selected. |
puntajes | list | Local score tables. Up to 8; the first one is the main one. |
escenaInicial | text | The id of the scene the game starts with (the file escenas/<id>.json). |
script | text | Entry script inside scripts/, with the extension .ts or .js. |
textos | { es, en } | The game's texts, by key, in both languages. Up to 500 keys per language and 240 characters per text. |
Rules#
id and version#
- The
idhas only lowercase letters, numbers and hyphens (torre-de-cajas), and must be the same as the name of the game's directory. If it does not match, the validator flags it. - The launcher uses
idandversionto know whether a.ggxyou import is a new game or a newer version of one you already have.
Cover#
- An image with a 16:9 ratio inside
recursos/. - Formats: svg, png, webp or jpg. 2 MB at most.
- The path must exist in the folder: if the file is missing, the package is not built.
Multiplayer#
Without multijugador, the game is for one person (plus bots, if jugadores.max allows it). With it, the game declares how several people play. This is how the multiplayer template declares it (packages/toolkit/plantillas/multijugador/juego.json):
"jugadores": { "min": 1, "max": 8 },
"multijugador": {
"local": { "max": 4, "pantalla": "dividida" },
"enLinea": { "max": 8 }
},| Property | Values | What it means |
|---|---|---|
local.max | from 2 to 4 | How many people can play on the same computer, with no connection. The game's start screen lets you choose from 1 up to that number. |
local.pantalla | "dividida" or "compartida" | "dividida" (split, the default): one camera and one HUD per person; two halves with 2 players, four quarters with 3 or 4. "compartida" (shared): a single camera that follows the center of the group; choose a zoom or a distance that shows the whole arena. |
enLinea.max | from 2 to 16 | How many players a room over the internet would accept. |
enLinea.min | from 1 to 16 | Optional. |
- No
maxinmultijugadorcan be greater thanjugadores.max: the validator flags it with GB122. - Local multiplayer works in the portal, in launcher 0.4.0 and in editor 0.4.0. With gamepads, one per person; without enough gamepads, two people share the keyboard.
- The script needs nothing special for several people, but it must follow the usual rules: Several players.
Controls and actions#
teclado (keyboard), tactil (touch) and mando (gamepad) say what the game works with. The game player already translates all three into the same actions; declare all three as true unless your game really does not work with one of them (the validator warns if one is missing).
acciones says what each button does in this game. There are the three usual actions:
| Action | Usual use |
|---|---|
saltar | Jump. |
accion | The game's main action: open, call an elevator, build. |
accion2 | A second action. |
Version 1.1 of the contract adds two, declared the same way: primaria and secundaria, the pointer buttons (left and right click, the gamepad triggers, holding a finger down and a short tap). An open-world game uses them to break and place blocks, and they work for any other game. They do not work in a launcher or an editor earlier than 0.3.0.
Only the declared actions get a touch button and appear in the controls help. Moving and turning the camera always exist and are not declared. The text of each action is what the player reads in the controls table: write what the button does ("Call the elevator"), not its name.
Difficulties#
- The normal number is three:
facil,normalanddificil. With any other number, the validator warns. - Order matters. The script receives the index of the chosen difficulty in
juego.nivelDificultad: 0 for the first, 1 for the second, 2 for the third. With no difficulties it is -1, andjuego.dificultadis an empty string. dificultadInicialmust be one of the declaredidvalues.- The same
idvalues are used in the scenes to make a piece exist only on some difficulties.
Score tables#
Each table has an id, a nombre in two languages, an orden and a formato.
| Property | Values | What it means |
|---|---|---|
orden | "menor" or "mayor" | "menor": the lowest value wins (times). "mayor": the highest wins (points). |
formato | "tiempo" or "numero" | "tiempo": the value is in seconds and is shown as 1:23.45. "numero": it is shown as it is. |
The tables are local: they are saved on the computer of whoever plays. Each difficulty has its own list, with 10 entries. There are no global tables.
The script records a score by passing tabla to juego.terminar. A defeat does not enter the table. The details are in juego and puntajes.
Texts#
Every text the game shows lives in textos, by key, in Spanish and in English. The script asks for it with interfaz.t('clave', { variables }) and each game player shows it in the player's language.
- Keys start with a lowercase letter and use letters, numbers, period, hyphen or underscore.
- Variables are written between braces:
"monedas": "{n} de {total}". - Both lists must have the same keys and the same variables. If
eshas{seg}andendoes not, it is an error. - Do not build sentences by concatenating in the script. Put the whole sentence in the template and pass the values as variables.
Next#
- Scenes: the world the manifest names in
escenaInicial. - interfaz: how the script uses texts, the HUD and messages.
- The validator: the codes that check the manifest.