VibePlayDocs

Docs › Developers

Game kit SDK (window.VP)

Reference for window.VP in VibePlay games: screen states, events, ads, Gems, the coin wallet and shop, saves, leaderboards and achievements.

Updated November 17, 2026

Games on VibePlay talk to the Arcade through window.VP. The kit is added to games in the Arcade, the studio preview and exports. Always guard calls (window.VP && VP.ads && ...), because a game must also work without it.

Mode and screen states

  • VP.mode: 'feed' (a short guest run in the swipe feed) or 'full'.
  • VP.state('menu' | 'playing' | 'gameover', { score, level }): call on every screen change. It feeds rounds, scores and store screenshots.
  • VP.event(name, props): custom analytics. Names are snake_case (up to 32 characters), with up to 8 properties. Common ones are level_start, level_complete and level_fail.

Ads and the VibePlay Pass

  • await VP.ads.available(): whether an ad can be shown; hide your ad button if not.
  • await VP.ads.rewarded() returns { ok }. Give the reward only when ok is true. Players with the Pass get ok at once, with no ad.
  • VP.ads.interstitial(): only between rounds, never in the first minute.
  • Both take an optional placement: VP.ads.rewarded({ placement: 'double_reward' }), VP.ads.interstitial({ placement: 'level_end' }). Use short snake_case names such as level_end, game_over, continue, double_reward, hint, shop. Without one, the Arcade works it out from your screen state and level events (level_end, game_over, menu, in_game).
  • Levels: send VP.event('level_start', { level }) with a whole number from 1, also in endless games (a wave, a minute, every 10 points). If you only pass level in VP.state('playing', { level }), the kit reports it for you.
  • VP.player.isAdFree(): true while the player has the Pass; hide your own ad buttons. VP.player.refresh() asks again.

Gems

  • await VP.gems.get() returns the player's Gem balance.
  • await VP.gems.spend(n, 'reason') returns { ok, gems }. The player confirms anything but one Continue a minute.
  • VP.store.open('gems') (or VP.gems.buy()) opens the VibePlay Store.

Coins, shop and runs

  • VP.wallet.get(), add(n, why), spend(n, why), level(id), owned(id), skin(), state(), onChange(fn). In the Arcade the balance is one shared wallet for all games, so subscribe with onChange and do not keep your own coin counter in localStorage.
  • VP.shop.configure({ upgrades, skins }), VP.shop.open(). A skin may have gemPrice next to price; price: null with a gemPrice makes a Gems-only skin.
  • VP.run.start() at the start of each run; VP.run.canContinue().
  • VP.gameOver({ score, best, coins, level, reason, perSecond, continueCost, onContinue, onRestart, onClose }): the game over screen with Continue (up to two a run), the leaderboard and the shop. Coins passed here are added to the wallet; do not also add them with VP.wallet.add.
  • VP.daily.show(), VP.daily.state(): the daily bonus (shown by the kit once a day).

Saves

  • VP.save(key, data) / VP.load(key): small progress values, up to 16 KB a key. Kept in the browser and, for signed-in players, in the cloud.
  • VP.cloud.onLoad(fn): runs once the cloud copy is merged; re-read progress there.
  • VP.cloud.syncStorage(keys?): if your game keeps progress in localStorage, call this at start to sync those keys too.

Use one of these for progress, so it survives Safari and follows signed-in players. See Saves and progress.

Leaderboards and achievements

  • VP.leaderboard.submit(score) returns { ok, rank }; VP.leaderboard.top() returns { ok, rows }.
  • VP.achievements.define([{ id, title, description, icon }]): once at start, 6 to 8 achievements, one emoji icon each.
  • VP.achievements.unlock(id) returns { ok, first, pct }. Also isUnlocked(id) and list().

Other helpers

  • VP.share({ text, payload }) opens the share sheet with the game link, or copies it. payload is a small object, or a string of letters, digits, _ and -, up to 1,500 characters in the link. It travels after #, so no server sees it. The friend's game reads it with VP.share.payload(), which returns the same object or string, or null. Check the data before you use it: anyone can edit a link.
  • VP.music.set(on), VP.music.mood('cozy' | 'arcade' | 'dreamy' | 'lofi' | 'adventure' | 'breeze').
  • VP.haptic(kind), VP.haptic.set(on).
  • window.VP_ASSETS: { name: dataURL } for images added in the studio.
  • window.VP_SHOTS === true: the screenshot robot is playing; run a simple autopilot for about 30 seconds, then let the game end.

Still stuck?

Open Support in the studio or the Arcade to send us a ticket, or email hello@vibeplay.gg.

Was this helpful?