TL;DR
Cardiverse is an automated framework that leverages Large Language Models (LLMs) to streamline the entire computer card game prototyping pipeline—from creative ideation to playable code and evaluation. By combining graph-based game mechanic design, simulation-validated code generation, and a highly scalable heuristic-ensemble gameplay AI, it creates novel, rule-consistent game variants with minimal human intervention.
What Problem Does This Paper Address?
Prototyping is a crucial phase in game development where designers rapidly iterate on core mechanics to test if a game is actually fun. However, this process is traditionally bottlenecked by heavy human labor in writing code and playtesting.
While LLMs seem like a natural fit to automate text-based card games, they face three major roadblocks:
- Lack of Intentional Novelty: LLMs tend to regurgitate existing game rules or repeat themselves rather than inventing distinct, novel variations.
- Code Inconsistency: Card games involve complex, multi-round interactions. LLMs struggle to generate long codebases that consistently adhere to natural language rules over an entire game.
- Inscalable Evaluation AI: To test a game automatically, you need an intelligent AI player. Existing reinforcement learning (RL) or turn-by-turn LLM agents are either too slow, too expensive, or require tedious manual state formatting.
Methods
Cardiverse tackles these challenges by breaking the prototyping pipeline into three interconnected modules:
1. Game Mechanic Design via Graph Indexing
Instead of asking an LLM to simply "invent a new game," Cardiverse extracts game mechanics from a database and represents them as directed graphs, where nodes are mechanics and edges represent control flow leading to the game's end. Similar mechanics across different games are clustered using text embeddings. To create a novel variant, Cardiverse identifies overused mechanics in a base game and explicitly swaps them with newly generated, semantically related mechanics from the same cluster.
2. Consistent Code Generation with Gameplay Validation
Cardiverse drafts game code using function templates within a custom Python card game engine. To ensure the code actually matches the rules, the framework runs simulations using randomized actions to generate gameplay logs. An LLM reviews these logs to check for rule violations. If a discrepancy is found, the system queries a code snippet database for correct implementations and iteratively patches the code.
3. Scalable Gameplay AI Generation
To avoid the massive latency and cost of calling an LLM at every single turn during playtesting, Cardiverse shifts LLM compute to "compile-time." It prompts an LLM to generate a diverse pool of Python-based heuristic functions that score potential actions. It then uses a stepwise inclusion algorithm to optimize and select the best ensemble of these heuristics based on win rates during automated self-play.
Datasets
The authors curated a dataset of 106 commonly seen card games sourced from the web (e.g., Bicycle Playing Cards). This dataset spans multiple genres, including:
- 25 casino games (mostly poker)
- 27 trick-taking games (like Hearts)
- 11 rummy games
- 10 solitaire-like games
- 33 other miscellaneous card games
For evaluation, they sampled a benchmark of 29 common games and generated 28 novel varied games.
Key Insights and Ideas
- Compile-Time vs. Runtime Inference: The biggest "aha" moment lies in the gameplay AI. Generating code-based heuristic functions upfront yields a flat operational cost during playtesting. This makes large-scale automated evaluations economically viable compared to turn-by-turn LLM agents.
- Trajectory-Based Code Validation: Traditional code generation relies on static analysis or simple unit tests (I/O pairs), which fail to capture complex state mutations over time. Validating code by analyzing simulated gameplay trajectories allows the LLM to catch subtle rule mismatches.
- Constrained Creativity: True novelty isn't random. By anchoring mechanic generation within semantic clusters and targeting frequently occurring database mechanics for replacement, Cardiverse ensures variants are fresh yet coherent.
Key Results
Novelty & Diversity
Using a metric called Quantiled Max Similarity (QMS) to measure distance from the asset database, Cardiverse successfully penalized high-resemblance generations, outperforming both vanilla prompting and PromptBreeder baselines.
Code Executability & Consistency
Cardiverse achieved 100% executability on the tested game sets. Its validation loop significantly boosted the Play Record Consistency (PCon) score (up to 9.20/10), proving that the self-reflection loop successfully aligns code behavior with natural language rules.
AI Performance & Cost Efficiency
The heuristic ensemble AI achieved a win-rate advantage of 16.3% over random agents, outperforming established LLM agent architectures like Chain-of-Thought, ReAct, Reflexion, and Agent-Pro (BeliefAgent). Crucially, due to its one-time generation cost, Cardiverse became more cost-effective than turn-by-turn LLM baselines after just 50 games.
Limitations and Future Work
- Simple Variation Scope: The current pipeline only modifies games by swapping out single mechanics; it does not yet support complex structural or combinational overhauls.
- Input Sensitivity: The framework expects highly detailed, structured game descriptions and cannot yet handle colloquial or incomplete human prompts.
- High Initial Token Cost: The iterative code validation loop is token-heavy, making the initial generation phase quite expensive (comparable to advanced reasoning models like OpenAI's o1).
- Basic AI Strategy: The gameplay AI operates on immediate action-value scoring and does not explicitly model opponent intentions or complex hidden-information strategies (like bluffing).
Summary updated