Economy Engine

Production-ready economy infrastructure for game developers. Currencies, wallets, transactions, items, real-time dashboards, and an AI advisor — through a simple SDK and HTTP API.

What is an Economy Engine?

Every game with currency, items, or trading has an economy — gold flows in when players complete quests (faucets), and flows out when they buy gear (sinks). An economy engine is the backend that manages all of it: player wallets, item prices, transactions, balance checks, and the math that keeps everything stable as your game scales.

Think of it like Stripe for game economies. Stripe handles payments so you don't build a payment system. GameplayGen handles your in-game economy so you don't build a financial backend from scratch.

The Problem

You can vibe-code a game in a weekend. You can generate art with AI. You can ship to the web in hours. But the moment your game has an economy — currencies, shops, loot, trading — you hit a wall.

Economy math is deceptively hard. It works fine with 10 testers. Then at 1,000 players, gold inflates. At 10,000, exploits appear. At 100,000, wealth concentrates in the top 1% and new players quit because everything costs too much. By the time you notice, your economy is broken and your players are gone.

This isn't a coding problem — it's an economics problem. You need to balance faucets (where currency enters) and sinks (where it leaves), monitor inflation in real time, detect exploits before players find them, and stress-test at scale before you ship. That's months of backend work for problems most game devs have never solved.

The Solution

GameplayGen Economy Engine handles all of it. Define your currencies, items, and prices. We give you the wallets, transactions, balance checks, and real-time analytics. An AI advisor watches your economy 24/7 and tells you when something's wrong — before your players do.

You focus on the game. We handle the math.

Key Features

💰 Currencies & Wallets

Multi-currency with max balances, caps, and automatic faucet/sink tracking.

🎒 Items & Inventory

Item definitions with rarity, pricing, metadata, and per-player inventory management.

⚒️ Crafting Recipes

Multi-ingredient recipes with chance-based outputs, cooldowns, and requirements.

🔧 Item Durability

Per-instance durability, degradation, repair costs, soulbinding, and custom properties.

🎰 Loot Tables

Weighted random drops with nested tables, min/max ranges, and unique-per-roll.

🏪 Marketplace

Player-to-player trading with escrow, configurable tax rate (sink), and expiration.

📜 Rules Engine

Trigger → Condition → Action hooks. Auto-tax trades, reward milestones, enforce caps.

🤖 AI Economy Advisor

Real-time Gini, inflation, velocity tracking. Detects exploits and recommends fixes.

Quick Example

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

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

// Grant gold, spend at shops
await gg.economy.grant('player_42', 'gold', 100, 'quest_complete');
await gg.economy.spend('player_42', 'gold', 30, 'shop_purchase');

// Crafting: combine ingredients into items
await gg.economy.craft('player_42', 'iron_sword_recipe');

// Loot: roll a boss drop table
const drops = await gg.economy.rollLoot('player_42', 'boss_dragon_table');

// Marketplace: list and buy items
const listingId = await gg.economy.marketplaceList('player_42', 'iron-sword', {
  currencyId: 'gold', amount: 500,
});
await gg.economy.marketplaceBuy('player_99', listingId);

Complex Use Cases

The Economy Engine isn't a toy. It's built for real game economies with real complexity:

⚒️ Crafting with chance-based outputs

Recipes consume multiple items + currencies. Outputs can have drop chances (80% iron sword, 5% legendary). Supports cooldowns, requirements (level 10+), and nested recipes.

🔧 Item durability & enchantments

Each item instance tracks HP, custom properties (enchantment level, gem sockets, stat bonuses). Items degrade on use, break at 0, cost currency to repair. Soulbound and expiring items supported.

🎰 Nested loot tables

Tables reference other tables — roll a "boss loot" table that branches into "common gear" or "rare materials" sub-tables. Supports min/max amount ranges, unique-per-roll, and configurable roll counts.

📜 Rules engine for custom game logic

Define server-side hooks: "when a player spends > 1000 gold, apply 10% tax" or "on every craft, grant 5 XP." Conditions support nested fields, comparison operators, and ordered priority.

🏪 Player marketplace with escrow & tax

Full marketplace: list items, escrow on listing (seller can't use listed items), configurable tax rate as an economy sink, auto-expiration, and purchase verification.

Documentation