Skip to content
Docs pages

Developers · Reference

game.json

The game manifest reference — every field, its type, default and constraints, the valid categories and tags, and how to choose limits.

On this page

game.json describes your game to the portal: its name, description, classification, screen orientation, thumbnail, and the score limits the server uses against cheating. The file sits at the root of your game folder, next to the build folder. The operations team checks it with wsg validate before release; any field you leave out gets its default value.

Full example

JSONgame.json
{
  "slug": "flappy-demo",
  "version": "1.0.0",
  "title": "Flappy Demo",
  "description": {
    "vi": "Chạm để bay qua ống. Ống càng lúc càng hẹp.",
    "en": "Tap to fly through the pipes. Gaps get tighter."
  },
  "category": "arcade",
  "tags": ["flappy", "one-tap", "pixel", "tap"],
  "orientation": "portrait",
  "controls": ["tap", "keyboard"],
  "thumbnail": "./thumbnail.png",
  "cover": null,
  "sdk": { "major": 1 },
  "limits": {
    "maxScore": 9999,
    "maxScorePerSecond": 3,
    "minDurationMs": 1000,
    "scoreOrder": "desc"
  },
  "build": { "command": "pnpm build", "outDir": "dist" },
  "features": { "leaderboard": true, "rewarded": true, "interstitial": true, "storage": true },
  "minPlayers": 1,
  "maxPlayers": 1,
  "author": { "name": "WSG", "url": null },
  "generated": { "by": null, "pipelineRunId": null }
}

game.json is plain JSON: no comments and no trailing commas.

Fields

FieldTypeRequiredDefaultConstraints
slugstringYes—Matches ^_?[a-z0-9][a-z0-9-]{1,48}$: 2–49 lowercase letters, digits and hyphens, not starting with a hyphen. The _ prefix is reserved for internal games. Must equal the game folder name
versionstringYes—Semver MAJOR.MINOR.PATCH, suffixes such as 1.2.0-beta.1 allowed. Every release uses a new version
titlestringYes—1–80 characters. A single string, not per language
description{ vi, en }Yes—Both vi and en are required, 1–500 characters each
categorystringYes—One slug from the category table
tagsstring[]Yes—1–8 slugs from the tag table; repeated slugs get a warning
orientationstringYes—portrait, landscape or any
controlsstring[]Yes—At least one of tap, swipe, keyboard, mouse, gamepad
thumbnailstringYes—A relative path inside the game folder to a .png, .jpg, .jpeg or .webp image; 512×512, at most 150 KB
coverstring | nullNonullA relative path to a cover image, ideally 1200×630
sdk.majorintegerNo1≥ 1; the SDK major version the game uses
limitsobjectYes—See Choosing limits
build.commandstringNo"pnpm build"The build command, run inside the game folder
build.outDirstringNo"dist"The bundle folder, which must be inside the game folder; "." means no build step
featuresobjectNoall four trueleaderboard, rewarded, interstitial, storage as booleans
minPlayers, maxPlayersintegerNo1, 1≥ 1 and minPlayers ≤ maxPlayers
author.namestringNo"unknown"1–80 characters
author.urlstring | nullNonullA valid URL or null
generatedobjectNo{ "by": null, "pipelineRunId": null }Reserved for the automated game-generation pipeline; leave it null

Notes on some fields:

  • slug is your game's permanent identifier: the bundle path /<slug>/<version>/, the page https://leonogames.com/games/<slug> and the gameId passed to WSG.init(). Changing the slug creates a different game.
  • orientation sets the iframe frame on the portal: portrait keeps a 9:16 ratio at most as tall as the screen, landscape keeps 16:9, and any fills the play area. On phones the portal suggests rotating the device when the player holds it the wrong way.
  • thumbnail and cover are only used for listings and don't need to be in the bundle. On release the images are uploaded to https://games.leonogames.com/<slug>/media/ and the game.json sent to the API carries their real URLs. wsg validate can only read the dimensions of PNG images; other formats only get a warning.
  • features is only reflected through WSG.isAvailable(); the portal currently doesn't block calls based on these flags.
  • build: for a pre-built submission, set command to a no-op (for example "echo prebuilt") and point outDir at your build folder. See Submitting and publishing.

Categories

category takes exactly one value from this table:

SlugName
arcadeArcade
puzzlePuzzle
actionAction
casualCasual
sportsSports
racingRacing
strategyStrategy
card-boardCard & Board
kidsKids
io.io

Tags

tags takes 1–8 slugs from any of the kinds below. The controls field only accepts slugs of the controls kind. The swipe slug appears both as a mechanic and as a control, but it is a single value.

KindValid slugs
Genre (genre)endless-runner, flappy, match-3, merge, stack, snake, breakout, 2048, shooter, platformer, idle, quiz, word
Mechanic (mechanic)one-tap, timing, physics, drag-drop, swipe, aim, rhythm
Theme (theme)space, animals, food, pixel, neon, fantasy, sports
Controls (controls)tap, swipe, keyboard, mouse, gamepad

The taxonomy grows over time; if you need a new category or tag, suggest it to the operations team instead of picking an approximate value.

Choosing limits

The server uses limits to reject scores that can't be reached by real play. Too strict and skilled players get rejected unfairly; too loose and the leaderboard is easy to cheat. The full rules are on the Scores and leaderboards page.

FieldTypeMeaningRejection reason
maxScoreinteger, 0–2^53The highest score a single run can reachover_max
maxScorePerSecondnumber > 0The maximum scoring rate: score divided by seconds playedrate_too_high
minDurationMsinteger ≥ 0The minimum play time before a score can be submittedtoo_fast
scoreOrderdesc | ascdesc (default): higher is better; asc: lower is better, e.g. a time—

The server measures play time (elapsed) as the session's total gameplay time up to the moment the score arrives (every stretch from gameplayStart() to gameplayStop() added up, pauses excluded), with a minimum of 1 second. That is why a minDurationMs of 1000 or less can never cause too_fast (wsg validate warns when the value is below 1000).

The recommended method:

  1. Derive the maximum scoring rate from your design, not from human hands: item spawn rates, lockouts between two scoring actions, end-of-level bonuses. If your game lets players tap as fast as they like, add a cap inside the game.
  2. Multiply by 1.5 for headroom to get maxScorePerSecond.
  3. maxScore is the highest reachable score; for games without a ceiling (endless runners) estimate generously, since maxScorePerSecond already caps scores over time. Clamp the score in-game at maxScore so you never submit above it.
  4. minDurationMs is the fastest time in which a valid run can end, minus a few seconds for network delay.

Worked examples

Endless runner. +1 point per 300 ms survived (3.33 points per second) and +5 per coin; the game spawns at most one coin every 2 seconds (≤ 2.5 points per second). The maximum rate is 5.83 points per second; times 1.5 gives maxScorePerSecond: 9. The earliest possible death is around 4 seconds in, so choose minDurationMs: 3000. The score is clamped in-game at 5000, so maxScore: 5000.

Puzzle with an end-of-level bonus. Each matched pair is +10, every flip is locked for at least 750 ms, and clearing a level adds a bonus. A bot that knows every card clears level 1 with 148 points in 6.9 seconds, i.e. 21.4 points per second; set maxScorePerSecond: 25 (less than 1.5× headroom because that figure is already the absolute design limit). Note that a bonus landing at the end of a level is still divided by the whole play time.

Time trial (asc). The score must be the number of milliseconds taken to finish. The server doesn't use maxScorePerSecond for asc (it must still be positive, for example 1200); instead it checks that the score is not below minDurationMs and not shorter than the gameplay stretch the server measured by more than max(2 seconds, 10 %), see Time scores. minDurationMs is the fastest possible finish (for example 20000) and maxScore the slowest time you still want to record (for example 600000, i.e. 10 minutes).

JSONgame.json (excerpt)
{
  "limits": { "maxScore": 600000, "maxScorePerSecond": 1200, "minDurationMs": 20000, "scoreOrder": "asc" }
}

Validating game.json

The operations team (or you, if you have the repository) runs wsg validate on the game folder. It checks: valid JSON matching the schema; slug equals the folder name; category and tags exist in the taxonomy (duplicate tags only warn); the thumbnail image exists inside the game folder, has an allowed format, is at most 150 KB and exactly 512×512 if it is a PNG; cover ideally 1200×630 (warning only); build.outDir is inside the game folder; minPlayers ≤ maxPlayers; a minDurationMs below 1000 gives a warning. The CLI prints its messages in Vietnamese.

Valid result
$ pnpm wsg validate tap-rush
  OK    game.json hợp lệ: tap-rush@1.0.0 "Tap Rush"
  OK    thumbnail ./thumbnail.png 512×512, 3.6 KB

validate: OK (0 lỗi, 0 cảnh báo)
Result with errors
$ pnpm wsg validate tap-rush
  ERR   game.json version: version phải là semver, ví dụ 1.0.0
  ERR   game.json category: "shooter" không có trong category trong taxonomy (arcade, puzzle, action, casual, sports, racing, strategy, card-board, kids, io)

validate: FAIL (2 lỗi, 0 cảnh báo)