DreamGameForge / CLAUDE.md
jolyonbrown's picture
Add Steam API integration and agentic workflow
ab0da91

A newer version of the Gradio SDK is available: 6.2.0

Upgrade

Dream Game Forge - Project Instructions

Project Overview

Dream Game Forge is an agentic Gradio application for the MCP 1st Birthday Hackathon that analyzes a user's Steam gaming library to discover their ideal game, then generates a playable HTML5 prototype.

CRITICAL: Deadline is November 30, 2025, 11:59 PM UTC (TODAY). Prioritize working features over perfection.

Core Workflow

  1. User provides Steam ID
  2. Agent fetches Steam library + playtime data
  3. Analyzes gaming patterns (what they play vs. what they buy and ignore)
  4. Cross-references with IGDB for genre/theme data
  5. Identifies a unique game "gap" tailored to the user
  6. Generates a mini Game Design Document
  7. Produces a playable HTML5 Canvas game (single-file, no dependencies)

Hackathon Requirements

Architecture Constraints

Why NOT Claude Agent SDK

The Agent SDK requires global npm install which HuggingFace Spaces don't support. Use raw Anthropic API with manual tool loop instead.

MCP Implementation

Build simple MCP-style servers in tools/ directory. We satisfy the MCP requirement by structuring tools properly, even though we call them via Anthropic API tool interface.

Game Generation

Claude generates complete HTML5 Canvas code directly - no external game engines. Keep games simple (puzzle, clicker, basic platformer) but playable. Display via gradio-iframe component or downloadable HTML file.

File Structure

DreamGameForge/
โ”œโ”€โ”€ app.py              # Gradio app + agent loop
โ”œโ”€โ”€ tools/
โ”‚   โ”œโ”€โ”€ steam.py        # Steam API functions
โ”‚   โ””โ”€โ”€ igdb.py         # IGDB API functions
โ”œโ”€โ”€ agent.py            # Agentic loop logic
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md           # Must include mcp-in-action-track-creative tag

API Configuration

Required Secrets (set in HF Space settings)

  • ANTHROPIC_API_KEY
  • STEAM_API_KEY
  • TWITCH_CLIENT_ID (for IGDB)
  • TWITCH_CLIENT_SECRET (for IGDB)

Steam Web API

Endpoint: https://api.steampowered.com/IPlayerService/GetOwnedGames/v1/
Parameters: key, steamid, include_appinfo=true, include_played_free_games=true
Returns: List of games with appid, name, playtime_forever, playtime_2weeks

Works for public profiles without OAuth.

IGDB API

Endpoint: https://api.igdb.com/v4/games
Headers: Client-ID, Authorization: Bearer {token}
Body: Apicalypse query syntax

Get access token from:

POST https://id.twitch.tv/oauth2/token
Body: client_id, client_secret, grant_type=client_credentials

Example queries:

  • Search: search "Hollow Knight"; fields name,genres.name,themes.name,summary; limit 10;
  • Filter: where genres.name = "Platform" & rating > 80; fields name,summary; limit 20;

System Prompt Philosophy

The agent should be decisive and autonomous:

  1. INVESTIGATE: Fetch Steam library, analyze playtime patterns
  2. ANALYZE: Cross-reference with IGDB for genres/themes/mechanics
  3. IDENTIFY THE GAP: What game should exist for this person?
  4. DESIGN: Write mini Game Design Document
  5. BUILD: Generate playable HTML5 Canvas prototype

Don't ask for permission - show reasoning and act.

Model Selection

Use claude-sonnet-4-20250514 for the agent loop - balance of quality and speed.

Development Workflow

Local Testing

pip install gradio anthropic httpx python-dotenv
export ANTHROPIC_API_KEY=...
export STEAM_API_KEY=...
export TWITCH_CLIENT_ID=...
export TWITCH_CLIENT_SECRET=...
python app.py

Deployment

git add .
git commit -m "descriptive message"
git push  # Pushes to HuggingFace Space automatically

Priority Order (Time-Constrained)

  1. โœ… Basic Gradio chat with Claude working
  2. Steam library fetch tool
  3. IGDB game details tool
  4. Agent loop with tools integrated
  5. System prompt refinement
  6. Game HTML generation capability
  7. Game display in Gradio (iframe or download)
  8. Polish, README, demo video, social post

Quick Wins If Time Runs Out

  • Skip IGDB, use only Steam data + Claude's knowledge
  • Serve game as downloadable file instead of embedded iframe
  • Simpler game format (text adventure vs. canvas game)
  • Pre-record demo video even if live version is flaky

Code Style

  • Keep functions simple and focused
  • Use type hints where practical
  • Error handling for API calls (Steam/IGDB may fail)
  • Log agent reasoning steps for debugging

Testing

  • Test with a real Steam ID (public profile required)
  • Verify API keys are working before full agent run
  • Test generated HTML games in browser before deployment
  • Check HF Space logs if deployment fails

Reference Links