Getting Started

Quick Start

Build and integrate your first Boofer-ready HTML5 game in under 5 minutes.

01 Include the SDK

Add the CDN script to your game's <head>:

index.html
<head>
  <!-- Boofer SDK -->
  <script src="https://booferapp.github.io/bgames/assets/sdk/boofer-sdk.js"></script>

  <!-- Your API key (required) -->
  <meta name="boofer-api-key" content="YOUR_API_KEY">

  <!-- Environment tag (remove before publishing) -->
  <meta name="boofer-env" content="development">
</head>

⚠️ Important

Remove <meta name="boofer-env" content="development"> before submitting your game. Without it, the SDK will block your game from loading outside the Boofer app.

02 Initialize your game

game.js
(async () => {
  try {
    // 1. Wait for the native bridge
    await Boofer.ready();

    // 2. Initialize and get player context
    const ctx = await Boofer.initGame({ gameId: 'my_game' });
    console.log('Player:', ctx.player.handle);
    console.log('High Score:', ctx.high_score);

    // Start your game loop
    startGame(ctx.player, ctx.high_score);
  } catch (err) {
    console.warn('Running outside Boofer:', err.message);
    // Fallback for development/browser testing
    startGame({ handle: 'Guest', id: 'guest' }, 0);
  }
})();

03 Save scores

game.js
// Save the current score
await Boofer.saveScore(1500);

// Signal game over with final score
await Boofer.gameOver(1500, { level: 3, time: 120 });

04 Upload your game

Once your game is ready, upload it from your developer dashboard.

Go to Upload