GameSmith / README.md
codeslord's picture
links
c720931

A newer version of the Gradio SDK is available: 6.14.0

Upgrade
metadata
title: GameSmith AI
emoji: ๐ŸŽฎ
colorFrom: purple
colorTo: blue
sdk: gradio
sdk_version: 6.0.1
app_file: app.py
pinned: false
license: mit
short_description: AI-powered 2D sprite generator & animator with Gemini
tags:
  - building-mcp-track-creative
  - mcp-in-action-track-creative

๐ŸŽฎ GameSmith AI: The Intelligent Game Asset Studio

Author: Rohith Raghunathan Nair

๐Ÿš€ Overview

GameSmith AI is a dual-interface Game Asset Generator that functions as both a human-friendly Web App and an AI-accessible MCP Server.

It solves the biggest bottleneck in indie game development: Creating consistent, animated assets in any 2D art style.

By leveraging Google Gemini 2.5 Flash for style-consistent character generation and Google Veo for physics-aware animation, GameSmith allows developers (and AI agents!) to go from a text prompt to a ready-to-use sprite sheet in seconds. Supports pixel art, anime, cartoon, vector, and more.

What's a Sprite? A sprite is a 2D image or animation used in games to represent characters, objects, or effects. A sprite sheet is a single image containing multiple frames of animation arranged in a grid, which game engines use to display smooth animations.

๐Ÿ† Hackathon Tracks

This project is submitted to:

  • Track 1: Building MCP (Creative) - building-mcp-track-creative
  • Track 2: MCP in Action (Creative) - mcp-in-action-track-creative

๐Ÿ“ฃ Social Post: View on X

๐ŸŽฌ Demo Video: Watch on YouTube

โœจ Features

  1. Text-to-Character Generation: Creates high-quality, flat 2D game characters (sprites) in any art style (pixel art, anime, cartoon, vector, etc.) using advanced prompting strategies to ensure game-ready assets.
  2. AI Animation (Veo): Uses Google's Veo model to generate fluid animations (Idle, Walk, Run, Jump) that preserve the original art style of the input character.
  3. Asset Extraction: Automatically converts the generated video animations into standard sprite sheet frames (PNGs) and ZIP archives, ready for engines like Unity, Godot, or Phaser.
  4. MCP Native: All functionality is exposed via the Model Context Protocol. You can ask Claude: "Make a cute cat character, animate it walking, and give me the frames" and it will execute the entire pipeline autonomously.

๐Ÿ› ๏ธ Installation & Usage

Prerequisites

  • Python 3.10+
  • Google Gemini API Key (with access to Veo and Gemini models)

Setup

  1. Clone the repository:

    git clone https://huggingface.co/spaces/YOUR_USERNAME/GameSmith-AI
    cd GameSmith-AI
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Set your API Key:

    export GEMINI_API_KEY="your_google_api_key_here"
    
  4. Run the server:

    python app.py
    
  5. For Humans: Open http://localhost:7860 in your browser.

  6. For Agents (MCP): Connect your MCP client to http://localhost:7860/gradio_api/mcp/sse.


๐Ÿค– MCP Integration Guide

GameSmith AI exposes a remote MCP server via Gradio's built-in SSE endpoint. This means you can connect to it from any MCP-compatible client without running any local code!

Remote MCP Endpoint

http://localhost:7860/gradio_api/mcp/sse          # Local
https://YOUR_HF_SPACE.hf.space/gradio_api/mcp/sse  # Hugging Face Spaces

Tools Exposed

Tool Description
generate_pixel_character Generate a 2D game character (sprite) from text
animate_pixel_character Animate a character (idle, walk, run, jump)
extract_sprite_frames Extract frames from animation video

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "gamesmith": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://YOUR_HF_SPACE.hf.space/gradio_api/mcp/sse",
        "--transport",
        "sse-only"
      ]
    }
  }
}

For local development:

{
  "mcpServers": {
    "gamesmith": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:7860/gradio_api/mcp/sse"
      ]
    }
  }
}

GitHub Copilot (VS Code)

Add to your VS Code settings.json:

{
  "github.copilot.chat.mcpServers": {
    "gamesmith": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://YOUR_HF_SPACE.hf.space/gradio_api/mcp/sse",
        "--transport",
        "sse-only"
      ]
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project or ~/.cursor/mcp.json globally:

{
  "mcpServers": {
    "gamesmith": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://YOUR_HF_SPACE.hf.space/gradio_api/mcp/sse",
        "--transport",
        "sse-only"
      ]
    }
  }
}

Cline (VS Code Extension)

Add to your Cline MCP settings:

{
  "mcpServers": {
    "gamesmith": {
      "url": "https://YOUR_HF_SPACE.hf.space/gradio_api/mcp/sse",
      "transport": "sse"
    }
  }
}

Continue (VS Code/JetBrains)

Add to ~/.continue/config.yaml:

mcpServers:
  - name: GameSmith AI
    command: npx
    args:
      - "-y"
      - "mcp-remote"
      - "https://YOUR_HF_SPACE.hf.space/gradio_api/mcp/sse"
      - "--transport"
      - "sse-only"

Claude Code (CLI)

claude mcp add gamesmith -- npx -y mcp-remote https://YOUR_HF_SPACE.hf.space/gradio_api/mcp/sse --transport sse-only

Windsurf

Add to your Windsurf MCP configuration:

{
  "mcpServers": {
    "gamesmith": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote", 
        "https://YOUR_HF_SPACE.hf.space/gradio_api/mcp/sse",
        "--transport",
        "sse-only"
      ]
    }
  }
}

Python Client (Direct SSE)

import asyncio
from mcp import ClientSession
from mcp.client.sse import sse_client

async def main():
    server_url = "https://YOUR_HF_SPACE.hf.space/gradio_api/mcp/sse"
    
    async with sse_client(server_url) as (read_stream, write_stream):
        async with ClientSession(read_stream, write_stream) as session:
            await session.initialize()
            
            # List available tools
            tools = await session.list_tools()
            print("Available tools:", [t.name for t in tools.tools])
            
            # Generate a sprite
            result = await session.call_tool(
                "generate_pixel_character",
                {"prompt": "A cute robot character, pixel art style"}
            )
            print(result)

asyncio.run(main())

๐Ÿ’ก Winning Ideas for MCP Hackathon

(As requested, here are 5 winning concepts for the MCP Hackathon)

  1. GameSmith AI (This Project): A creative pipeline that bridges the gap between generative video and usable game assets, solving a real "last mile" problem for developers.
  2. NPC-GPT (The Living Character Engine): An MCP server that generates not just the visual character (using GameSmith tools) but also the character's stats, dialogue trees, and behavior scripts, packaging them into a JSON file for Godot/Unity.
  3. RetroRemix (Legacy Game Reskinner): A tool where users upload screenshots of old games, and the AI identifies assets (tiles, enemies) and "remasters" them into a new style (e.g., "Cyberpunk Mario") using the character generation pipeline.
  4. StoryBoarder (Cinematic Cutscene Gen): An agentic workflow that takes a script, breaks it into scenes, generates keyframes using Gemini, animates short loops using Veo, and assembles a rough animatic video.
  5. LevelGod (Procedural World Builder): A tool focused on "Tile Connectivity". You generate a center tile, and the MCP server iteratively generates the connecting tiles (top, bottom, corners) to ensure seamless looping textures for infinite runners or RPG maps.

๐Ÿ“œ License

MIT License