🚀 Getting Started

GameplayGen is the gameplay generation layer. Send your game rules and get back verified, playable content — puzzles, levels, encounters — all provably valid and balanced.

AI tools generate games. GameplayGen generates the gameplay — the part that makes games actually fun and playable.

Quick Start

1. Create a game and get an API key:

bash
curl -X POST https://gameplaygen.com/api/economy/games \
  -H "Content-Type: application/json" \
  -d '{ "name": "my-game" }'
# → { "data": { "apiKey": "gg_live_sk_..." } }

2. Make your first generation request:

bash
curl -X POST https://api.gameplaygen.com/generate \
  -H "Authorization: Bearer gg_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "gameType": "sokoban",
    "params": {
      "width": 8,
      "height": 8,
      "boxes": 3,
      "minOptimalMoves": 10
    },
    "count": 5,
    "difficulty": { "target": 0.5 }
  }'

3. Every piece in the response is verified solvable, difficulty-rated, and balance-checked.

The Generation Loop

text
Your Game Rules → GameplayGen Generator → Validator → ✅ Verified Content

Every returned piece has been:
  • Verified solvable — completable by a player
  • Difficulty rated — scored 0.0 to 1.0
  • Balance checked — no broken/trivial outcomes
  • Variety ensured — no two pieces too similar

Install the SDK

bash
npm install @gameplaygen/sdk
typescript
import { GameplayGen } from '@gameplaygen/sdk';

const gg = new GameplayGen({
  apiKey: 'gp_your_api_key',
  baseUrl: 'https://gameplaygen.com',
});

// Define currencies and items
await gg.economy.defineCurrency('gold', 'Gold', '💰');
await gg.economy.defineItem('iron-sword', 'Iron Sword', {
  prices: [{ currencyId: 'gold', amount: 50 }],
});

// Grant and spend
await gg.economy.grant('player_42', 'gold', 100, 'welcome_bonus');
await gg.economy.purchase('player_42', 'iron-sword');

const bal = await gg.economy.getBalance('player_42');
// → [{ currencyId: 'gold', balance: 50 }]