DEV Community

Patrick DeVos
Patrick DeVos

Posted on

Generate Infinite RPG Content for Your Game Using AI (Free API)

Writing RPG content is one of the biggest bottlenecks in indie game development. An NPC needs dialogue. An item needs a lore description. A side quest needs objectives, flavor text, and a reward. Do this for 50 NPCs, 200 items, and 30 quests and you've spent weeks on content that players skip through anyway.

There's a better way. The GameForge Content API generates structured, genre-consistent RPG content on demand — NPC dialogue, item descriptions, quest narratives, and world lore. Plug it into your pipeline once, generate as much as you need.

What It Generates

  • NPC Dialogue — Multi-line dialogue with emotion tags, personality-consistent across calls
  • Item Descriptions — Lore-rich descriptions with rarity and genre tone
  • Quest Narratives — Full quest structure with objectives and reward context
  • World Lore — Faction histories, location descriptions, creation myths

All output is structured JSON — no parsing free-form text, just pull the fields you need.

Supported Genres

high_fantasy dark_fantasy sci_fi western horror cozy cyberpunk

Quick Start

Install

pip install requests
Enter fullscreen mode Exit fullscreen mode

Get API Key

  1. Sign up at RapidAPI
  2. Search "GameForge Content"
  3. Subscribe free (BASIC plan)
  4. Copy your X-RapidAPI-Key

Generate NPC Dialogue

import requests

KEY = "YOUR_RAPIDAPI_KEY"
HOST = "gameforge-content.p.rapidapi.com"
BASE = f"https://{HOST}"
HEADERS = {"X-RapidAPI-Key": KEY, "X-RapidAPI-Host": HOST, "Content-Type": "application/json"}


def generate_npc_dialogue(name: str, role: str, personality: str, genre: str, location: str, situation: str):
    body = {
        "character": {
            "name": name,
            "role": role,
            "personality": personality
        },
        "genre": genre,
        "context": {
            "location": location,
            "situation": situation
        }
    }
    r = requests.post(f"{BASE}/npc/dialogue", json=body, headers=HEADERS)
    r.raise_for_status()
    return r.json()


# Example: generate dialogue for a blacksmith
dialogue = generate_npc_dialogue(
    name="Greta Ironhand",
    role="blacksmith",
    personality="gruff, proud of her craft, distrustful of mages",
    genre="high_fantasy",
    location="forge",
    situation="player asks about a legendary sword"
)

for line in dialogue["lines"]:
    print(f'[{line["emotion"]}] {line["text"]}')
Enter fullscreen mode Exit fullscreen mode

Output:

[suspicious] Another one asking about the Dawnbreaker. What's your interest in it?
[proud] That blade took me three months and a dragon's scale. Not something I sell to anyone who walks in.
[cautious] If you're serious, bring me proof you've cleared the Ashwood bandits. Then we'll talk.
Enter fullscreen mode Exit fullscreen mode

Generate Item Descriptions

def generate_item(name: str, item_type: str, rarity: str, genre: str, lore_hook: str = ""):
    body = {
        "item": {
            "name": name,
            "type": item_type,
            "rarity": rarity
        },
        "genre": genre,
        "lore_hook": lore_hook
    }
    r = requests.post(f"{BASE}/item/description", json=body, headers=HEADERS)
    r.raise_for_status()
    return r.json()


sword = generate_item(
    name="Ashveil",
    item_type="sword",
    rarity="legendary",
    genre="dark_fantasy",
    lore_hook="forged from the bones of a fallen god"
)

print(sword["description"])
print(f"\nFlavor: {sword['flavor_text']}")
Enter fullscreen mode Exit fullscreen mode

Generate Quests

def generate_quest(quest_type: str, genre: str, setting: str, protagonist_level: str = "novice"):
    body = {
        "quest_type": quest_type,
        "genre": genre,
        "setting": setting,
        "protagonist_level": protagonist_level
    }
    r = requests.post(f"{BASE}/quest/generate", json=body, headers=HEADERS)
    r.raise_for_status()
    return r.json()


quest = generate_quest(
    quest_type="rescue",
    genre="high_fantasy",
    setting="cursed forest",
    protagonist_level="veteran"
)

print(f"Title: {quest['title']}")
print(f"Hook: {quest['hook']}")
print("\nObjectives:")
for obj in quest["objectives"]:
    print(f"  - {obj}")
print(f"\nReward hint: {quest['reward_hint']}")
Enter fullscreen mode Exit fullscreen mode

Bulk Content Pipeline

For game content pipelines, generate in bulk and cache:

import json
from pathlib import Path


def generate_npc_roster(npcs: list[dict], genre: str, output_file: str):
    results = []
    for npc in npcs:
        print(f"Generating {npc['name']}...")
        dialogue = generate_npc_dialogue(
            name=npc["name"],
            role=npc["role"],
            personality=npc.get("personality", "neutral"),
            genre=genre,
            location=npc.get("location", "village"),
            situation="player greeting"
        )
        results.append({"npc": npc, "dialogue": dialogue})

    Path(output_file).write_text(json.dumps(results, indent=2))
    print(f"Saved {len(results)} NPCs to {output_file}")


npc_list = [
    {"name": "Brother Aldus",  "role": "priest",    "location": "chapel"},
    {"name": "Mira the Swift", "role": "scout",     "location": "outpost"},
    {"name": "Old Brennan",    "role": "innkeeper", "location": "tavern"},
]

generate_npc_roster(npc_list, "high_fantasy", "npcs_generated.json")
Enter fullscreen mode Exit fullscreen mode

Unity / Godot Integration

The JSON output maps directly to scriptable objects or resource files:

# Export as Godot .tres resource format
def to_godot_resource(npc_name: str, dialogue: dict) -> str:
    lines = dialogue["lines"]
    entries = "\n".join(
        f'DialogueLine("{l["text"]}", "{l["emotion"]}"),'
        for l in lines
    )
    return f"""[gd_resource type="DialogueResource"]
[resource]
npc_name = "{npc_name}"
lines = [{entries}]"""
Enter fullscreen mode Exit fullscreen mode

Why Use an API Instead of Running a Local Model?

  • No GPU required — works on any machine, including CI/CD pipelines
  • Consistent output format — structured JSON every time, no prompt engineering
  • Genre enforcement — the API keeps tone/vocabulary consistent across calls
  • Free tier — 100 requests/month, enough for a full indie game's worth of content

The API is live on RapidAPI — search "GameForge Content" by Circle of Wizards. Free BASIC tier, PRO ($9.99/mo) unlocks higher call limits for production pipelines.

Top comments (0)