Developer docs

How to put an HTML5, WebGL or WASM game on Nekoland: the neko CLI, the nekogame.json config, the game SDK, multiplayer and game servers.

Get started

Overview

Nekoland is a web game platform. This page explains the runtime architecture and what the platform handles before you start building a game.

Runtime architecture and SDK

When you upload a build folder with the neko CLI, players open your game in a browser or the Nekoland apps with no install. The platform handles accounts, the cube currency, payments, cloud saves, friends, and chat.

Each game runs in an iframe with its own origin. The URL is https://{gameId}.games.nekoland.net/{version}/. The platform renders the header, dialogs, and loading screen outside the iframe.

The SDK is the only bridge between your game and the platform. It communicates with the host page using postMessage. The platform opens the purchase, top-up, login, and friend-picker dialogs outside the iframe, so a game cannot fake payment dialogs.

Payments

Players pay with cubes. 1 cube is $0.01. You price your products in cubes, and you do not need to integrate a payment provider.

Things to note

  • playerId is different in each game for the same person. This prevents games from tracking players across each other.
  • Nekoland has no leaderboards. If you need rankings, server-side currency, or multiplayer, host them on your own server. See Game servers for details.

Quick start

This guide covers installing the Nekoland command-line tool (CLI) to validate, test, deploy, and publish your game. Follow these steps when registering a new game or uploading a build to the platform.

Install the CLI and log in

You need Node.js 18.17 or later. Run all of the following commands from your game folder.

First, install the CLI. When it says a newer version exists, run the same install command again.

bash
npm i -g @launchercapital/nekoland-cli

After installation finishes, log in to your account.

bash
neko login

This command opens your browser and prints an 8-letter code (like BCDF-GHJK) in the terminal. Sign in through the browser, verify that the code matches, and click Allow.

If you cannot open a browser on this machine, run neko login --no-browser to get the URL and open it on another device.

Initialize your project and integrate the SDK

Run neko init to create your game configuration file, nekogame.json.

bash
neko init --id gem-rush --title "Gem Rush" --category casual --build dist

Pick a category from neko categories. The game ID becomes your game's address, so choose it carefully.

After configuring the project, see Installing the SDK to add the SDK to your game and call sdk.init(). Once integrated, build your game.

Validate and test locally

Before uploading your game, run neko validate to check only the config, build folder, and images.

bash
neko validate

Fix every error and warning reported by the check.

Next, run neko dev to test your game locally.

bash
neko dev

neko dev serves your build at http://localhost:8080 with a mock platform. You can test purchases and saves locally. For details, see Local testing.

Deploy a test version

After testing locally, run neko deploy to upload a test version.

bash
neko deploy

The test version is not public. Only you and reviewers can open the previewUrl printed by the command. Any purchase made at this URL is a test purchase.

Publish and review

Once you verify the preview, publish your game with neko submit --checked.

bash
neko submit --checked

To upload a test version and publish it at once, run neko deploy --release --checked.

If you run either command without --checked, it prints the following release checklist and stops:

  • Mobile safe area
  • Supported languages
  • SDK loading
  • Mobile touch

For web games, neko validate and neko deploy flag items that appear to be missing from your code as "Release check" warnings.

Your first release goes to review. Check the review result with neko status. If your game is rejected, reviewNote explains why. For details, see Review guidelines.

Once your game is live, subsequent releases go live immediately. If an update breaks, run neko rollback to revert to the previous version. See CLI commands for the full list of commands.

Build with an AI agent

If you build with an AI coding agent such as Claude Code, Codex, or Cursor, you can let it handle the entire publishing flow. Use this approach when you want to pass a prompt to the agent to run setup, validation, and deployment in order.

Get started

Copy the prompt from the Make a game page or the Create a game with AI button in the developer console. Open the agent in your game folder and paste the prompt.

What the agent does

The prompt tells the agent to run these four steps in order:

  1. Install the CLI and run neko login. When the agent shows you the 8-letter code, approve it in the browser.
  2. Install the Nekoland skill file (SKILL.md) with neko skill install and follow it. The Nekoland skill is a compact version of this page written for agents.
  3. Create nekogame.json and add the SDK. The agent asks you for the game ID. Build the game and verify it with neko validate and neko dev.
  4. Run neko deploy to publish the game and give you the preview URL.

Authentication and CI

You don't need to give the agent your password or write a token to a file. For CI, create a deploy-only token in the developer console and pass it as the NEKO_TOKEN environment variable.

nekogame.json

The config file at the root of your game project. neko init creates it, and neko deploy reads it on every deploy.

Basic configuration

Define basic details such as the game ID, title, and build folder in JSON format. See CLI commands for how to use each command.

json
{
  "gameId": "gem-rush",
  "title": "Gem Rush",
  "description": "One or two sentences shown on the game page",
  "category": "casual",
  "orientation": "landscape",
  "build": "dist",
  "thumbnail": "thumbnail.png"
}
Never change gameId after your first deploy. A new ID creates a new game, and saves and purchases do not carry over.

Fields

NameDescription
gameIdRequired. The game's address and identity. Must start with a lowercase letter and contain only lowercase letters, digits, and hyphens.
titleRequired. The game title.
descriptionOne or two sentences shown on the game page.
categoryA category ID returned by neko categories (for example, casual).
orientationScreen orientation. Choose any, landscape, or portrait (default: any). When set to landscape or portrait, phones held the other way show a "rotate your device" hint.
languagesLanguages the game supports. The first entry is the default language, and the list appears on the game page (for example, ["ko", "en"]). Omit this field to keep the current value; new games default to Korean only (ko). Supported codes: ko, en, ja, zh-CN, zh-TW, es, fr, de, pt, ru, vi, th, id.
buildPath to the folder with index.html at its root.
thumbnailPath to a square image. Supports PNG, JPG, and WebP.
productsIn-game products. See Product settings below for details.
mediaOptional. Images or YouTube videos shown on the game page.
linksOptional. HTTPS URLs for each site under the x, youtube, and discord keys.
threadsOptional. Multithreaded Unity and Godot 4 builds are detected automatically and served cross-origin isolated. Set true or false only to override detection.

Product settings

Define in-game products in the products array. They sync with the server on every deploy. See Payments for how to call the payment API.

json
{
  "products": [
    { "productId": "gems_500", "type": "consumable", "title": "500 Gems", "priceCoins": 100 },
    { "productId": "no_ads", "type": "non_consumable", "title": "Remove Ads", "priceCoins": 300 }
  ]
}
NameDescription
productIdProduct ID. Only a-z, 0-9, _, and . are allowed.
typeSet to consumable for consumable items or non_consumable for permanent items. Once set to non_consumable, it cannot be changed later.
titleProduct name.
descriptionOptional. Product description.
priceCoinsProduct price in Cubes. Must be a positive integer.
variablePriceSet to true on a consumable product to make it variable-price. priceCoins becomes the maximum per purchase, and your game passes the amount (an integer from 1 to the maximum) with purchase({ productId, priceCoins }). The confirm dialog and the receipt show that amount.

Add screenshots, videos, and official channel links under media and links.

json
{
  "media": [
    { "type": "image", "file": "shots/1.png" },
    { "type": "youtube", "url": "https://youtu.be/..." }
  ],
  "links": { "x": "https://x.com/...", "youtube": "https://youtube.com/@...", "discord": "https://discord.gg/..." }
}

Each media entry uses { "type": "image", "file" } or { "type": "youtube", "url" }. The first image is also used as the home-page card.

Limits

ItemLimit
gameId length4–40 characters
title length1–80 characters
description lengthUp to 2,000 characters
build folder sizeUp to 500MB
build file countUp to 1,500 files
thumbnail resolutionAt least 256×256 (512×512 recommended)
thumbnail file sizeUp to 2MB
productId length1–64 characters
media countUp to 10 items
media image resolution and aspect ratio16:9, at least 960×540
media image file sizeUp to 4MB

Notes

  • description and thumbnail are checked during review. See Review guidelines for the criteria.
  • Even if you set orientation, your game must fit any screen size.
  • Products you remove from products are taken off sale on deploy.
  • media and links replace what is on the server when present and are left unchanged when omitted.

Game SDK

@launchercapital/nekoland-sdk runs inside your game to integrate Nekoland platform features. Everything else — login, payment, chat — happens on the platform side.

The current SDK version is 0.11.0.

Guides

GuideDescription
InstallationInstall the SDK.
Initialization and lifecycleInitialize the SDK and handle its lifecycle.
Player and loginIntegrate player and login features.
PaymentsIntegrate payments.
Cloud storageUse cloud storage.
Friends and invitesIntegrate friends and invites.
Analytics eventsUse analytics events.
VibrationUse vibration.
Player tokenUse player tokens.

Installing

Add the Nekoland game SDK to your project. Choose either the script tag or the npm package depending on whether you use a bundler.

Script tag

If your project does not use a bundler, load the SDK with a script tag. The platform and neko dev serve the SDK at /__neko/sdk.js.

html
<script src="/__neko/sdk.js"></script>
<script>
  const { sdk, NekoSdkError } = window.Nekoland;
</script>
/__neko/sdk.js is the only absolute path that works in a game.

npm

If your project uses a bundler, install the @launchercapital/nekoland-sdk package.

bash
npm i @launchercapital/nekoland-sdk

After installing the package, create a NekoSDK instance.

js
import { NekoSDK, NekoSdkError } from "@launchercapital/nekoland-sdk";

const sdk = new NekoSDK();

Unity and Godot

Unity and Godot have their own wrappers. See the Unity and Godot 4 guides for details.

Init & lifecycle

Initialize the SDK when your game starts and handle the loading screen, play time, screen insets, and platform events. You must initialize the SDK before using Payments, Cloud storage, or Player and login.

Initialization

Call sdk.init() when your game starts with the gameId from nekogame.json. It resolves with player info and immediately closes the platform loading screen.

js
const player = await sdk.init({ gameId: "gem-rush" }); // the gameId in nekogame.json

You can pass the following options to sdk.init(options):

NameDescription
gameIdRequired. The game ID set in nekogame.json.
manualReadyIf true, keeps the platform loading screen open until you call sdk.gameReady().
modeExecution mode: "auto", "platform", or "local".
localLocal development settings. See Local testing.
timeoutMsInitialization timeout. Default is 10,000.
extraHostOriginsLocal development only.

Long loads

For games with long load times such as Unity, you can keep the platform loading screen open and drive its progress bar. Initialize with manualReady: true, report progress, and call sdk.gameReady() once the first screen is up.

js
await sdk.init({ gameId: "gem-rush", manualReady: true });

for (let i = 0; i < assets.length; i++) {
  await load(assets[i]);
  sdk.loadingProgress((i + 1) / assets.length); // 0..1
}
await sdk.gameReady(); // closes the loading screen once the first screen is up
The platform closes the loading screen after 60 seconds even if you do not call sdk.gameReady().

Play time

Use these methods to measure active play time accurately. If you never call them, all time the game is visible counts as play time.

js
sdk.gameplayStart(); // leaving the menu, unpausing
sdk.gameplayStop();  // menu, pause, game over

Screen insets and safe area

On mobile, the platform menu button (exit, friends, report, help) sits at the top-left of the screen. Position your HUD to account for this button and the device safe area.

js
// Keep the HUD out of the platform menu button (top-left)
layoutHud(sdk.insets.menu); // { x, y, width, height } or null
sdk.on("insets.changed", (i) => layoutHud(i.menu));
NameDescription
sdk.insets.menuArea of the top-left platform menu button as { x, y, width, height } in CSS px, or null on desktop where there is no menu button. Keep HUD buttons out of this area.
sdk.insets.safeAreaSafe area insets for the phone's notch or home indicator as { top, right, bottom, left } in CSS px from each edge. Keep HUD and text inside it; the background may extend to the edges.
CSS env(safe-area-inset-*) is 0 inside the game iframe, so use sdk.insets.safeArea for safe area layout.

Platform menu

Your game handles a short Esc press. Holding Esc for 1 second always opens the platform menu so you can exit any game.

You can also add a menu button to your pause or settings screen that calls sdk.openMenu() to open the platform menu. Use NekoSDK.OpenMenuAsync() in Unity and NekoSDK.open_menu() in Godot 4.

js
pauseScreen.onMenuClick = () => sdk.openMenu();
sdk.on("menu.open", () => showPausedOverlay()); // pause also fires
sdk.on("menu.close", () => hidePausedOverlay());

Exit and the cube top-up screen

You can put your own Exit button or "Get cubes" button in the game. Available from SDK 0.6.4.

  • sdk.exit() leaves the game exactly like Exit in the platform menu, on the web and in the apps. It returns just before the platform changes screens, so save first.
  • sdk.openCharge({ needed? }) opens the platform's cube top-up screen over the game. The game gets pause when it opens and resume when it closes. It returns the balance { coins } when the player closes it. Guests sign in first.
  • If another platform window (a purchase or a top-up) is already open, both calls are rejected with BUSY.
js
// Your own Exit button: leaves like the menu's Exit (save first)
pauseScreen.onExitClick = async () => {
  await saveGame();
  await sdk.exit();
};

// Your own "Get cubes" button: the platform top-up screen over the game (pause → resume)
const { coins } = await sdk.openCharge({ needed: 300 }); // balance when the player closes it
shop.showBalance(coins);

Events

Subscribe to platform events with sdk.on(). It returns an unsubscribe function.

js
sdk.on("pause", () => { /* stop the loop and mute */ });
sdk.on("resume", () => { /* restore sound */ });
sdk.on("player.changed", () => { /* reload the save on sign-in or account switch */ });
NameDescription
pauseFires when the tab is hidden, the app goes to the background, or a purchase dialog or the platform menu opens. Stop the game loop and mute audio.
resumeFires when returning to the game or when the platform menu closes. Restore audio.
player.changedFires when a guest signs in or the account changes. Reload the save because playerId may have changed.
insets.changedFires when the screen rotates. Reposition your HUD using the updated insets.
menu.openFires when the platform menu opens. pause also fires.
menu.closeFires when the platform menu closes. resume also fires.

API

NameDescription
sdk.init(options)Initializes the SDK and returns player info.
sdk.loadingProgress()Reports loading progress as a value from 0 to 1.
sdk.gameReady()Closes the platform loading screen once the first screen is up.
sdk.gameplayStart()Call when leaving the menu to start active play or when unpausing.
sdk.gameplayStop()Call when entering a menu, pausing, or reaching game over.
sdk.openMenu()Opens the platform menu.
sdk.exit()Leaves the game like Exit in the platform menu.
sdk.openCharge({ needed? })Opens the cube top-up screen over the game and returns the balance { coins } when it closes.
sdk.on()Subscribes to a platform event and returns an unsubscribe function.

Important notes

  • Call the payments, storage, and player APIs only after sdk.init() completes. Calling them earlier raises a NOT_INITIALIZED error.
  • You can call on(), track() from Analytics, gameplayStart(), and gameplayStop() before sdk.init().

Player & login

Read the current player's info and runtime environment, and ask guests to log in. Use these APIs when you need to display a profile, support multiple languages, adapt UI by device, or convert guests to members.

Read player info

Read the current player's profile and language settings from sdk.player.

js
const { playerId, displayName, avatarUrl, isGuest, locale } = sdk.player;
NameDescription
playerIdPlayer identifier. Stable within the same game and different in every game.
displayNameThe player's display name.
avatarUrlAbsolute profile photo URL. Missing if the player has no profile photo. CORS-enabled so you can draw it on a canvas.
isGuestWhether the player is a guest.
localeThe player's language setting, such as ko-KR.

Guest login

Call sdk.login() to ask a guest player to log in or sign up.

js
if (sdk.player.isGuest) {
  try {
    await sdk.login(); // platform login and sign-up dialog
  } catch {
    // the player stayed a guest
  }
}

sdk.login() opens the platform login and sign-up dialog for a guest. When the player becomes a member, it resolves with their member info. If they are already a member, it resolves immediately. It rejects if the player declines.

Guests keep their existing cloud save data when they sign up.

Languages

Pick strings using the language part of sdk.player.locale. For example, use ko when the locale is ko-KR. Fall back to the default language if the language is not supported.

List your game's supported languages under languages in nekogame.json.

Runtime environment

Check SDK properties to identify the platform, device, and test environment where your game is running.

NameDescription
sdk.platformThe current platform. "web" in a browser, or "ios" or "android" in the Nekoland app.
sdk.deviceThe device type. "mobile" on touch phones and tablets, or "desktop" on a computer.
sdk.sandboxtrue in a pre-approval preview and in local mode. Purchases are processed as test purchases in this mode.
sdk.isLocaltrue in local test mode.

Things to note

  • Use sdk.device to decide whether to show touch buttons and to size your UI. Accept touch, mouse, and keyboard input regardless of the device.
  • Keep your game's behavior the same even when sdk.sandbox or sdk.isLocal is true.

Payments

Sell consumable and permanent products in your game and manage grant states. Use this API to build an in-app shop or restore a player's purchases.

Getting started

Declare every product you want to sell in nekogame.json first. neko dev and the platform only sell products listed there. Read titles and prices for your shop UI from the platform.

js
const products = await sdk.payments.getProducts(); // Specific products only: getProducts(["gems_500"])
// [{ productId, type, title, description, priceCoins, variablePrice?, iconUrl? }]

Follow the grant → save → consume order so a purchase is never lost or granted twice. consume marks a consumable product as granted. Purchases don't include a type field, so your code must distinguish between consumable and permanent products.

js
const CONSUMABLES = new Set(["gems_500"]); // Purchases don't carry the type
const owned = new Set();                   // Permanent products

async function grant(p) {
  if (!CONSUMABLES.has(p.productId)) { owned.add(p.productId); return; } // Never consume permanent products
  if (p.state !== "completed") return;                                   // Already granted
  if (!save.grantedIds.includes(p.purchaseId)) {
    save.gems += 500;
    save.grantedIds = [...save.grantedIds, p.purchaseId].slice(-50);
    await sdk.storage.set({ save: JSON.stringify(save) });               // 1. Save the grant first
  }
  await sdk.payments.consume(p.purchaseId);                              // 2. Then consume
}

On every start, fetch any ungranted purchases and owned permanent products to restore state.

js
for (const p of await sdk.payments.getPurchases()) await grant(p);

In your buy button handler, call purchase and pass the returned purchase record to your grant function. Ignore user cancellations and handle all other errors by code.

js
try {
  await grant(await sdk.payments.purchase({ productId: "gems_500" }));
} catch (e) {
  if (e instanceof NekoSdkError && e.code === "USER_CANCELLED") return;
  // NOT_LOGGED_IN, INSUFFICIENT_COINS, ALREADY_OWNED, PURCHASE_PENDING, PRICE_CHANGED, INVALID_PRICE, PRODUCT_NOT_FOUND, TIMEOUT
}

API

NameDescription
sdk.payments.getProducts()Returns the list of registered products. Pass an array of product IDs, such as getProducts(["gems_500"]), to fetch specific products.
sdk.payments.purchase({ productId, developerPayload? })Starts a purchase. The platform shows confirm, top-up, and sign-in dialogs outside the iframe, and guests are asked to sign in automatically. developerPayload comes back unchanged on the purchase and receipt.
sdk.payments.getPurchases()Returns consumables not yet passed to consume and every permanent product the player owns.
sdk.payments.consume(purchaseId)Marks a consumable as granted. Until you call it, the purchase continues to appear in getPurchases().

Each product object returned by getProducts() has the shape { productId, type, title, description, priceCoins, variablePrice?, iconUrl? }.

Each purchase object returned by purchase() and getPurchases() has the shape { purchaseId, productId, state, purchasedAt, developerPayload?, signedReceipt }. state is completed, consumed, or refunded.

Errors

If a purchase or operation fails, the SDK throws NekoSdkError. Check e.code for the cause.

CodeWhen
USER_CANCELLEDThe player closed the dialog. Ignore it.
NOT_LOGGED_INA guest declined to sign in.
INSUFFICIENT_COINSThe top-up screen was shown and closed without buying cubes.
ALREADY_OWNEDThe player tried to buy a permanent product they already own. Unlock the product.
PURCHASE_PENDINGPayment is still processing. Check getPurchases() later.
PRICE_CHANGEDThe price changed after the confirm dialog was shown. Refetch products and try again.
INVALID_PRICEA variable-price product is missing priceCoins, or the value is not an integer from 1 to the maximum.
PRODUCT_NOT_FOUNDThe product is not on sale, or the purchase ID passed to consume does not exist. Check nekogame.json and deploy.
TIMEOUTThe platform did not respond in time.

Important notes

  • Never draw your own purchase confirm dialog in your game.
  • Never call consume on permanent products. Only unlock the feature.
  • For items used immediately upon purchase (such as "Revive"), increment the count by 1, save, and call consume. Then subtract 1 from your game's count and save again.
If your game has a server, never grant items based on the client's word alone. Grant them on the server after verifying webhooks or receipts. See Purchases on your server for details.

Cloud saves

Use sdk.storage instead of localStorage to save player game data. Data follows the player across devices, and guests keep it when they sign up.

Preview storage is separate from the live game.

Usage

Values are strings, so convert objects to JSON before storing them.

js
const raw = (await sdk.storage.get(["save"])).save;
const save = raw ? JSON.parse(raw) : { gems: 0, grantedIds: [] };

save.gems += 10;
await sdk.storage.set({ save: JSON.stringify(save) });

API

NameDescription
sdk.storage.get(keys)Gets values for the specified keys. Returns null for missing keys.
sdk.storage.set(entries)Saves key-value pairs. Merges with existing keys and leaves other keys unchanged.

Limits

ItemLimit
Storage size1MB per game and player

Exceeding the limit rejects with an INVALID_ARGUMENT error.

Friends & invites

Load the friend list from a player's Nekoland account, send game invites, and send friend requests. Use these APIs for features such as co-op play, rooms, or showing friends playing now.

Available from SDK 0.6.0. The platform handles friend requests, 1:1 chat, and online status outside your game. Your game only sees friends by their playerId for this game.

Load the friend list

Call sdk.friends.list() to get the friend list. For guests, it returns an empty list.

js
const friends = await sdk.friends.list();
const playingNow = friends.filter((f) => f.inGame);

Your game server can read the same list with getFriends.

Send and receive friend invites

Call sdk.friends.invite() to open the platform's friend picker. Each chosen friend receives an invite card in their Nekoland chat that opens this game. Guests are prompted to log in first.

js
try {
  const { sent } = await sdk.friends.invite({ data: roomCode });
} catch (e) {
  // USER_CANCELLED: picker closed, NOT_LOGGED_IN: guest did not log in
}

When a player opens the game from a friend's invite, sdk.invite holds the invite details. Otherwise, it is null.

js
if (sdk.invite) {
  const { fromPlayerId, fromName, data } = sdk.invite;
  joinRoom(data);
}

Send a friend request in-game

Call sdk.friends.add() to send a friend request to another player in this game. The platform shows a confirm dialog first. If that player has already sent you a request, confirming makes you friends right away.

js
const { status } = await sdk.friends.add(otherPlayerId);

API

NameDescription
sdk.friends.list()Returns an array of friends. Each item has the shape { playerId, displayName, avatarUrl?, online, inGame, hasPlayed }.
sdk.friends.invite({ data? })Opens the friend picker and sends invite cards. Resolves with { sent }. data is optional.
sdk.friends.add(playerId)Sends a friend request to the specified player and resolves with { status }. status is "sent" (waiting for them to accept on Nekoland) or "friends" (you became friends immediately).
sdk.inviteHolds { fromPlayerId, fromName, fromAvatarUrl?, data } when the session was opened from an invite. Otherwise null. data is null if no data was sent.

Each friend object returned by sdk.friends.list() has the following fields:

FieldDescription
playerIdThe friend's player ID for this game.
displayNameThe friend's display name.
avatarUrl?The friend's avatar URL. May be omitted.
onlineWhether the friend is on Nekoland right now. Online status is shown by default and is false if the friend hides it.
inGameWhether the friend is playing this game right now.
hasPlayedWhether the friend has opened this game before.

Errors

CodeWhen
USER_CANCELLEDThe player closed the friend picker in sdk.friends.invite() or the confirm dialog in sdk.friends.add().
NOT_LOGGED_INA guest declined the login prompt after calling sdk.friends.invite().
INVALID_ARGUMENTYou passed the player's own playerId or a player who cannot receive requests to sdk.friends.add().

Limits

ItemLimit
data length in sdk.friends.invite()Up to 500 characters

Important notes

  • data in sdk.friends.invite() is delivered to the friend's game as-is. Use it only for values like a room code, never for anything your server must trust.
  • The platform already provides a friend list and chat. Only add friend features when they benefit your game.

Analytics

Use analytics to record player actions in your game. Load time, errors, and drop-off are collected automatically, so you only need to send events specific to your game.

Usage

Pass an event name and a properties object to sdk.track to send an event. Properties are optional.

js
sdk.track("level_complete", { level: 3, stars: 2 });
sdk.track("tutorial_complete");

You can call sdk.track before calling init. Events sent before initialization are queued. See Initialization and lifecycle for details on the initialization flow.

Limits

Event names and properties must follow these rules:

  • Event names must start with a lowercase letter and contain only lowercase letters, digits, and _.
  • Names starting with neko_ are reserved for the platform.
  • Properties must be a flat object with no nesting.
  • Property keys follow the same naming rules as event names.
  • Property values can only be strings, finite numbers, or booleans.
ItemLimit
Event name lengthUp to 40 characters
Property keysUp to 20
Property string value lengthUp to 100 characters
Total properties sizeUp to 2KB
Queued events before initUp to 100

Suggested names

Use these names for common game events:

  • level_start, level_complete, level_fail
  • tutorial_complete
  • item_earn, item_spend
Do not send purchases or personal data. The platform already tracks purchases.

Viewing events

You can view sent events in the developer console or with the neko events command. Add the -f option to follow events continuously. See CLI commands for command details.

Notes

  • sdk.track never throws.
  • Invalid events are dropped.
  • In local mode, sending an invalid event logs a warning to the console. See Local testing for how to run locally.

Vibration

Use device vibration to give feedback on player input or event results during gameplay. This page also explains how the platform keeps the screen on while a game is open.

Usage

Call sdk.haptic(style) to trigger vibration.

js
sdk.haptic("light");      // on a hit
sdk.haptic("success");    // level clear
sdk.haptic("selection");  // a very light tick when moving through a list or picker

In Unity, call NekoSDK.Haptic("light"). In Godot 4, call NekoSDK.haptic("light").

Vibration styles

You can pass the following styles to sdk.haptic(style). The default is light.

StyleDescription
light, medium, heavyVibration by strength.
success, warning, errorVibration by result.
selectionA very light tick.

Behavior by environment

Vibration behavior depends on the runtime environment.

EnvironmentBehavior
Nekoland appVibrates natively, including on iPhone.
Android browsersUses navigator.vibrate.
iOS browsersDoes nothing because there is no way to vibrate.
Players who turned off vibration or touch feedback in their device settings may feel nothing.

Caveats

  • sdk.haptic does not wait for a result or throw an error.
  • Calls made before init are ignored. See Initialization and lifecycle for how to initialize the SDK.
  • Consecutive calls within 30 ms are dropped. You can call it from a game loop.

Keeping the screen on

The platform keeps the screen on while a game is open. This works in the Nekoland app and in browsers that support Wake Lock. You do not need to call anything.

Player tokens

Use player tokens to prove who the player is to your game server. Request a token in your game, send it to your server, and verify it there.

Usage

Call sdk.getPlayerToken() to get a token and send it to your game server. The token is an ES256 JWT valid for 1 hour. Guests can get tokens too.

js
const { token, expiresAt } = await sdk.getPlayerToken();
await fetch("https://api.example.com/session", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ token }),
});

See Verifying players for how to verify tokens on your server.

Important notes

  • Request a new token when it expires.
  • Request a new token after player.changed.
Tokens from neko dev are unsigned and fail verification. Deploy your game and test server integration on the preview.

Multiplayer

Choose the right architecture when your game needs online features or server authority. Compare Nekoland relay rooms, room scripts, and a self-hosted game server to pick the approach that fits your game.

Compare approaches

Choose one of the four approaches below based on the features your game needs and your payout terms.

ApproachUse it forRevenue share
SDK only (sdk.storage)Single-player, saves, personal high scores70%
Relay rooms (sdk.rooms)Co-op with friends, turn-based, party, or casual real-time games where you can trust the client; no game-awarded items or currency70%
Room scripts ("room": { "script": ... })Anti-cheat arbitration, items and currency, trading, persistent characters, fair rankings, map- and channel-based RPGs, server-side purchase fulfillment55%
Self-hosted game server (@launchercapital/nekoland-server)The same features as room scripts without the extra fee, heavy simulations, more than 16 players in one space, persistent always-on worlds70%

Relay rooms

With relay rooms, the Nekoland relay server forwards messages directly between players in the same room. The relay server only forwards messages—it does not store them or run game logic. Your game defines what each message means.

You can build multiplayer without a game server. See Multiplayer rooms for details.

SDK versionSupported features
0.7.0 and laterMessage forwarding between players in the same room
0.8.0 and laterQuick match, room list, passwords, kick, ping, neko dev local rooms
0.9.0 and laterFriends-only rooms, binary messages

Room scripts

Room scripts run your game's server logic on Nekoland. Use them by default when you need server authority and do not run your own server.

If you want to avoid the extra fee, check whether relay rooms are enough first. If you require server authority, use a self-hosted game server. See Room scripts, Channels and room transfers, and Room storage and payments for implementation details. See Revenue and payouts for payout terms.

Games that use room scripts incur an additional 15 percentage point platform fee, reducing your revenue share from 70% to 55%. Rates may change with advance notice, and each sale keeps the rate in effect at the time of purchase.

Self-hosted game server

With a self-hosted game server, you build, host, and pay for your own server infrastructure. Choose this approach if you need server authority like room scripts while keeping your 70% revenue share with no extra fee, or if your game exceeds room script limits.

On your server, verify sdk.getPlayerToken() with @launchercapital/nekoland-server and fulfill purchases through webhooks. See Verify players, Handle purchases on your server, and Webhooks for implementation details.

Login requirements

Only signed-in players can use online features such as rooms and room scripts. When a guest tries to join a room, Nekoland shows a sign-in prompt first. If the guest declines to sign in, a NOT_LOGGED_IN error occurs.

Keep a solo mode available for guests and show a message such as "Sign in to play online."

Things to keep in mind

  • Do not use room scripts if relay rooms are enough for your game. You will pay the extra 15 percentage point platform fee with no added benefit.
  • Do not handle items or currency with relay rooms or sdk.storage alone. Players can modify client values, so validate them in a room script or a self-hosted game server.

Multiplayer rooms

Use the Nekoland relay to send messages directly between players in the same room. You can build co-op, turn-based, and casual real-time games without a game server.

The relay only forwards messages—it does not store them or run game rules. Your game decides what messages mean and how to handle them.

Basic room features are available from SDK 0.7.0. Quick match, room lists, passwords, kick, ping, and local rooms in neko dev are available from SDK 0.8.0. Friends-only rooms and binary messages are available from SDK 0.9.0.

Creating and joining rooms

Create a room and share its code using Friends and invites. When an invited friend opens the game, sdk.invite.data contains that room code.

js
// Host: create a room and invite friends with its code
const room = await sdk.rooms.create({ maxPlayers: 4, meta: { mode: "coop", stage: 1 } });
await sdk.friends.invite({ data: room.code });

// Invited friend: join with the invite code
if (sdk.invite) await sdk.rooms.join(sdk.invite.data);

To match with strangers, use quick match or list public rooms. quickMatch takes a free seat in the public room with the same match value that has waited longest, or creates a new public room if none is available.

js
const r = await sdk.rooms.quickMatch({ maxPlayers: 2, match: "duel" });
const open = await sdk.rooms.list({ match: "duel" }); // [{ code, players, max, meta, hostName, friendsOnly }]

Creating a room with friendsOnly: true allows only the host's Nekoland friends to join. These rooms do not appear in public lists or quick match—friends see them only in list({ friends: true }). Guests have no friends and cannot join.

js
const mine = await sdk.rooms.create({ friendsOnly: true });
const friendsRooms = await sdk.rooms.list({ friends: true });

Messages and room control

After joining a room, register event listeners with room.on().

js
room.on("message", ({ from, data }) => applyInput(from, data));
room.on("join", (p) => showToast(`${p.displayName} joined`));
room.on("leave", ({ playerId, host }) => removePlayer(playerId));
room.on("close", ({ reason }) => backToLobby(reason));

Use room.send() to send data to everyone else in the room or to a single player. The host can update room metadata with setMeta(), and you can measure round-trip time in milliseconds with sdk.rooms.ping().

js
room.send({ x: 10, y: 4 }); // everyone else
room.send(state, { to: newcomerId }); // one player
if (room.isHost) room.setMeta({ mode: "coop", stage: 2 });
await sdk.rooms.ping(); // round trip in ms
await room.leave();

Pass any JSON-serializable value to room.send(). When you send packed position data frequently, you can send a Uint8Array or ArrayBuffer as raw binary; recipients receive a Uint8Array. Between different engines, use the { type, data } shape. In Unity, you can handle messages by type with room.On<T>("move", …).

The player who creates the room is the host. When the host leaves, the next player becomes host. Only the host can call setMeta and kick(playerId). A kicked player receives kicked as the reason in the close event and cannot rejoin that room.

Late joiners also receive room.meta. Store shared state such as phase, score, and map in meta, or have the host send it on the join event with room.send(state, { to: player.playerId }).

API

Use these sdk.rooms methods to create, join, and list rooms.

NameDescription
sdk.rooms.create({ maxPlayers, meta, public, password, match, friendsOnly })Creates a room and sets you as host.
sdk.rooms.join(code, { password })Joins a room by code. Pass password if the room requires one.
sdk.rooms.quickMatch({ maxPlayers, match })Joins a public room with the same match value, or creates a new public room.
sdk.rooms.list()Returns public rooms with free seats. Pass { match } to filter by mode or { friends: true } to list rooms your friends are hosting. Each item has the shape { code, players, max, meta, hostName, friendsOnly }.
sdk.rooms.ping()Returns the round-trip time to the relay in milliseconds.

Options passed to sdk.rooms.create():

NameDescription
maxPlayersMaximum number of players in the room.
metaShared room metadata.
publicWhen true, lists the room publicly and makes it joinable by quick match.
passwordRoom password. Password-protected rooms are never listed and require the same password to join.
matchMatchmaking key (such as a game mode name) used for quick match and listing.
friendsOnlyWhen true, only the host's Nekoland friends can join.

Properties and methods on the room object returned after joining:

NameDescription
room.codeThe room code.
room.metaShared metadata stored on the room.
room.isHostWhether the current player is the host.
room.send(data, { to })Sends data to everyone else in the room, or to one player when to is specified.
room.setMeta(meta)Updates the room metadata. Host only.
room.kick(playerId)Kicks the specified player from the room. Host only.
room.leave()Leaves the room.

Events subscribed via room.on():

NameDescription
messageFires when another player sends a message. Payload: { from, data }.
joinFires when a new player joins. Payload contains player info with displayName and playerId.
leaveFires when a player leaves. Payload: { playerId, host }. If the host changes, host contains the new host.
closeFires when the room connection ends. Payload: { reason }, where reason is left, kicked, disconnected, replaced, or closed (from a room script).

Errors

CodeWhen it occurs
NOT_LOGGED_INA guest declines the login dialog shown when joining a room.
ROOM_NOT_FOUNDNo room exists for the given code.
ROOM_FULLThe room has reached its maximum number of players.
WRONG_PASSWORDThe password does not match.
KICKEDThe player tries to rejoin a room they were kicked from.
NOT_FRIENDA player who is not a Nekoland friend of the host tries to join a friends-only room.
ALREADY_IN_ROOMThe player is already in a room.

Limits

ItemLimit
Room code length6 characters
list() resultsUp to 50, newest first
Message sizeUp to 64KB per message
Messages per secondAbout 30
Bandwidth per secondUp to 256KB

Notes

  • Online features such as rooms and room scripts are for logged-in players only. When a guest tries to join a room, Nekoland shows its login dialog first; if they decline, the call fails with NOT_LOGGED_IN. Keep single-player modes available for guests and let them know they can play online after logging in.
  • If the connection drops, the SDK automatically reconnects to the same room. If reconnection fails, the close event fires with reason set to disconnected. If the same player joins from another tab, the old tab closes with reason set to replaced.
  • Preview and CBT players use separate rooms from live players.
  • Unity provides the same features via NekoSDK.Rooms, and Godot 4 via NekoSDK.rooms_create() and related methods.
Any player can send arbitrary message data. Never trust room messages for sensitive actions such as purchases or rankings—verify them on your own game server using the player token.

Room scripts

Room Scripts let you write server-side validation for multiplayer rooms in TypeScript and run it on Nekoland's servers. Use them when you want to handle game rules and data writes on the server without running your own game server, preventing client-side tampering.

Fees

Because Nekoland runs server-side validation on your behalf, the platform fee increases by 15 percentage points. Creators receive 70% of sales for standard games, and 55% for games that use Room Scripts. This rate may change with prior notice, and each sale keeps the rate of the day it was made. See Payouts for payout rules.

If you need server-side validation without the extra fee, run your own game server and connect it with player tokens and webhooks. For co-op or turn-based games that do not need server-side validation, sdk.rooms in Multiplayer rooms is enough.

Getting started

First, set the path to your room script in room.script in nekogame.json.

json
{
  "gameId": "gem-rush",
  "title": "Gem Rush",
  "build": "dist",
  "room": { "script": "server/room.ts" }
}

Export a handler object { onCreate, onJoin, onMessage, onTick, onLeave } as export default from the script file. All handlers are optional and can be async. Import defineRoom from @launchercapital/nekoland-sdk/room for types and autocomplete. You can also import rule files shared with the client; they are bundled together on deploy.

ts
// server/room.ts
import { defineRoom, type RoomContext } from "@launchercapital/nekoland-sdk/room";
import { scoreFor } from "../shared/rules";

type State = { coins: number[]; earned: Record<string, number>; saveIn: number };

export default defineRoom<State, { coin: number }>({
  onCreate(room) {
    room.state = { coins: [1, 2, 3], earned: {}, saveIn: 30 };
    room.setTick(1); // Call onTick once a second
  },
  async onJoin(room, player) {
    room.send(player.id, { type: "state", coins: room.state.coins });
  },
});

Handle messages sent by players in onMessage and validate them on the server. When the round ends, save the scores accumulated in memory before closing the room with room.close.

ts
async onMessage(room, player, msg) {
  const i = room.state.coins.indexOf(msg.coin);
  if (i < 0) return; // Reject coins already taken on the server
  room.state.coins.splice(i, 1);
  room.state.earned[player.id] = (room.state.earned[player.id] ?? 0) + scoreFor(msg.coin);
  room.broadcast({ type: "picked", by: player.id, coin: msg.coin });
  if (room.state.coins.length === 0) {
    for (const id of Object.keys(room.state.earned)) await save(room, id);
    room.close("round over");
  }
}
room.close does not call onLeave. Write any data you need to keep before closing the room.

Each storage write is a database request. Instead of saving currency on every pickup, accumulate it in room.state and batch writes in a save helper.

ts
async function save(room: RoomContext<State>, id: string) {
  const n = room.state.earned[id];
  if (!n) return;
  delete room.state.earned[id];
  const gold = await room.storage.player(id).increment("gold", n);
  await room.storage.scores("gold").max(id, gold);
}

Handle periodic saves in onTick, and save any remaining data in onLeave when a player leaves. Saves in onLeave run to completion even if the room closes.

ts
async onTick(room) {
  if (--room.state.saveIn > 0) return;
  room.state.saveIn = 30; // Save every 30 seconds
  for (const id of Object.keys(room.state.earned)) await save(room, id);
},
async onLeave(room, player) {
  await save(room, player.id);
}

On the client, use the same sdk.rooms API. In rooms with a Room Script, messages sent by players with room.send(data) go to onMessage on the server instead of other players. Messages sent by the script arrive as message events with from set to "$room". For binary messages, see Game data.

js
const room = await sdk.rooms.quickMatch({ maxPlayers: 4 });
room.on("message", ({ from, data }) => {
  if (from === "$room") applyServer(data);
});
room.on("close", ({ reason, message }) => reason === "closed" && showResult(message));
room.send({ coin: 2 });

When a room closes with room.close, clients receive a close event with reason set to "closed" and message. Use Room.CloseMessage in Unity and room_close_message in Godot 4.

Clients have read-only access to values saved by the script via sdk.roomData. Because only Room Scripts can write, you prevent tampering with items, currency, and rankings, unlike sdk.storage in Cloud storage, which clients write directly.

js
const { gold } = await sdk.roomData.get(["gold"]);
const { top, me } = await sdk.roomData.scores("gold", { limit: 10 });

Local testing and deployment

Run and deploy Room Scripts using the Nekoland CLI. See Local testing and CLI commands for full command details.

  • neko dev runs your room script locally with the same API as the server. When you edit the file, changes apply starting with newly opened rooms. console.log output prints to the terminal as [room <roomCode>].
  • neko deploy bundles your script and imported files (such as a shared/ folder) into a single JS file and uploads it under the same version as your build. Importing Node modules like fs fails the deploy, and using APIs unavailable on the server like fetch or setTimeout produces a warning.
  • Live rooms run the published version's script, and CBT rooms run that CBT version's script. Preview rooms run the most recently uploaded script.
  • In the Developer Console's "Room Scripts" tab, you can view uploaded scripts, the published version, currently open rooms, and recent logs. Logs record console output, errors, and room close reasons.

When you publish a new version or upload a new preview, open rooms switch to the new version together within a few seconds (at most 1 minute). It works like restarting the game server on the new version, so old-version and new-version rooms never run at the same time.

  • During the switch, onLeave runs for every player, so your leave-save code runs as usual. The room closes after in-progress saves finish.
  • For named rooms joined with sdk.rooms.joinNamed, the SDK moves players into a new room with the same name and keeps the same channel if possible. The room moved event fires with update: true, so players receive the state again just like on first join. See Channels and room transfers for details.
  • For rooms joined by code, the close event fires with reason set to "update", so you need to rematch.
  • CBT testers must refresh their link to get the new version.

API

Room handlers passed to defineRoom:

NameDescription
onCreate(room)Called when the room is created.
onJoin(room, player)Called when a player joins the room.
onMessage(room, player, msg)Called when a player sends a message with room.send(data).
onTick(room)Called at the interval set by room.setTick.
onLeave(room, player)Called when a player leaves the room.

Properties and methods on the room object (the first argument to each handler):

NameDescription
room.stateState kept only in room memory. Lost when the room closes.
room.nowServer time for the current call.
room.broadcast(msg)Sends a message to all players in the room.
room.send(playerId, msg)Sends a message to a specific player.
room.kick(playerId, reason)Kicks a player. Kicked players cannot rejoin.
room.setTick(hz)Calls onTick hz times per second. Pass 0 to stop it.
room.close(reason)Closes the room and sends everyone a close event with reason set to "closed" and message.

All room.storage methods use await. player(id) and game provide the same key-value methods. Preview and CBT storage data is separate from live. See Room storage and payments for details.

NameDescription
get(key)Reads a value from player(id) or game and returns { value, version } or null.
set(key, value, { version })Saves a value to player(id) or game. When version is passed, saves only if the version matches (0 saves only if the key does not exist).
increment(key, by)Adds to a numeric value in player(id) or game and returns the new value.
delete(key)Deletes a value from player(id) or game.
scores(board).setSets a score on the leaderboard.
scores(board).incrementIncrements or decrements a score on the leaderboard.
scores(board).maxSaves the score only if it is higher than the current best.
scores(board).topReturns the top scores. Ties are ranked by who reached the score first.
scores(board).rank(playerId)Returns a player's rank. Ties are ranked by who reached the score first.

sdk.roomData methods for reading storage data on the client:

NameDescription
sdk.roomData.get(keys)Reads saved values for the current player.
sdk.roomData.scores(board, { limit })Reads the leaderboard and returns { top, me }.

Errors

Error codes that room.storage calls can return:

CodeWhen
NOT_NUMBERCalling increment(key, by) when the stored value is not a number.
VERSION_MISMATCHCalling set(key, value, { version }) when version does not match the current version.

Limits

Each room runs with its own isolated globals and state. Up to 16 rooms of the same game share one engine to save memory. fetch, setTimeout, file access, Node APIs, and browser APIs are not available; use room.setTick for timers.

ItemLimit
Deploy bundle size1MB
setTick frequency30 calls per second
Execution time per call50ms
CPU time2 seconds per 10 seconds
Memory per engine128MB shared across up to 16 rooms in the same engine
Outgoing message size256KB
Consecutive errors allowed10
room.storage value size64KB JSON
scores(board).top limit1 to 100
sdk.roomData.get key count20
Developer Console recent logs200 lines
Room switch time on new versionWithin a few seconds, at most 1 minute
  • Exceeding the execution time, CPU, or message size limit fails the call or closes the room.
  • Exceeding 128MB of memory per engine closes all rooms sharing that engine together.
  • 10 consecutive errors close the room.
  • room.storage has a per-game requests-per-minute limit.

Caveats

  • Rooms close when everyone leaves and can also end due to a server outage. Write any data you need to keep to room.storage, not room.state.
  • Calling room.storage too frequently can hit the requests-per-minute limit. Accumulate changes in room.state and save them periodically.

Channels and moving rooms

Create named rooms with distinct roles—such as lobbies and dungeons—and move players between rooms or channels. Use these features to send messages between rooms in the same game or manage shared variables like world boss HP.

Named rooms and channels

When a client joins a room by name, it finds and joins the room with that name in the same game and release channel. If the room does not exist, it creates one. Live, preview, and CBT environments are separate. Named rooms work even in games without a room script and are excluded from public lists and quick matching.

Room names must be 1–64 characters using English letters, digits, _, ., :, and -. The maxPlayers and meta options apply only when creating the room.

When a named room reaches maxPlayers, the next player automatically joins channel 2, channel 3, and so on—up to channel 99—under the same name. Each new channel has the same player limit as the first channel.

js
const room = await sdk.rooms.joinNamed("lobby");
room.on("moved", ({ name }) => showMap(name));
room.send({ type: "enter", to: "1" });

To join a specific channel, pass the channel number—for example, sdk.rooms.joinNamed("field-1", { channel: 2 }). If the channel does not exist, it is created; if it is already full, it fails with ROOM_FULL.

Moving players

Call room.movePlayer in a room script to move a player to another named room. If the destination room does not exist, a new room is created with the same room script. During the move, the current room runs onLeave and the destination room runs onJoin, receiving the third argument data in player.data.

If you omit the channel, the player moves to the lowest channel with an open slot. Pass { channel: 3 } to move to that specific channel. Moving to another channel of the same room name performs a channel switch.

ts
// server/room.ts
import { defineRoom } from "@launchercapital/nekoland-sdk/room";

export default defineRoom({
  onJoin(room, player) {
    if (room.name?.startsWith("dungeon")) {
      const { weapon } = (player.data ?? {}) as { weapon?: string }; // data from movePlayer
      room.send(player.id, { type: "welcome", weapon });
      room.sendToRoom("lobby", { type: "entered", id: player.id, dungeon: room.name });
    }
  },
  async onMessage(room, player, msg: { type: string; to?: string; dmg?: number }) {
    if (msg.type === "enter") room.movePlayer(player.id, `dungeon-${msg.to}`, { weapon: "sword" });
  },
});

When a player moves, the client's Room object emits a "moved" event with { code, name }. The same Room instance becomes the new room—updating code, name, players, host, max, and meta—while keeping your registered event handlers intact.

Room-to-room messaging

A room script can send messages to other room scripts in the same game. room.sendToRoom sends to all channels of the specified room name, or only to the specified channel when you pass { channel }. room.broadcastRooms sends to all other rooms with a room script in the same game and channel, excluding the sender.

Sent messages are delivered to onRoomMessage(room, from, msg) in the receiving room script. from contains the sender's code, name, and channel.

ts
onRoomMessage(room, from, msg) {
  room.broadcast(msg); // from another room's script
}

Shared variables

Store state shared across all rooms in the same game and channel—such as world boss HP or event progress—in room.shared. Call get, set, and delete with await.

get returns { value, version } or null. Passing version to set writes only if it matches the stored version; passing 0 writes only when the key does not exist. If another room changed the value first and the version differs, VERSION_MISMATCH is thrown—re-read the value and retry.

ts
if (msg.type === "hit") {
  for (let i = 0; i < 5; i++) { // retry if another room changed it first
    const cur = await room.shared.get<number>("boss-hp");
    const hp = (cur?.value ?? 1000) - (msg.dmg ?? 0);
    try {
      await room.shared.set("boss-hp", hp, { version: cur?.version ?? 0 });
      return room.broadcastRooms({ type: "boss", hp }); // send to every other room
    } catch {}
  }
}
Shared variables live only in multiplayer server memory, so they are fast but lost on server restart. Store anything that must persist in room.storage (Room storage and payments).

Client API

NameDescription
sdk.rooms.joinNamed(name)Joins a named room or creates it if it does not exist. maxPlayers and meta apply only when creating the room.
sdk.rooms.joinNamed(name, { channel })Joins or creates the specified channel of a named room.
NekoSDK.Rooms.JoinNamedAsync(name)Joins a named room in Unity. Pass a channel with JoinNamedAsync(name, channel: 2).
NekoSDK.rooms_join_named(name)Joins a named room in Godot 4. Pass a channel with rooms_join_named(name, 16, null, 2).
"moved" eventFires with { code, name } when moved to another room. Use NekoRoom.OnMoved in Unity and the room_moved signal in Godot.
room.channelReads the current channel number from the client Room object.

Room script API

NameDescription
room.nameRoom name for named rooms, or null for code-joined rooms.
room.codeCurrent room code.
room.channelCurrent room channel number (0 for unnamed rooms).
room.movePlayer(playerId, name, data)Moves the player to the lowest channel with an open slot for that room name. Pass { channel: 3 } to move to that specific channel.
room.sendToRoom(name, msg)Sends a message to all channels of that name. Pass { channel } to send only to that channel.
room.broadcastRooms(msg)Sends a message to all other rooms with a room script in the same game and channel.
onRoomMessage(room, from, msg)Receives messages sent by another room script. from contains code, name, and channel.
room.shared.get(key)Reads a shared variable and returns { value, version } or null.
room.shared.set(key, value, { version })Writes a shared variable only if the stored version matches version. 0 writes only when the key does not exist.
room.shared.delete(key)Deletes a shared variable.

Errors

CodeWhen
ROOM_FULLThe specified channel is full when calling joinNamed with a channel.
VERSION_MISMATCHThe version passed to room.shared.set does not match the currently stored version.

Limits

ItemLimit
Room name length1–64 characters
Room capacityDefault 16, max 16 players
Max channels per named roomUp to 99 channels
Shared variable value size4KB JSON
Shared variable key count1,000 per game and channel

Caveats

  • Cross-room features currently work only between rooms on the same multiplayer server. There is currently one server, covering all rooms in a game.
  • Named rooms also close when all players leave.
  • If the destination room or specified channel is full, or the player was kicked from that room, room.movePlayer does not move the player and logs a warning to the developer console.
  • room.sendToRoom and room.broadcastRooms deliver messages only to open rooms with players in them, and log a warning if the room name does not exist.

Room storage and payments

Save player and game data to the database from room scripts, and grant in-app purchases without a separate webhook server. Use these APIs when you need to safely update multiple values in one operation, such as for trades, marketplaces, mailboxes, or sorted lists.

Grant purchases

After the client finishes sdk.payments.purchase from Payments and notifies the room (for example, room.send({ type: "bought", purchaseId })), the room script grants the rewards with room.payments.consume. Also check room.payments.list in onJoin so you still grant purchases if the app closed before notifying the room.

ts
// server/room.ts
export default defineRoom({
  async onJoin(room, player) {
    // Grant purchases the app closed before reporting
    for (const p of await room.payments.list(player.id)) {
      if (p.productId === "gem_100") await room.payments.consume(p.purchaseId, player.id, [{ player: player.id, key: "gems", increment: 100 }]);
    }
  },
  async onMessage(room, player, msg: { type: string; purchaseId?: string; to?: string }) {
    if (msg.type === "bought") {
      await room.payments.consume(msg.purchaseId!, player.id, [{ player: player.id, key: "gems", increment: 100 }]).catch(() => {}); // ALREADY_CONSUMED: already granted on join
    }
  },
});

The grant argument in room.payments.consume(purchaseId, playerId, grant) works like room.storage.batch. Consumption and granting happen together, so a purchase cannot be granted twice and is not consumed if granting fails. room.payments.list(playerId) returns unconsumed consumables and owned permanent items. Permanent items are not consumed; only check them for ownership.

Preview and CBT purchases are separate. neko dev in Local testing does not support payments, so test them in Preview.

Update multiple values at once

room.storage.batch runs up to 20 changes in a single all-or-nothing operation. All changes either apply together or cancel together, making it suited for selling items and player trades.

ts
// server/room.ts
if (msg.type === "sell-sword") {
  const bag = await room.storage.player(player.id).get<string[]>("bag");
  if (!bag?.value.includes("sword")) return;
  await room.storage.batch([ // Apply both or neither
    { player: player.id, key: "bag", set: bag.value.filter((x) => x !== "sword"), version: bag.version },
    { player: player.id, key: "gold", increment: 50 },
  ]);
}

Each key can appear only once in a batch. Specify the target and operation for each entry.

Entry formatDescription
{ player: id, key, ... }Updates a key for a specific player.
{ game: true, key, ... }Updates a game-wide key.
{ scores: name, id, ... }Updates a sorted list entry with set, increment, max, or delete: true.

Player keys and game-wide keys support set, increment, and delete: true. Pass version with set or delete to prevent concurrent overwrites, and pass min and max with increment to set allowed bounds. On success, batch returns { version }, { value }, or { ok: true } in the same order as the input operations.

Sorted lists and marketplaces

room.storage.scores(name) stores a list sorted by score. You can use it for rankings or as a sorted index, and id does not have to be a player ID (for example, it can be a listing ID). When scores are equal, the entry added earlier comes first.

When listing an item on a marketplace, remove it from the bag and save the listing and price index together in a batch. You can then query the cheapest listings first with range.

ts
async function sell(room: RoomContext, seller: string, item: string, price: number) {
  const bag = (await room.storage.player(seller).get<string[]>("bag"))!;
  const id = `${item}-${seller}-${room.now}`;
  await room.storage.batch([
    { player: seller, key: "bag", set: bag.value.filter((x) => x !== item), version: bag.version },
    { game: true, key: `listing:${id}`, set: { item, seller, price } },
    { scores: `auction:${item}`, id, set: price }, // Price index
  ]);
}
const cheapest = (room: RoomContext, item: string, page = 0) =>
  room.storage.scores(`auction:${item}`).range({ order: "asc", offset: page * 20, limit: 20 });

You can also include sorted list operations inside a batch, letting a marketplace purchase delete the listing, remove it from the price list, transfer gold, and deliver the item in one operation. If multiple players try to buy the same listing at the same time, version checking ensures only one succeeds.

ts
async function buy(room: RoomContext, buyer: string, id: string) {
  const l = await room.storage.game.get<{ item: string; seller: string; price: number }>(`listing:${id}`);
  if (!l) return "sold";
  await room.storage.batch([ // All or nothing
    { game: true, key: `listing:${id}`, delete: true, version: l.version },
    { scores: `auction:${l.value.item}`, id, delete: true },
    { player: buyer, key: "gold", increment: -l.value.price, min: 0 },
    { player: l.value.seller, key: "gold", increment: l.value.price },
    { player: l.value.seller, key: `mail:${room.now}:${id}`, set: { sold: l.value.item } },
  ]);
  return "ok";
}

List keys by prefix

room.storage.game.list and room.storage.player(id).list read keys starting with prefix in key order. Use them to paginate data such as mailboxes (mail:timestamp:id) or guild lists.

ts
const { items, next } = await room.storage.player(id).list("mail:", { limit: 20 });

The return value has the shape { items: [{ key, value, version }], next }. Pass next as the after option to read the next page. When you reach the end, next is null.

API

NameDescription
room.storage.player(id).get(key)Reads the value and version of a player key.
room.storage.game.get(key)Reads the value and version of a game-wide key.
room.storage.player(id).list(prefix, { after, limit })Reads player keys starting with prefix in key order.
room.storage.game.list(prefix, { after, limit })Reads game-wide keys starting with prefix in key order.
room.storage.batch(ops)Runs multiple storage changes as a single unit.
room.storage.scores(name).range({ order, offset, limit })Reads a sorted list in "asc" or "desc" order.
room.storage.scores(name).delete(id)Deletes the id entry from a sorted list.
room.storage.scores(name).count()Returns the number of entries in a sorted list.
room.payments.consume(purchaseId, playerId, grant)Consumes a purchase and applies the grant changes together.
room.payments.list(playerId)Returns unconsumed consumables and owned permanent items.

Errors

CodeWhen it occurs
RATE_LIMITEDYour game exceeds its per-minute storage limit.
OUT_OF_RANGEAn increment result in a batch falls outside min or max, canceling the entire batch.
VERSION_MISMATCHA version in a batch does not match the current version, canceling the entire batch.
ALREADY_CONSUMEDroom.payments.consume is called for a purchase that was already granted.
NOT_FOUNDThe purchase passed to room.payments.consume does not belong to that player.

Limits

ItemLimit
Single room.storage value sizeUp to 64KB of JSON (fits one character save, such as inventory, equipment, and quests)
room.shared shared variable sizeUp to 4KB
Changes per room.storage.batchUp to 20
Per-minute storage quota per game1 per request plus 1 per 4KB written; batch counts double
scores name format1–64 characters; letters, digits, _, ., :, and - only
offset in scores.range0–10000
limit in scores.range1–100
limit in list1–100 (default: 20)
Combined value size per list responseStops reading and returns when the total exceeds 512KB

Important notes

  • Every call to room.storage sends one request to the Nekoland database. Saving on every monster kill quickly fills your per-minute limit and can cause a RATE_LIMITED error.
  • Keep frequently changing values like gold, XP, and position in room.state (from Room Scripts). Save them on leave (onLeave), every 30–60 seconds (onTick), and right after important events like trades, payments, or level-ups.
  • If the server stops unexpectedly, tens of seconds of changes since the last save may be lost.
  • You can check storage usage from the last 24 hours in the Developer Console's Room Scripts tab.
room.close does not call onLeave. Always save any needed data before closing a room.

Game data

Learn how to read shared JSON data and send or receive binary messages in room scripts. Use this to share data across rooms, such as monster tables or maps, or to handle position sync with binary messages.

Configure and read data

Specify a folder under room in nekogame.json, such as "data": "server/data" alongside "script": "server/room.ts", to upload the .json files in that folder with your script. The uploaded data size appears in the developer console's version list.

In your script, pass a folder, file, and key path to room.data.get to read a value. For example, room.data.get("monsters/12") reads key 12 from server/data/monsters.json.

ts
// nekogame.json: "room": { "script": "server/room.ts", "data": "server/data" }
// server/data/monsters.json: { "slime": { "hp": 30, "exp": 5 }, … }
export default defineRoom<{ hp: number }>({
  onCreate(room) {
    const slime = room.data.get<{ hp: number }>("monsters/slime");
    room.state = { hp: slime!.hp };
  },
});

Nekoland loads the data into memory once per game, not once per room. Each room copies and caches only the parts it needs on first read instead of duplicating large tables or maps per room.

The local testing command neko dev uses the same room.data. When you edit a data file, changes take effect starting with the next new room.

Binary messages

Room script rooms also support binary messages, which are well suited for position sync. Check whether incoming messages in onMessage are a Uint8Array to handle them, and send byte data with room.send or room.broadcast.

ts
export default defineRoom<{ hp: number }>({
  onMessage(room, player, msg) {
    if (msg instanceof Uint8Array) { // binary: [x, y] positions
      room.broadcast(new Uint8Array([msg[0]!, msg[1]!]));
    }
  },
});

API

NameDescription
room.data.getReads JSON data by folder, file, and key path. Returns null if not found.
onMessageReceives byte data sent by a player as a Uint8Array.
room.sendPass a Uint8Array to send a byte message to a player with from set to "$room".
room.broadcastPass a Uint8Array to send a byte message to players with from set to "$room".

Room execution and closing behavior

When a room closes (after the last player leaves or room.close is called), it finishes in-progress saves before closing. As a result, await saves in onLeave are not lost.

Rooms using the same script reuse the compiled output from the first room so they open faster. You do not need to do anything.

Limits

ItemLimit
Total size of .json files in the data folderUp to 8MB
Wait time for in-progress saves on room closeUp to 5 seconds

Caveats

  • Values returned by room.data.get are frozen and cannot be modified.
  • Do not include files the server does not need, such as images, in the data folder.
  • No messages are sent while the room is closing.

Scheduled jobs

You can run a room script once at a scheduled time even when no players are connected. Use this for returning expired marketplace listings, weekly ranking rewards, season endings, and scheduled field boss alerts.

For tasks that can be handled when a player joins, such as daily resets or attendance, handle them at join time instead.

Registering tasks

Add a "schedule" array under "room" in nekogame.json.

json
"room": {
  "script": "server/room.ts",
  "schedule": [
    { "name": "weeklyRewards", "cron": "0 0 * * 1", "tz": "Asia/Seoul" },
    { "name": "fieldBoss", "cron": "0 20 * * *", "tz": "Asia/Seoul" }
  ]
}
OptionDescription
nameTask name. Must start with a letter and contain only letters, digits, and _.
cronFive-field schedule expression (minute, hour, day of month, month, day of week). Supports *, numbers, a-b, a,b, and */n. For day of week, both 0 and 7 represent Sunday.
tzTime zone such as "Asia/Seoul". Defaults to UTC if omitted.

Writing the script

At the scheduled time, onSchedule(room, job) runs in an empty room. The following example grants weekly ranking rewards.

ts
export default defineRoom({
  async onSchedule(room, job) {
    if (job.name === "weeklyRewards") {
      const done = await room.storage.game.get<number>("rewardedAt");
      if (done?.value === job.at) return; // Prevent duplicate runs
      const top = await room.storage.scores("weekly").top(10);
      await room.storage.batch([
        ...top.map((e) => ({ player: e.playerId, key: `mail:${job.at}:rank`, set: { rank: e.rank, gems: 100 - e.rank * 5 } })),
        { game: true, key: "rewardedAt", set: job.at },
      ]);
    }
  },
});

Call room.broadcastRooms to notify open maps.

ts
export default defineRoom({
  async onSchedule(room, job) {
    if (job.name === "fieldBoss") room.broadcastRooms({ type: "boss", map: "field-3" });
  },
});

API

Values passed to onSchedule(room, { name, at }) and available room features.

NameDescription
onSchedule(room, job)Handler called at the scheduled time. job is a { name, at } object.
job.nameTask name registered in nekogame.json.
job.atScheduled time in ms.
room.codeSet to "$schedule" in a scheduled task room.
room.storageAccesses room storage and payments.
room.dataAccesses game data.
room.sharedAccesses room.shared.
room.broadcastRoomsSends a notification to open maps.

Testing and checking runs

Scheduled tasks run automatically only with the published version's script. They do not run automatically on preview data or CBT data.

  • To test immediately against preview data, run neko schedule run <name>. This runs the most recently uploaded version once right away against preview data and waits for the result. See CLI commands for details.
  • During local testing, neko dev runs tasks on their cron schedule. Open /__neko/schedule/<name> to run a task once right away.
  • Check the schedule list and recent run results in the "Room Script" tab of the developer console. Recent run results show completed, failed, retry count, and errors.

Limits

ItemLimit
Tasks per game10
Task name length40 characters
Minimum interval5 minutes
Duration per run30 seconds
CPU and memorySame as room scripts

A cron schedule that runs more often than every 5 minutes is blocked on upload.

Caveats

The same scheduled time can run more than once. Save the last processed at value so your script handles duplicate runs safely.
  • If an error occurs or the server does not respond, the task retries up to 3 times. Thrown script errors and console.error calls count as errors.
  • If the execution server stops for more than 15 minutes and restarts, missed runs from that period are skipped instead of running all at once.

Game servers

@launchercapital/nekoland-server is the package for your game's own backend. Use it when you handle features like rankings, server-side currency, and multiplayer.

Installation

It has no dependencies. It runs on Web Crypto and works in Node 18+, Bun, Deno, and edge runtimes.

bash
npm i @launchercapital/nekoland-server

Next steps

Verifying players

Verify player tokens sent by the game client on your game server. Use this to identify players on your server.

Initialize the server SDK

Import NekoServer from @launchercapital/nekoland-server and create an instance.

ts
import { NekoServer, NekoServerError } from "@launchercapital/nekoland-server";

const neko = new NekoServer({
  gameId: "gem-rush",
  apiKey: process.env.NEKO_GAME_API_KEY,
  webhookSecret: process.env.NEKO_WEBHOOK_SECRET,
});
NameDescription
gameIdThe gameId value from nekogame.json.
apiKeyThe game API key from Server integration in the Developer Console.
webhookSecretThe webhook secret shown once by neko webhook set when setting up webhooks.
Keep the game API key and webhook secret in server environment variables only. Never include them in game code.

Verify a token

Pass the token your game received from sdk.getPlayerToken() to verifyPlayerToken.

ts
// Token the game got from sdk.getPlayerToken()
const player = await neko.verifyPlayerToken(token);
// { playerId, displayName, isGuest, sandbox, expiresAt }

verifyPlayerToken checks the token's signature, issuer, game, kind, and expiry. On success, it returns an object with playerId, displayName, isGuest, sandbox, and expiresAt.

Use playerId as the account key on your server. For error handling, see Server errors.

Important notes

  • Tokens last 1 hour. For long sessions, verify the token once and use your own session, or have the game send a fresh token.
  • Preview tokens and purchases have sandbox: true. Keep them separate from real records.

Purchases on your server

Verify player purchases and manage grants and refunds from your game server.

Usage

Verify a webhook or check the receipt the client sent (purchase.signedReceipt). Save the grant, then call consume.

ts
await neko.verifyReceipt(signedReceipt);              // Verify the receipt the client sent
await neko.getPurchase(purchaseId);
await neko.listPlayerPurchases(player.playerId);      // Catch up on missed purchases
await neko.refund(purchaseId, "Accidental purchase"); // Developer-initiated refund

API

NameDescription
neko.verifyReceiptVerifies the receipt the client sent.
neko.getPurchaseLooks up purchase details by purchaseId.
neko.listPlayerPurchasesCatches up on missed purchases. Call as neko.listPlayerPurchases(playerId, { all?, sandbox? }). Returns ungranted consumables and owned non-consumables by default.
neko.refundIssues a developer-initiated refund for a purchase.

Notes

  • consume is safe to call more than once.
  • Calling neko.refund returns the cubes to the buyer and deducts them from your revenue. A purchase.refunded webhook follows the refund.

Webhooks

Use webhooks to receive events such as completed purchases, refunds, and player status changes on your game server. This page covers setting your webhook URL, verifying signatures, handling events, and retry rules.

Webhook setup

Register the server URL that receives events using the CLI. The first time you set it, the CLI prints the whsec_… secret used for signature verification.

bash
neko webhook set https://api.example.com/nekoland

After registering, use the commands below to test or manage your webhook. See CLI commands for the full list of CLI commands.

CommandDescription
neko webhook testSends a ping event.
neko webhookShows the registered URL and recent deliveries.
neko webhook secret --rotateRegenerates the secret.

Signature verification and event handling

When you receive a webhook request, verify its signature with neko.verifyWebhook. Pass the raw body string before parsing it as JSON.

ts
// Pass the raw body string, before parsing
const ev = await neko.verifyWebhook(rawBody, req.headers.get("nekoland-signature"));

Branch on ev.type to handle verified events. See Handling purchases on your server for the purchase flow.

ts
switch (ev.type) {
  case "purchase.completed":
    // save the grant (dedupe by ev.data.purchaseId), then consume
    await neko.consume(ev.data.purchaseId);
    break;
  case "purchase.refunded":  /* take back what you granted */ break;
  case "player.suspended":   /* disconnect if online */ break;
  case "player.updated":     /* display name / guest status changed */ break;
}

Event types

The following events are delivered via webhooks.

EventDescription
purchase.completedSent when a purchase completes. Save the grant, dedupe by ev.data.purchaseId, and call neko.consume.
purchase.refundedSent when a purchase is refunded. Includes reason; take back what you granted.
player.updatedSent when a player's display name or guest status changes.
player.suspendedSent when a player is suspended. Disconnect the player if they are online.
player.unsuspendedSent when a player's suspension is lifted.
pingTest event sent when you run neko webhook test.
Player events arrive only for players who have opened this game.

Responses and retries

If your server does not return a success response within the time limit, Nekoland retries the delivery at set intervals.

ItemLimit
Response timeout2xx response within 10 seconds
Retry scheduleAfter 1 min, 5 min, 30 min, 2 h, and 6 h
The same event can be delivered more than once. Dedupe events using ev.id and purchaseId.

Implementing without the package

If you implement webhook handling without the package, follow the specifications below. See Verifying players for details on token verification.

ItemSpecification
Webhook signature headerNekoland-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>
/v1 API auth headerAuthorization: Bearer <game API key>
Token and receipt formatES256 JWT
Public keys URLhttps://nekoland.net/.well-known/jwks.json
JWT claimsiss = nekoland, aud = gameId, sub = playerId

Friends on the server

Retrieve a player's Nekoland friends from your game server. Use this to build friend leaderboards or "join a friend's room" features.

First, follow Player verification to verify the player token and get the playerId. Then pass that playerId to neko.getFriends(playerId).

ts
const player = await neko.verifyPlayerToken(token);
const friends = await neko.getFriends(player.playerId);
// [{ playerId, hasPlayed }]

Each item in the returned array has the following fields.

FieldDescription
playerIdThe friend's playerId in your game.
hasPlayedWhether the friend has played your game.

Server errors

This page lists the cause and what to check for each NekoServerError.code value on your game server. If you encounter an error with player verification, server-side purchases, or webhooks, look up the code in the table below.

CodeWhen it occurs
INVALID_TOKENThe signature or format is invalid.
TOKEN_EXPIREDThe token has expired. Get a new player token in the game with sdk.getPlayerToken().
WRONG_GAMEThe token, receipt, or webhook belongs to another game.
WRONG_KINDYou passed the wrong kind—for example, a receipt where a player token was expected.
INVALID_SIGNATUREThe webhook signature does not match. Check the secret and verify that the body is unmodified.
STALE_WEBHOOKThe webhook timestamp is too old. This may be a replay attack.
CONFIGA required value (gameId, apiKey, or webhookSecret) is missing.
API_ERRORThe platform API call failed. Check status and apiCode.

Unity & Godot

Use this guide to integrate the Nekoland SDK into Unity and Godot projects. Both engines use wrappers around the same JS SDK.

Get started

Install the CLI and run neko sdk add in your project folder. Run the same command to update the SDK.

bash
npm i -g @launchercapital/nekoland-cli
neko sdk add   # in your Unity or Godot project folder

Then follow the copied README to complete setup.

Supported features

The wrappers support the following features:

Friends and invites are available in the JS SDK only for now.

Engine guides

See the guides below for detailed setup instructions for each engine:

Unity

Integrate games built with Unity 2021.3 or later with the Nekoland WebGL environment. Use this page to set up the Nekoland SDK package and prepare your WebGL build.

Project setup

The Nekoland SDK package installs into Packages/com.nekoland.sdk. Next, select Nekoland ▸ Setup WebGL Project from the menu.

Running this command automatically applies the following settings:

  • Installs the Nekoland WebGL template, which includes /__neko/sdk.js.
  • Enables Brotli compression.
  • Disables Decompression Fallback.
In the Unity Editor, the SDK runs against a mock platform. You can test the full flow just by pressing Play.

Getting started

Initialize the SDK and set up events and data in the Start() method when your game starts.

csharp
using Nekoland;

async void Start()
{
    var player = await NekoSDK.InitAsync();             // always first
    NekoSDK.OnPause  += () => Time.timeScale = 0;
    NekoSDK.OnResume += () => Time.timeScale = 1;
    NekoSDK.OnPlayerChanged += async p => await LoadSave();

    await LoadSave();
    foreach (var p in await NekoSDK.Payments.GetPurchasesAsync()) await Grant(p);
    await NekoSDK.GameReadyAsync();                     // dismisses the platform loading screen
    NekoSDK.GameplayStart();
}
The Nekoland WebGL template initializes with manualReady. The platform loading screen stays visible until you call NekoSDK.GameReadyAsync().

See Initialization and Lifecycle for details on initialization order and lifecycle behavior.

API

Key methods and events used in the initialization example:

NameDescription
NekoSDK.InitAsync()Initializes the SDK. You must always call this first.
NekoSDK.OnPauseEvent triggered when the game pauses.
NekoSDK.OnResumeEvent triggered when the game resumes.
NekoSDK.OnPlayerChangedEvent triggered when the player changes.
NekoSDK.Payments.GetPurchasesAsync()Fetches the list of purchases.
NekoSDK.GameReadyAsync()Dismisses the platform loading screen.
NekoSDK.GameplayStart()Signals that gameplay has started.

Important notes

  • To specify your WebGL output folder, set "build": "Build/web" in nekogame.json.
  • Add a Korean font to your project if you display Korean text.

Godot 4

This guide explains how to integrate the Nekoland SDK into a Godot 4 web game. Use it when you set up the addon in your Godot project and export to Web.

Setup

  1. Place the addon in addons/nekoland.
  2. Enable Nekoland SDK under Plugins in Project Settings. Enabling the plugin registers the NekoSDK autoload.
  3. Add <script src="/__neko/sdk.js"></script> to the Web export preset's Head Include.
You can leave Thread Support off. If enabled, your game is served cross-origin isolated and still works. However, older browsers cannot run it.

Getting started

Every async method on NekoSDK returns { ok, data } or { ok: false, code, message }.

Call NekoSDK.init() first when your game starts. Next, connect the signals and handle save data and purchases. When the game is ready, call NekoSDK.gameplay_start().

gdscript
func _ready():
	var res := await NekoSDK.init()                 # always first
	if not res.ok: return
	NekoSDK.paused.connect(func(): get_tree().paused = true)
	NekoSDK.resumed.connect(func(): get_tree().paused = false)
	NekoSDK.player_changed.connect(func(p): load_save())

	await load_save()
	for p in (await NekoSDK.payments_get_purchases()).data: await grant(p)
	NekoSDK.gameplay_start()

For details on the initialization flow and payment handling, see Initialization and lifecycle and Payments.

Tools

Local testing

This page explains how to run your game locally and test SDK behavior on your computer. You can verify payment, login, save, and multiplayer flows directly in your browser before deploying to the platform.

Getting started

Run neko dev to serve your build at http://localhost:8080 with the SDK running in local mock mode. Pass --port to use a different port. See CLI commands for full command usage.

In local mock mode, the SDK behaves as follows:

  • The player name is set to Local Tester.
  • Products are loaded from nekogame.json. Refresh the page after editing the file to apply changes.
  • Purchases, logins, and invites open a small test dialog. No real payment occurs.
  • Saves and purchase history are stored in the browser's localStorage.
  • Cloud storage rules match the platform. Values must be strings, keys can be up to 128 characters, and total storage is limited to 1MB counted in UTF-8 bytes.
  • Multiplayer rooms run on a local relay inside neko dev.
  • A placeholder for the platform menu button (≡) appears at the top-left. Clicking it or pressing Esc fires menu.open and pause just like on the platform. Closing the menu fires menu.close and resume.
  • When manualReady is enabled, the console logs a warning if gameReady() is not called within 60 seconds. See Initialization and lifecycle for details.
Tokens and receipts in local mock mode are unsigned. Test game server integrations such as Player verification and Server-side purchases on the preview after deploying.

Override environment with URL parameters

Append query parameters to the URL to test other languages, phone screens, and additional multiplayer players. Combine these with your browser's device mode.

text
http://localhost:8080/?neko_locale=en-US&neko_device=mobile&neko_safearea=47,0,34,0
ParameterDescription
neko_localeSets the locale to test, e.g. en-US.
neko_deviceSets the device screen to test, e.g. mobile.
neko_safeareaSets the safe area as top,right,bottom,left in CSS px. Roughly 47,0,34,0 for an iPhone in portrait mode.
neko_playerOpen the game in another tab with ?neko_player=2 to join as a second player and test multiplayer rooms.

Other dev servers and init options

Local mock mode turns on automatically when you open the page in a top-level window on localhost, 127.0.0.1, or file:. When using another dev server such as Vite, pass the local option directly to sdk.init().

js
await sdk.init({
  gameId: "gem-rush",
  local: {
    products: [{ productId: "gems_500", type: "consumable", title: "500 Gems", priceCoins: 100 }],
    guest: true,         // start as a guest to test login
    autoApprove: false,  // true: skip dialogs for automated tests
    friends: [
      { playerId: "p_friend1", displayName: "Mina", online: true, inGame: false, hasPlayed: true },
    ],
    invite: { fromPlayerId: "p_friend1", fromName: "Mina", data: "room-42" },
  },
});

To force a specific mode, pass mode as a top-level option to sdk.init(). Accepted values are "local" and "platform".

local options

NameDescription
productsProduct list used in local mock mode.
guestStart as a guest to test the login flow.
autoApproveSet to true to approve requests without test dialogs. Useful for automated tests.
friendsMock friend list for testing.
inviteMock invite data for testing.
displayNameDisplay name for the test player.
storeCustom storage object to replace localStorage in tests.
localeSet the locale in code instead of via URL parameters.
deviceSet the device in code instead of via URL parameters.
platformSet the platform in code instead of via URL parameters.
safeAreaSet the safe area in code instead of via URL parameters.
purchaseErrorError code to simulate failed purchases, e.g. "INSUFFICIENT_COINS".

CLI reference

This page lists the commands and options for neko, the terminal tool for managing your Nekoland account and testing, deploying, and operating games. Every command is non-interactive.

Common options and selecting a game

Run neko --help to see all commands. Per-game commands use the gameId in ./nekogame.json by default. See nekogame.json for the config file format.

OptionDescription
--jsonOutput results as JSON. On error, returns {"error":{"message","code"}} with a non-zero exit code.
--game <gameId>Run the command against the specified gameId instead of the game in ./nekogame.json.

Account and project

CommandDescription
neko loginSign in through the browser. Add --no-browser to print the URL only.
neko logoutRevoke the token and delete it locally.
neko whoamiShow the signed-in account and token permissions.
neko gamesList your games.
neko categoriesList category IDs for nekogame.json.
neko initCreate nekogame.json. Supports --id, --title, --category, --orientation, --build, and --force.

Testing and deployment

CommandDescription
neko devStart a local test server with the mock platform. Use --port to set the port (default: 8080).
neko validateCheck the config, build, and images without uploading.
neko deployUpload a test version. Uploaded versions are not public; only you can preview them. Add --release --checked to upload and publish (your first release goes through review).
neko statusCheck review status, rejection reasons, and the live version.
neko submit [versionId] --checkedPublish a test version you uploaded (requests review for your first release). Without --checked, prints only the release checklist.
neko rollback [versionId]Change the live version. Omit versionId to revert to the previous approved version.
See the review guidelines for first-release review criteria.

Payments and analytics

CommandDescription
neko productsList products on sale and off sale.
neko purchasesList purchases. Supports --player and --sandbox.
neko refund <purchaseId> --reason "…"Refund a purchase.
neko eventsView recent events. Use -f to follow, --names to summarize, and --event to filter.
neko statsView player, retention, revenue, funnel, load time, and error stats. Set --days to 7, 30, or 90.

Opening pages and integrations

CommandDescription
neko openOpen the game page. Supports --play and --console. Pass a version ID to preview that version.
neko webhook …Manage game server webhooks. Subcommands: set, test, secret [--rotate], and remove.
neko sdk addAdd or update the SDK in a Unity or Godot project.
neko skill installInstall SKILL.md for AI agents. Supports --global or --dir.

Environment variables

You can use the following environment variables when running neko commands.

  • NEKO_TOKEN: For example, to set a deploy-only token in CI.
  • NEKO_API_URL
  • NEKO_CREDENTIALS
  • NEKO_NO_UPDATE_CHECK=1

Troubleshooting

This page covers common errors and fixes during development, deployment, and runtime. Check here when an SDK call fails or a deployed game does not work as expected.

Common issues

SymptomFix
TIMEOUT on init()The page is not open on the platform or localhost. Use neko dev or the preview URL. See Local testing for how to run it.
NOT_INITIALIZEDAwait init() before making other calls.
Authentication failedRun neko login again.
TWO_FACTOR_SETUP_REQUIREDTurn on 2-step verification in your account security settings.
"This token can't do that" errorThe token has limited permissions (deploy-only, read-only, or scoped to one game). Use a token with the right scope.
Not in the game list after deployThe game is in review. Check its status with neko status, and use previewUrl in the meantime. See CLI commands for usage.
Upload interruptedRun neko deploy again with the same build. Only the missing parts upload.
Products missing in the gameAdd them to nekogame.json and deploy. getProducts() returns only products on sale.
Assets fail to loadUse relative paths such as ./assets/x.png. /__neko/ is the only allowed absolute path.

SDK error codes

Failed SDK calls reject with NekoSdkError. Check e.code on the error object to identify the cause.

CodeWhen it occurs
NOT_INITIALIZEDCalled before init() finishes.
TIMEOUTThe platform did not respond in time.
USER_CANCELLEDThe player closed the purchase, login, or friend picker dialog.
INSUFFICIENT_COINSThe player does not have enough cubes and closed the top-up screen.
PRODUCT_NOT_FOUNDUnknown product. For consume, this means an unknown purchase ID.
ALREADY_OWNEDThe player already owns this non-consumable product.
PURCHASE_PENDINGPayment is still processing. Check getPurchases() later.
PRICE_CHANGEDThe price changed after the confirmation dialog appeared. Refetch and retry.
INVALID_PRICEpriceCoins for a variable-price product is missing or outside the range of 1 to max.
NOT_LOGGED_INA member account is required, and the player stayed a guest.
INVALID_ARGUMENTInvalid input, such as a cloud save over 1MB or invite data over 500 characters.
BUSYAnother platform window is open, so exit() or openCharge() was not accepted.
UNSUPPORTEDThe platform does not support this call.
INTERNALAn internal platform error occurred.

Build checklist

  • Fit any window size. Draw at a fixed logical resolution, scale by Math.min(innerWidth / W, innerHeight / H), and center it.
  • Redraw on resize. Cap devicePixelRatio at 2.
  • Support touch, mouse, and keyboard. Set touch-action: none.
  • Start audio after user input.
Do not include external ads, external logins, or external payment methods. See the review guidelines for details.

Publishing

Review guidelines

This page covers the criteria your game must meet for its first release on Nekoland and how to handle a rejection. Use it to check runtime behavior, payments, content, and polish before you submit a build.

Review process and rejections

Nekoland reviews every game's first release by playing it manually. Updates after launch go live immediately without review.

Even after a game is live, it can be taken down at any time if it violates these guidelines.

If your submission is rejected, check the Review tab in the developer console or run neko status to view the reason and screenshots. See CLI commands for command usage. Fix the issues, upload a new build, and request review again.

Runtime and basic behavior

  • The game must play from start to finish without getting stuck. Builds that freeze on the start or loading screen, or have unresponsive buttons, are rejected.
  • Call sdk.init() and gameReady() to clear the loading screen. See Initialization and lifecycle for the call sequence.
  • The game must work with touch on phones and with mouse and keyboard on PCs.
  • Nothing should be cut off or overflow at any window size.
  • Use sdk.insets to keep UI clear of the notch and home indicator. Do not overlap the top-left menu button area.
  • Every screen must have a clear way out, such as a close or back button. Closing must work consistently across all screens.

Payments, ads, and privacy

  • Use Nekoland SDK payments only. See Payments for integration details.
  • Do not include outside payments, outside ads, or other logins.
  • Always deliver purchased items. Permanent items must persist after reloading.
  • Product prices and contents must match the product description.
  • Do not collect personal data such as player names or contact details in events or on your game server.

Content and rights

  • Do not submit sexual content, excessive violence, hate, or content that promotes gambling.
  • Do not use other people's images, music, characters, or game names without permission.
  • Clones of well-known games with only the name and art changed are rejected.

Polish and AI-generated content

Games made with AI are welcome. However, output shipped as generated without a human pass—AI slop—is rejected. Common rejection reasons include:

Rejection reasonExamples and requirements
Template lookEvery screen uses the same default generative AI styling, such as a deep navy-purple background, purple or neon accents, and gradient cards. Pick colors and UI that fit your game's concept and in-game art.
Text-only UIEvery menu and button is text-only, making features hard to scan. Use clear icons for main actions and keep text as a supporting label. Using rows of emoji in place of icons is also rejected.
Nothing to playA single screen where tapping only raises a number, or a demo with no goal or progression. The game needs a playable loop worth repeating.
Unfinished bitsLeftover placeholder text such as TODO, Lorem ipsum, or Coming soon, non-functional menus, broken characters, mixed Korean and English text, or stiff machine translation.
Unedited generated artUnedited images with garbled text, distorted hands or shapes, or art styles that change from screen to screen.
Misleading listingThe description lists features the game does not have, or the thumbnail and screenshots do not match the actual game. A short, honest description is enough.
The same game many timesUploading multiple near-identical games with only the name or colors changed.

Game page

  • The thumbnail must be a square image that represents the game.
  • Screenshots must be 16:9 images of real gameplay.
  • Write the title and description naturally in the languages you support.

Revenue & payouts

This page explains the payout terms that apply when players buy cubes from Nekoland and spend them on your products. Use it to check payout requirements and track sales after you add payments to your game.

Payout terms

ItemDetails
Sales conversion1 cube = $0.01 of sales
Default creator share70% of sales
Creator share for games using room scripts55% of sales (includes an additional 15 percentage point platform fee)
Payout thresholdPaid out when your unpaid sales exceed $100

Revenue exclusions

  • Developer-initiated refunds are deducted from revenue.
  • Test purchases in preview mode and local mode do not count toward revenue.

Tracking sales

You can track sales in the following places:

See the revenue policy for full terms.