Capabilities

What each capability unlocks and how to declare them.

Capabilities are how the SDK tells the platform “this game is prepared to handle X.” Declare every capability your game uses in init(). The SDK refuses to call gated methods if the matching capability is missing.

import { gamee } from '@gamee/sdk';

await gamee.init({
  capabilities: ['saveState', 'rewardedAds', 'logEvents'],
});

The full list lives in ALL_CAPABILITIES:

import { ALL_CAPABILITIES } from '@gamee/sdk';
// → ['saveState', 'rewardedAds', 'logEvents', 'missions', 'gems']

Unknown values throw GameeError({ code: 'VALIDATION' }) at init() time. Calling a gated method without the capability throws GameeError({ code: 'CAPABILITY_MISSING' }) synchronously, before reaching the wire — wrap calls in try/catch if you don’t always declare the capability.

saveState#

Persist a serialized blob between sessions. The platform stores it; your game gets it back in init()’s response (initResponse.saveState).

Unlocks: gameSaveState(data) and the saveStateData field on gameOver().

await gamee.init({ capabilities: ['saveState'] });

// On boot, read the previous save (a string — JSON if you stringified it):
const previous = gamee.initResponse?.saveState;
if (previous) restore(JSON.parse(previous));

// During play, snapshot at any time. The SDK stringifies for you.
gamee.gameSaveState({ level: 3, gold: 120 });

// At end of run, ship the latest snapshot together with the score:
gamee.gameOver({ saveStateData: { level: 3, gold: 120 } });

rewardedAds#

Show a rewarded video and react to whether the user watched it.

Unlocks: loadRewardedVideo(), showRewardedVideo().

await gamee.init({ capabilities: ['rewardedAds'] });

// Optional: pre-warm before you offer the player the reward.
const { videoLoaded } = await gamee.loadRewardedVideo();
if (!videoLoaded) hideExtraLifeButton();

// Player tapped "watch ad for an extra life":
const { videoPlayed } = await gamee.showRewardedVideo();
if (videoPlayed) grantExtraLife();

The platform also fires the useExtraLife event after the user redeems the reward (see events).

logEvents#

Send custom analytics events to the GAMEE platform.

Unlocks: logEvent(name) / logEvent({ name, value }).

Hard limits validated locally — exceeding either throws VALIDATION:

  • name: non-empty string, max 24 chars.
  • value: string, max 160 chars.
await gamee.init({ capabilities: ['logEvents'] });

gamee.logEvent({ name: 'boss_defeated', value: JSON.stringify({ id: 'azuki', tries: 3 }) });

missions#

Used when the platform launched the game in a mission context.

Unlocks: updateMissionProgress(0..100). Also: initResponse.missionData contains the mission config when the user opened the game from a mission card.

await gamee.init({ capabilities: ['missions'] });

if (gamee.initResponse?.gameContext === 'mission') {
  const m = gamee.initResponse.missionData; // { id, value, difficulty?, ... }
  configureForMission(m);
}

// During play, report progress (0–100, must be a finite number).
gamee.updateMissionProgress(42);

gems#

In-game purchase paid in GAMEE gems.

Unlocks: purchaseItemWithGems(details).

details.gemsCost must be ≥ 0; details.itemName must be a non-empty string.

await gamee.init({ capabilities: ['gems'] });

const result = await gamee.purchaseItemWithGems({
  gemsCost: 50,
  itemName: 'extra_life',
});
if (result.success) grantExtraLife();

Capabilities that no longer exist#

Five gamee-js capabilities did not carry over. If you used them, see the migration guide for what to do instead.

gamee-js capabilityStatus
replayRemoved — requestPlayerReplay and replay data are gone.
ghostModeRemoved — ghostShow/ghostHide events are gone.
socialDataRemoved — requestSocial was deprecated in gamee-js.
playerDataRemoved — requestPlayerData is gone.
platformExtraLifeRemoved — listen for the useExtraLife event directly.

Switch to a desktop

The GAMEE SDK emulator and docs are built for screens wider than 1280 px. Open this page on a laptop or desktop browser to get the full experience.

If you're already on a wide screen, drag your window wider and this banner will disappear.