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
playerIdis 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.
npm i -g @launchercapital/nekoland-cli
After installation finishes, log in to your account.
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.
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.
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.
neko validate
Fix every error and warning reported by the check.
Next, run neko dev to test your game locally.
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.
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.
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:
- Install the CLI and run
neko login. When the agent shows you the 8-letter code, approve it in the browser. - Install the Nekoland skill file (
SKILL.md) withneko skill installand follow it. The Nekoland skill is a compact version of this page written for agents. - Create
nekogame.jsonand add the SDK. The agent asks you for the game ID. Build the game and verify it withneko validateandneko dev. - Run
neko deployto 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.
{
"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"
}
gameId after your first deploy. A new ID creates a new game, and saves and purchases do not carry over.Fields
| Name | Description |
|---|---|
gameId | Required. The game's address and identity. Must start with a lowercase letter and contain only lowercase letters, digits, and hyphens. |
title | Required. The game title. |
description | One or two sentences shown on the game page. |
category | A category ID returned by neko categories (for example, casual). |
orientation | Screen 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. |
languages | Languages 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. |
build | Path to the folder with index.html at its root. |
thumbnail | Path to a square image. Supports PNG, JPG, and WebP. |
products | In-game products. See Product settings below for details. |
media | Optional. Images or YouTube videos shown on the game page. |
links | Optional. HTTPS URLs for each site under the x, youtube, and discord keys. |
threads | Optional. 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.
{
"products": [
{ "productId": "gems_500", "type": "consumable", "title": "500 Gems", "priceCoins": 100 },
{ "productId": "no_ads", "type": "non_consumable", "title": "Remove Ads", "priceCoins": 300 }
]
}
| Name | Description |
|---|---|
productId | Product ID. Only a-z, 0-9, _, and . are allowed. |
type | Set to consumable for consumable items or non_consumable for permanent items. Once set to non_consumable, it cannot be changed later. |
title | Product name. |
description | Optional. Product description. |
priceCoins | Product price in Cubes. Must be a positive integer. |
variablePrice | Set 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. |
Media and external links
Add screenshots, videos, and official channel links under media and links.
{
"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
| Item | Limit |
|---|---|
gameId length | 4–40 characters |
title length | 1–80 characters |
description length | Up to 2,000 characters |
build folder size | Up to 500MB |
build file count | Up to 1,500 files |
thumbnail resolution | At least 256×256 (512×512 recommended) |
thumbnail file size | Up to 2MB |
productId length | 1–64 characters |
media count | Up to 10 items |
media image resolution and aspect ratio | 16:9, at least 960×540 |
media image file size | Up to 4MB |
Notes
descriptionandthumbnailare 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
productsare taken off sale on deploy. mediaandlinksreplace 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
| Guide | Description |
|---|---|
| Installation | Install the SDK. |
| Initialization and lifecycle | Initialize the SDK and handle its lifecycle. |
| Player and login | Integrate player and login features. |
| Payments | Integrate payments. |
| Cloud storage | Use cloud storage. |
| Friends and invites | Integrate friends and invites. |
| Analytics events | Use analytics events. |
| Vibration | Use vibration. |
| Player token | Use 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.
<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.
npm i @launchercapital/nekoland-sdk
After installing the package, create a NekoSDK instance.
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.
const player = await sdk.init({ gameId: "gem-rush" }); // the gameId in nekogame.json
You can pass the following options to sdk.init(options):
| Name | Description |
|---|---|
gameId | Required. The game ID set in nekogame.json. |
manualReady | If true, keeps the platform loading screen open until you call sdk.gameReady(). |
mode | Execution mode: "auto", "platform", or "local". |
local | Local development settings. See Local testing. |
timeoutMs | Initialization timeout. Default is 10,000. |
extraHostOrigins | Local 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.
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
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.
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.
// 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));
| Name | Description |
|---|---|
sdk.insets.menu | Area 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.safeArea | Safe 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. |
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.
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 getspausewhen it opens andresumewhen 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.
// 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.
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 */ });
| Name | Description |
|---|---|
pause | Fires 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. |
resume | Fires when returning to the game or when the platform menu closes. Restore audio. |
player.changed | Fires when a guest signs in or the account changes. Reload the save because playerId may have changed. |
insets.changed | Fires when the screen rotates. Reposition your HUD using the updated insets. |
menu.open | Fires when the platform menu opens. pause also fires. |
menu.close | Fires when the platform menu closes. resume also fires. |
API
| Name | Description |
|---|---|
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, andplayerAPIs only aftersdk.init()completes. Calling them earlier raises aNOT_INITIALIZEDerror. - You can call
on(),track()from Analytics,gameplayStart(), andgameplayStop()beforesdk.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.
const { playerId, displayName, avatarUrl, isGuest, locale } = sdk.player;
| Name | Description |
|---|---|
playerId | Player identifier. Stable within the same game and different in every game. |
displayName | The player's display name. |
avatarUrl | Absolute profile photo URL. Missing if the player has no profile photo. CORS-enabled so you can draw it on a canvas. |
isGuest | Whether the player is a guest. |
locale | The player's language setting, such as ko-KR. |
Guest login
Call sdk.login() to ask a guest player to log in or sign up.
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.
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.
| Name | Description |
|---|---|
sdk.platform | The current platform. "web" in a browser, or "ios" or "android" in the Nekoland app. |
sdk.device | The device type. "mobile" on touch phones and tablets, or "desktop" on a computer. |
sdk.sandbox | true in a pre-approval preview and in local mode. Purchases are processed as test purchases in this mode. |
sdk.isLocal | true in local test mode. |
Things to note
- Use
sdk.deviceto 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.sandboxorsdk.isLocalistrue.
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.
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.
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.
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.
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
| Name | Description |
|---|---|
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.
| Code | When |
|---|---|
USER_CANCELLED | The player closed the dialog. Ignore it. |
NOT_LOGGED_IN | A guest declined to sign in. |
INSUFFICIENT_COINS | The top-up screen was shown and closed without buying cubes. |
ALREADY_OWNED | The player tried to buy a permanent product they already own. Unlock the product. |
PURCHASE_PENDING | Payment is still processing. Check getPurchases() later. |
PRICE_CHANGED | The price changed after the confirm dialog was shown. Refetch products and try again. |
INVALID_PRICE | A variable-price product is missing priceCoins, or the value is not an integer from 1 to the maximum. |
PRODUCT_NOT_FOUND | The product is not on sale, or the purchase ID passed to consume does not exist. Check nekogame.json and deploy. |
TIMEOUT | The platform did not respond in time. |
Important notes
- Never draw your own purchase confirm dialog in your game.
- Never call
consumeon 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.
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.
Usage
Values are strings, so convert objects to JSON before storing them.
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
| Name | Description |
|---|---|
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
| Item | Limit |
|---|---|
| Storage size | 1MB 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.
playerId for this game.Load the friend list
Call sdk.friends.list() to get the friend list. For guests, it returns an empty list.
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.
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.
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.
const { status } = await sdk.friends.add(otherPlayerId);
API
| Name | Description |
|---|---|
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.invite | Holds { 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:
| Field | Description |
|---|---|
playerId | The friend's player ID for this game. |
displayName | The friend's display name. |
avatarUrl? | The friend's avatar URL. May be omitted. |
online | Whether the friend is on Nekoland right now. Online status is shown by default and is false if the friend hides it. |
inGame | Whether the friend is playing this game right now. |
hasPlayed | Whether the friend has opened this game before. |
Errors
| Code | When |
|---|---|
USER_CANCELLED | The player closed the friend picker in sdk.friends.invite() or the confirm dialog in sdk.friends.add(). |
NOT_LOGGED_IN | A guest declined the login prompt after calling sdk.friends.invite(). |
INVALID_ARGUMENT | You passed the player's own playerId or a player who cannot receive requests to sdk.friends.add(). |
Limits
| Item | Limit |
|---|---|
data length in sdk.friends.invite() | Up to 500 characters |
Important notes
datainsdk.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.
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.
| Item | Limit |
|---|---|
| Event name length | Up to 40 characters |
| Property keys | Up to 20 |
| Property string value length | Up to 100 characters |
| Total properties size | Up to 2KB |
Queued events before init | Up to 100 |
Suggested names
Use these names for common game events:
level_start,level_complete,level_failtutorial_completeitem_earn,item_spend
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.tracknever 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.
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.
| Style | Description |
|---|---|
light, medium, heavy | Vibration by strength. |
success, warning, error | Vibration by result. |
selection | A very light tick. |
Behavior by environment
Vibration behavior depends on the runtime environment.
| Environment | Behavior |
|---|---|
| Nekoland app | Vibrates natively, including on iPhone. |
| Android browsers | Uses navigator.vibrate. |
| iOS browsers | Does nothing because there is no way to vibrate. |
Caveats
sdk.hapticdoes not wait for a result or throw an error.- Calls made before
initare 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.
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.
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.
| Approach | Use it for | Revenue share |
|---|---|---|
SDK only (sdk.storage) | Single-player, saves, personal high scores | 70% |
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 currency | 70% |
Room scripts ("room": { "script": ... }) | Anti-cheat arbitration, items and currency, trading, persistent characters, fair rankings, map- and channel-based RPGs, server-side purchase fulfillment | 55% |
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 worlds | 70% |
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 version | Supported features |
|---|---|
| 0.7.0 and later | Message forwarding between players in the same room |
| 0.8.0 and later | Quick match, room list, passwords, kick, ping, neko dev local rooms |
| 0.9.0 and later | Friends-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.
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.storagealone. 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.
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.
// 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.
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.
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().
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().
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.
| Name | Description |
|---|---|
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():
| Name | Description |
|---|---|
maxPlayers | Maximum number of players in the room. |
meta | Shared room metadata. |
public | When true, lists the room publicly and makes it joinable by quick match. |
password | Room password. Password-protected rooms are never listed and require the same password to join. |
match | Matchmaking key (such as a game mode name) used for quick match and listing. |
friendsOnly | When true, only the host's Nekoland friends can join. |
Properties and methods on the room object returned after joining:
| Name | Description |
|---|---|
room.code | The room code. |
room.meta | Shared metadata stored on the room. |
room.isHost | Whether 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():
| Name | Description |
|---|---|
message | Fires when another player sends a message. Payload: { from, data }. |
join | Fires when a new player joins. Payload contains player info with displayName and playerId. |
leave | Fires when a player leaves. Payload: { playerId, host }. If the host changes, host contains the new host. |
close | Fires when the room connection ends. Payload: { reason }, where reason is left, kicked, disconnected, replaced, or closed (from a room script). |
Errors
| Code | When it occurs |
|---|---|
NOT_LOGGED_IN | A guest declines the login dialog shown when joining a room. |
ROOM_NOT_FOUND | No room exists for the given code. |
ROOM_FULL | The room has reached its maximum number of players. |
WRONG_PASSWORD | The password does not match. |
KICKED | The player tries to rejoin a room they were kicked from. |
NOT_FRIEND | A player who is not a Nekoland friend of the host tries to join a friends-only room. |
ALREADY_IN_ROOM | The player is already in a room. |
Limits
| Item | Limit |
|---|---|
| Room code length | 6 characters |
list() results | Up to 50, newest first |
| Message size | Up to 64KB per message |
| Messages per second | About 30 |
| Bandwidth per second | Up 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
closeevent fires withreasonset todisconnected. If the same player joins from another tab, the old tab closes withreasonset toreplaced. - Preview and CBT players use separate rooms from live players.
- Unity provides the same features via
NekoSDK.Rooms, and Godot 4 viaNekoSDK.rooms_create()and related methods.
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.
{
"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.
// 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.
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.
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.
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.
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.
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 devruns your room script locally with the same API as the server. When you edit the file, changes apply starting with newly opened rooms.console.logoutput prints to the terminal as[room <roomCode>].neko deploybundles your script and imported files (such as ashared/folder) into a single JS file and uploads it under the same version as your build. Importing Node modules likefsfails the deploy, and using APIs unavailable on the server likefetchorsetTimeoutproduces 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
consoleoutput, 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,
onLeaveruns 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. Theroommovedevent fires withupdate: 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
closeevent fires withreasonset to"update", so you need to rematch. - CBT testers must refresh their link to get the new version.
API
Room handlers passed to defineRoom:
| Name | Description |
|---|---|
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):
| Name | Description |
|---|---|
room.state | State kept only in room memory. Lost when the room closes. |
room.now | Server 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.
| Name | Description |
|---|---|
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).set | Sets a score on the leaderboard. |
scores(board).increment | Increments or decrements a score on the leaderboard. |
scores(board).max | Saves the score only if it is higher than the current best. |
scores(board).top | Returns 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:
| Name | Description |
|---|---|
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:
| Code | When |
|---|---|
NOT_NUMBER | Calling increment(key, by) when the stored value is not a number. |
VERSION_MISMATCH | Calling 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.
| Item | Limit |
|---|---|
| Deploy bundle size | 1MB |
setTick frequency | 30 calls per second |
| Execution time per call | 50ms |
| CPU time | 2 seconds per 10 seconds |
| Memory per engine | 128MB shared across up to 16 rooms in the same engine |
| Outgoing message size | 256KB |
| Consecutive errors allowed | 10 |
room.storage value size | 64KB JSON |
scores(board).top limit | 1 to 100 |
sdk.roomData.get key count | 20 |
| Developer Console recent logs | 200 lines |
| Room switch time on new version | Within 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.storagehas 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, notroom.state. - Calling
room.storagetoo frequently can hit the requests-per-minute limit. Accumulate changes inroom.stateand 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.
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.
// 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.
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.
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 {}
}
}
room.storage (Room storage and payments).Client API
| Name | Description |
|---|---|
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" event | Fires with { code, name } when moved to another room. Use NekoRoom.OnMoved in Unity and the room_moved signal in Godot. |
room.channel | Reads the current channel number from the client Room object. |
Room script API
| Name | Description |
|---|---|
room.name | Room name for named rooms, or null for code-joined rooms. |
room.code | Current room code. |
room.channel | Current 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
| Code | When |
|---|---|
ROOM_FULL | The specified channel is full when calling joinNamed with a channel. |
VERSION_MISMATCH | The version passed to room.shared.set does not match the currently stored version. |
Limits
| Item | Limit |
|---|---|
| Room name length | 1–64 characters |
| Room capacity | Default 16, max 16 players |
| Max channels per named room | Up to 99 channels |
| Shared variable value size | 4KB JSON |
| Shared variable key count | 1,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.movePlayerdoes not move the player and logs a warning to the developer console. room.sendToRoomandroom.broadcastRoomsdeliver 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.
// 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.
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.
// 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 format | Description |
|---|---|
{ 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.
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.
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.
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
| Name | Description |
|---|---|
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
| Code | When it occurs |
|---|---|
RATE_LIMITED | Your game exceeds its per-minute storage limit. |
OUT_OF_RANGE | An increment result in a batch falls outside min or max, canceling the entire batch. |
VERSION_MISMATCH | A version in a batch does not match the current version, canceling the entire batch. |
ALREADY_CONSUMED | room.payments.consume is called for a purchase that was already granted. |
NOT_FOUND | The purchase passed to room.payments.consume does not belong to that player. |
Limits
| Item | Limit |
|---|---|
Single room.storage value size | Up to 64KB of JSON (fits one character save, such as inventory, equipment, and quests) |
room.shared shared variable size | Up to 4KB |
Changes per room.storage.batch | Up to 20 |
| Per-minute storage quota per game | 1 per request plus 1 per 4KB written; batch counts double |
scores name format | 1–64 characters; letters, digits, _, ., :, and - only |
offset in scores.range | 0–10000 |
limit in scores.range | 1–100 |
limit in list | 1–100 (default: 20) |
Combined value size per list response | Stops reading and returns when the total exceeds 512KB |
Important notes
- Every call to
room.storagesends one request to the Nekoland database. Saving on every monster kill quickly fills your per-minute limit and can cause aRATE_LIMITEDerror. - 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.
// 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.
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
| Name | Description |
|---|---|
room.data.get | Reads JSON data by folder, file, and key path. Returns null if not found. |
onMessage | Receives byte data sent by a player as a Uint8Array. |
room.send | Pass a Uint8Array to send a byte message to a player with from set to "$room". |
room.broadcast | Pass 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.
Limits
| Item | Limit |
|---|---|
Total size of .json files in the data folder | Up to 8MB |
| Wait time for in-progress saves on room close | Up to 5 seconds |
Caveats
- Values returned by
room.data.getare 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.
Registering tasks
Add a "schedule" array under "room" in nekogame.json.
"room": {
"script": "server/room.ts",
"schedule": [
{ "name": "weeklyRewards", "cron": "0 0 * * 1", "tz": "Asia/Seoul" },
{ "name": "fieldBoss", "cron": "0 20 * * *", "tz": "Asia/Seoul" }
]
}
| Option | Description |
|---|---|
name | Task name. Must start with a letter and contain only letters, digits, and _. |
cron | Five-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. |
tz | Time 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.
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.
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.
| Name | Description |
|---|---|
onSchedule(room, job) | Handler called at the scheduled time. job is a { name, at } object. |
job.name | Task name registered in nekogame.json. |
job.at | Scheduled time in ms. |
room.code | Set to "$schedule" in a scheduled task room. |
room.storage | Accesses room storage and payments. |
room.data | Accesses game data. |
room.shared | Accesses room.shared. |
room.broadcastRooms | Sends 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 devruns tasks on theircronschedule. 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
| Item | Limit |
|---|---|
| Tasks per game | 10 |
| Task name length | 40 characters |
| Minimum interval | 5 minutes |
| Duration per run | 30 seconds |
| CPU and memory | Same as room scripts |
A cron schedule that runs more often than every 5 minutes is blocked on upload.
Caveats
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.errorcalls 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.
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.
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,
});
| Name | Description |
|---|---|
gameId | The gameId value from nekogame.json. |
apiKey | The game API key from Server integration in the Developer Console. |
webhookSecret | The webhook secret shown once by neko webhook set when setting up webhooks. |
Verify a token
Pass the token your game received from sdk.getPlayerToken() to verifyPlayerToken.
// 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.
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
| Name | Description |
|---|---|
neko.verifyReceipt | Verifies the receipt the client sent. |
neko.getPurchase | Looks up purchase details by purchaseId. |
neko.listPlayerPurchases | Catches up on missed purchases. Call as neko.listPlayerPurchases(playerId, { all?, sandbox? }). Returns ungranted consumables and owned non-consumables by default. |
neko.refund | Issues a developer-initiated refund for a purchase. |
Notes
consumeis safe to call more than once.- Calling
neko.refundreturns the cubes to the buyer and deducts them from your revenue. Apurchase.refundedwebhook 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.
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.
| Command | Description |
|---|---|
neko webhook test | Sends a ping event. |
neko webhook | Shows the registered URL and recent deliveries. |
neko webhook secret --rotate | Regenerates 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.
// 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.
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.
| Event | Description |
|---|---|
purchase.completed | Sent when a purchase completes. Save the grant, dedupe by ev.data.purchaseId, and call neko.consume. |
purchase.refunded | Sent when a purchase is refunded. Includes reason; take back what you granted. |
player.updated | Sent when a player's display name or guest status changes. |
player.suspended | Sent when a player is suspended. Disconnect the player if they are online. |
player.unsuspended | Sent when a player's suspension is lifted. |
ping | Test event sent when you run neko webhook test. |
Responses and retries
If your server does not return a success response within the time limit, Nekoland retries the delivery at set intervals.
| Item | Limit |
|---|---|
| Response timeout | 2xx response within 10 seconds |
| Retry schedule | After 1 min, 5 min, 30 min, 2 h, and 6 h |
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.
| Item | Specification |
|---|---|
| Webhook signature header | Nekoland-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")> |
/v1 API auth header | Authorization: Bearer <game API key> |
| Token and receipt format | ES256 JWT |
| Public keys URL | https://nekoland.net/.well-known/jwks.json |
| JWT claims | iss = 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).
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.
| Field | Description |
|---|---|
playerId | The friend's playerId in your game. |
hasPlayed | Whether 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.
| Code | When it occurs |
|---|---|
INVALID_TOKEN | The signature or format is invalid. |
TOKEN_EXPIRED | The token has expired. Get a new player token in the game with sdk.getPlayerToken(). |
WRONG_GAME | The token, receipt, or webhook belongs to another game. |
WRONG_KIND | You passed the wrong kind—for example, a receipt where a player token was expected. |
INVALID_SIGNATURE | The webhook signature does not match. Check the secret and verify that the body is unmodified. |
STALE_WEBHOOK | The webhook timestamp is too old. This may be a replay attack. |
CONFIG | A required value (gameId, apiKey, or webhookSecret) is missing. |
API_ERROR | The 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.
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:
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
NekolandWebGL template, which includes/__neko/sdk.js. - Enables Brotli compression.
- Disables Decompression Fallback.
Getting started
Initialize the SDK and set up events and data in the Start() method when your game starts.
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();
}
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:
| Name | Description |
|---|---|
NekoSDK.InitAsync() | Initializes the SDK. You must always call this first. |
NekoSDK.OnPause | Event triggered when the game pauses. |
NekoSDK.OnResume | Event triggered when the game resumes. |
NekoSDK.OnPlayerChanged | Event 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
- Place the addon in
addons/nekoland. - Enable Nekoland SDK under Plugins in Project Settings. Enabling the plugin registers the
NekoSDKautoload. - Add
<script src="/__neko/sdk.js"></script>to the Web export preset's Head Include.
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().
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 pressingEscfiresmenu.openandpausejust like on the platform. Closing the menu firesmenu.closeandresume. - When
manualReadyis enabled, the console logs a warning ifgameReady()is not called within 60 seconds. See Initialization and lifecycle for details.
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.
http://localhost:8080/?neko_locale=en-US&neko_device=mobile&neko_safearea=47,0,34,0
| Parameter | Description |
|---|---|
neko_locale | Sets the locale to test, e.g. en-US. |
neko_device | Sets the device screen to test, e.g. mobile. |
neko_safearea | Sets the safe area as top,right,bottom,left in CSS px. Roughly 47,0,34,0 for an iPhone in portrait mode. |
neko_player | Open 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().
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
| Name | Description |
|---|---|
products | Product list used in local mock mode. |
guest | Start as a guest to test the login flow. |
autoApprove | Set to true to approve requests without test dialogs. Useful for automated tests. |
friends | Mock friend list for testing. |
invite | Mock invite data for testing. |
displayName | Display name for the test player. |
store | Custom storage object to replace localStorage in tests. |
locale | Set the locale in code instead of via URL parameters. |
device | Set the device in code instead of via URL parameters. |
platform | Set the platform in code instead of via URL parameters. |
safeArea | Set the safe area in code instead of via URL parameters. |
purchaseError | Error 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.
| Option | Description |
|---|---|
--json | Output 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
| Command | Description |
|---|---|
neko login | Sign in through the browser. Add --no-browser to print the URL only. |
neko logout | Revoke the token and delete it locally. |
neko whoami | Show the signed-in account and token permissions. |
neko games | List your games. |
neko categories | List category IDs for nekogame.json. |
neko init | Create nekogame.json. Supports --id, --title, --category, --orientation, --build, and --force. |
Testing and deployment
| Command | Description |
|---|---|
neko dev | Start a local test server with the mock platform. Use --port to set the port (default: 8080). |
neko validate | Check the config, build, and images without uploading. |
neko deploy | Upload 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 status | Check review status, rejection reasons, and the live version. |
neko submit [versionId] --checked | Publish 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. |
Payments and analytics
| Command | Description |
|---|---|
neko products | List products on sale and off sale. |
neko purchases | List purchases. Supports --player and --sandbox. |
neko refund <purchaseId> --reason "…" | Refund a purchase. |
neko events | View recent events. Use -f to follow, --names to summarize, and --event to filter. |
neko stats | View player, retention, revenue, funnel, load time, and error stats. Set --days to 7, 30, or 90. |
Opening pages and integrations
| Command | Description |
|---|---|
neko open | Open 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 add | Add or update the SDK in a Unity or Godot project. |
neko skill install | Install 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_URLNEKO_CREDENTIALSNEKO_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
| Symptom | Fix |
|---|---|
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_INITIALIZED | Await init() before making other calls. |
Authentication failed | Run neko login again. |
TWO_FACTOR_SETUP_REQUIRED | Turn on 2-step verification in your account security settings. |
"This token can't do that" error | The 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 deploy | The game is in review. Check its status with neko status, and use previewUrl in the meantime. See CLI commands for usage. |
| Upload interrupted | Run neko deploy again with the same build. Only the missing parts upload. |
| Products missing in the game | Add them to nekogame.json and deploy. getProducts() returns only products on sale. |
| Assets fail to load | Use 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.
| Code | When it occurs |
|---|---|
NOT_INITIALIZED | Called before init() finishes. |
TIMEOUT | The platform did not respond in time. |
USER_CANCELLED | The player closed the purchase, login, or friend picker dialog. |
INSUFFICIENT_COINS | The player does not have enough cubes and closed the top-up screen. |
PRODUCT_NOT_FOUND | Unknown product. For consume, this means an unknown purchase ID. |
ALREADY_OWNED | The player already owns this non-consumable product. |
PURCHASE_PENDING | Payment is still processing. Check getPurchases() later. |
PRICE_CHANGED | The price changed after the confirmation dialog appeared. Refetch and retry. |
INVALID_PRICE | priceCoins for a variable-price product is missing or outside the range of 1 to max. |
NOT_LOGGED_IN | A member account is required, and the player stayed a guest. |
INVALID_ARGUMENT | Invalid input, such as a cloud save over 1MB or invite data over 500 characters. |
BUSY | Another platform window is open, so exit() or openCharge() was not accepted. |
UNSUPPORTED | The platform does not support this call. |
INTERNAL | An 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. CapdevicePixelRatioat 2. - Support touch, mouse, and keyboard. Set
touch-action: none. - Start audio after user input.
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.
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()andgameReady()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.insetsto 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 reason | Examples and requirements |
|---|---|
| Template look | Every 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 UI | Every 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 play | A 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 bits | Leftover 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 art | Unedited images with garbled text, distorted hands or shapes, or art styles that change from screen to screen. |
| Misleading listing | The 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 times | Uploading 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
| Item | Details |
|---|---|
| Sales conversion | 1 cube = $0.01 of sales |
| Default creator share | 70% of sales |
| Creator share for games using room scripts | 55% of sales (includes an additional 15 percentage point platform fee) |
| Payout threshold | Paid 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:
- Developer console
- Revenue page
neko statscommand in the CLI