Skip to main content

Documentation Index

Fetch the complete documentation index at: https://pcmtg.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

6.1 The Philosophy of Infinite Content

A live-service game reliant on real-world commentary will quickly die if it depends on a human team to manually write, balance, and draw new targets every day. The “Automated Content Factory” is the core life-support system of the game. The system relies on an asynchronous background pipeline that guarantees the database is constantly hydrated with highly topical, balanced, and game-ready assets. To avoid massive API costs from data brokers, the architecture relies on the Evergreen RSS Feed. RSS feeds have zero cost, no rate limits, and are immune to sudden platform policy changes.

6.2 The News Stub Ingestion Pipeline

The News Stub must reflect the real world in near-real-time.
  • The Metronome: Cloud Scheduler emits a Pub/Sub message every 4 hours. A dedicated Python Cloud Run service (the NewsIngestor) wakes up and polls 3-5 high-reputation, plain-text RSS feeds.
  • Deduplication: The worker takes the headline and compares it against all active News Stubs using a lightweight Levenshtein distance or Jaccard similarity algorithm. If the incoming headline is 85% similar to an existing active stub, the worker instantly drops the new payload to prevent spam.
  • Vector Assignment: The stub is sent strictly to Gemini 3.1 Lite for rapid, deterministic parsing. We force Gemini to return strict JSON by passing a response_schema in the Vertex API call. The AI evaluates the headline and maps its ideological implications on a 3D coordinate system to assign the X, Y, and Z vectors.

6.3 The Dynamic Card Generation Workflow

This pipeline handles the dynamic rendering of Item Cards and Meme Cards.
  • Prompt Construction: Writing satirical, quadrant-specific flavor text requires deep cultural context, so this task is routed to Gemini 1.5 Pro. The model generates the card name, flavor text, and a highly detailed image generation prompt.
  • Stylistic Override (Deepfake Prevention): To ensure the automated system never violates Google’s Terms of Service regarding deepfakes of real politicians, the backend enforces a Stylistic Hardcode. The Python worker intercepts the prompt and appends a mandatory suffix based on the Quadrant, such as rendering the image as a 19th-century political cartoon or low-poly 3D crypto-art.
  • Asset Finalization: The Imagen API returns a raw binary image payload, which is converted to the highly compressed .webp format to ensure lightning-fast client loading. The .webp file is uploaded to a Google Cloud Storage (GCS) Bucket, and the public URL is written as a new row into the Cloud SQL CardMasterRegistry.

6.4 The Safety Try-Catch & Local LLM Fallback

Political satire frequently dances on the edge of what enterprise AI safety filters consider “Harassment” or “Hate Speech”. We implement a multi-tiered fallback architecture.
  • Tier 1 (The Vertex AI SafetyException): When Vertex AI blocks a request, it throws a 400 Bad Request with a SafetyError payload. The Cloud Run service is wrapped in a try-catch block that specifically listens for this error.
  • Tier 2 (The Open-Weight SSH Tunnel): If running in the Development environment, the system utilizes the developer’s local machine running Ollama. A secure reverse tunnel exposes the local Ollama REST API to the GCP Cloud Run service. The local Llama 3 model, free from enterprise filters, generates the edgy flavor text and passes it back to the cloud database.
  • Tier 3 (The Censored Hard-Fallback): If the game is live in production, the system aborts dynamic text/image generation. It assigns the card the name [REDACTED] and sets the illustration to a pre-rendered, static .webp image of a heavily censored document with a red “CLASSIFIED” stamp.