PlayDrop logoPlayDrop Studio
CreatePlayTradeEarnLearnConnectorsAssetsCommunitySupport
PlayDrop logoPlayDrop Studio
CreatePlayTradeEarnLearnConnectorsAssetsCommunitySupport
Sign in
AI asset generation
Documentation

Start here

OverviewYour first gamePlayDrop gamesFAQ

Create with Cloud

Cloud creationPlans & generations

Connect your AI app

All connectorsClaudeChatGPTClaude CodeCodexCursorGeminiAntigravityGrok BuildGrok BotGrok ChatLovableReplit

Publish and share

Publish from your AI appSimple HTML gamesPackaging and .playPublish & importGame filesVisibility and reachListing art and videoGenres and tagsLocalizationInstant games

Game experience

Loading, pause and audioFull screen and safe areasCloud savesLocal parties and controllers

Play together

Sharing, friends and invitesLeaderboardsAchievementsOnline parties and voiceRealtime game servers

Earn

MonetizationCredits & rewards

Assets

Game assetsAI asset generationCustom formats and player creations

Reference

Client SDKServer SDKcatalogue.jsonErrors and recoveryTroubleshooting
DocumentationAI asset generation
Assets

AI asset generation for PlayDrop games

Generate images, music, sound, speech, video and 3D for a game in PlayDrop, from the browser with player confirmation or from a server paid by the creator.

PlayDrop can generate images, music, sound effects, speech, video and 3D models. Use it while making a game, or inside a game so players get generated content.

While making the game

Signed-in creators generate assets from Create on the PlayDrop website (image, music, sound, speech, video and 3D) or ask PlayDrop Cloud while building a game. Each generation costs credits, shown before it starts, and the result becomes an asset you own. Use it like any other asset: download it into your package or reference it in uses (game assets).

Inside a game: from the browser

sdk.ai.<kind>.createTask(request) asks PlayDrop to generate media for the current player. PlayDrop shows the player a confirmation with the credit cost, the player pays, and the result is private to them.

js
try {
  const task = await sdk.ai.image.createTask({ input: "A friendly robot pet, flat colors", aspectRatio: "1:1" });
  const done = await waitForTask(task.id);
  const blob = await sdk.ai.tasks.downloadFile(done.id);
  showPet(URL.createObjectURL(blob));
} catch (error) {
  if (error.message === "ai_generation_cancelled") return;
  throw error;
}

async function waitForTask(id) {
  for (;;) {
    const task = await sdk.ai.tasks.get(id);
    if (task.status === "DONE") return task;
    if (["FAILED", "CANCELLED", "EXPIRED"].includes(task.status)) throw new Error(task.status);
    await new Promise((resolve) => setTimeout(resolve, 2000));
  }
}
  • Kinds: image, music, sfx, speech, video and model3d. sdk.ai.inputs.upload(blob) sends a reference image.
  • Only one confirmation can be open at a time; a second call rejects with ai_generation_in_progress.
  • Text and JSON generation from the browser is not available to hosted games and returns app_ai_generation_disabled. Use a server.
  • Call it from a player action, during play, and handle cancellation.

Inside a game: from a server

On a game server, playdrop.ai from @playdrop/server generates text, JSON, images, music, sound effects, speech, video and 3D. The creator pays, and owns the results by default; pass { owner: client.auth } to give an eligible result to that player.

js
import { playdrop } from "@playdrop/server";

const task = await playdrop.ai.speech.createTask({ input: "Welcome back, captain." }, { owner: client.auth });
// Later, once the task is DONE:
const file = await playdrop.ai.tasks.downloadFile(task.id, { role: "primary" });
client.send("speech", { bytes: new Uint8Array(await file.arrayBuffer()), contentType: file.type });
  • A generated file is private: download it on the server and send the bytes only to the intended player.
  • Speech requests accept at most 40 words.
  • Test players' generations stay owned by the creator and run in test mode.
  • These calls work on uploaded games, not in local development.

Generation costs credits, so limit how often players can trigger it, and prove one complete request, from task to the player actually seeing or hearing it, before building a game around it.

Related guides

  • Game assetsShip images, sound, video and 3D with a PlayDrop game: bundled files, game-owned assets, public assets and packs, and runtime lookup with sdk.assets.
  • Realtime game serversRun a hosted Colyseus 0.17 server with a MongoDB database for your game, connect from the browser with the SDK, test with two players and know the limits.
  • MonetizationAsk for reviews with requestReview, receive tips, sell items with sdk.shop, show interstitial and rewarded ads, and see what share of each the creator earns.
PreviousGame assets on PlayDrop: bundled files, owned assets and shared packsNextCustom asset formats and player creations on PlayDrop
View Markdown
EnglishFrançaisDeutsch日本語한국어EspañolPortuguês (Brasil)Bahasa Indonesia繁體中文简体中文ItalianoPolskiNederlandsSvenskaNorsk bokmålSuomiTürkçeไทยTiếng Việtالعربية

On this page

While making the gameInside a game: from the browserInside a game: from a server
View Markdown