BENTOTILESSDK DOCS
Game Engines

AI Coding & Prompts

Treat AI Coding as a game engine! Master prompts for Cursor, Claude, ChatGPT, and Antigravity to build complete BentoTiles games in minutes.

🤖 AI Coding as a Game Engine

With modern AI coding assistants (such as Cursor, Claude, ChatGPT, and Antigravity), you can treat AI Prompting as your primary game creation engine.

Instead of writing all boilerplates by hand, you can instruct AI to generate complete HTML5, Phaser 3, Unity, or Godot games pre-loaded with full BentoTiles SDK integration (Ads, Cloud Saves, Leaderboards, and Lifecycle events).


🚀 The BentoTiles Master AI Prompt

Copy and paste this master system prompt into your AI editor (Cursor, Claude, ChatGPT) when starting a new game project:

You are an expert HTML5 web game developer building a high-quality game for the BentoTiles web gaming platform.

REQUIREMENTS:
1. Include the BentoTiles SDK script tag in the HTML head:
   <script src="https://sdk.bentotiles.com/v1/bentotiles-sdk.js"></script>

2. Initialize the SDK properly before starting the game loop:
   BentoTiles.init({
     gameId: "MY_GAME_SLUG",
     onPause: () => { pauseGame(); muteAudio(); },
     onResume: () => { resumeGame(); unmuteAudio(); }
   }).then(() => {
     BentoTiles.gameLoadingFinished();
     startGame();
   });

3. Add commercial ad breaks at natural pause points (Game Over, Level Clear) using:
   BentoTiles.commercialBreak({
     beforeAd: () => { pauseAudio(); },
     afterAd: () => { resumeAudio(); }
   });

4. Add a Rewarded Ad button for extra lives/coins using:
   BentoTiles.rewardedBreak({
     beforeAd: () => { pauseAudio(); },
     afterAd: (success) => {
       resumeAudio();
       if (success) { grantReward(); }
     }
   });

5. Implement Cloud Saves with BentoTiles.storage (get/set) and Leaderboards with BentoTiles.leaderboards.submitScore().

Now, build a complete, single-file HTML5 Canvas arcade game with vibrant graphics, sound effects (using Web Audio API), score tracking, and smooth controls.

📋 Ready-to-Use Prompt Templates

🎨 1. HTML5 Canvas Game Prompt

Prompt:
"Create a complete, polished 2D arcade dodge game in HTML5 Canvas using vanilla JavaScript. Include BentoTiles SDK initialization with gameId 'arcade-dodge', trigger BentoTiles.commercialBreak() when the player dies, add a 'Watch Ad for Revive' button using BentoTiles.rewardedBreak(), and submit high scores via BentoTiles.leaderboards.submitScore()."


⚡ 2. Phaser 3 Game Prompt

Prompt:
"Write a modular Phaser 3 platformer template in JavaScript. Include a BentoTiles SDK plugin or helper script that calls BentoTiles.init() on scene start, handles gameLoadingFinished(), pauses the Phaser scene during BentoTiles.commercialBreak(), and saves player high scores to BentoTiles.storage."


🎮 3. Unity WebGL C# & JSLib Bridge Prompt

Prompt:
"Generate a C# BentoTilesManager.cs script and .jslib bridge file for a Unity 2022+ WebGL game. Ensure C# calls BentoTiles_Init, BentoTiles_ShowAd, and BentoTiles_SubmitScore. Handle Time.timeScale = 0 and AudioListener.pause = true inside the C# callbacks."


🚀 4. Godot 4 GDScript Bridge Prompt

Prompt:
"Create a Godot 4 GDScript BentoTilesSDK.gd Autoload script using JavaScriptBridge. Implement init(), commercial_break(), rewarded_break(), and score submission. Pause the Godot SceneTree automatically when an ad break starts."


💡 AI Prompting Tips for Web Games

  1. Dev Mock Mode: Tell your AI assistant that BentoTiles automatically runs in Dev Mock Mode on localhost, so it can test ad overlays and cloud save mocks directly in the browser preview.
  2. Audio Handling: Always remind the AI to route audio through Web Audio API or HTML5 Audio elements so that onPause and onResume can mute/unmute sounds cleanly during ad breaks.
  3. Responsive Canvas: Ask the AI to make the <canvas> auto-fit the window size while preserving aspect ratio, ensuring smooth play on mobile and desktop devices.