Skip to content

sachiniiits/AI_Game_Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AI Game Engine (V2 Pipeline) 🚀

Single-prompt code generation is a bottleneck. If you want an LLM to generate a complex web game, a single API call just isn't going to cut it. It usually results in a broken, hallucinated block of code.

To solve this, I built the Autonomous Multi-Agent Game Engine targeting HTML5 and Phaser.js.

After experimenting with 2D engines like Pyxel, I pivoted to Phaser.js for its robust community and web-native ecosystem. Then, I mapped out a traditional game development lifecycle and translated it into a parallel, agentic workflow.

Welcome to the V2 Pipeline—a major evolutionary leap from basic code generation. We have transformed the architecture into a multi-phase, self-correcting workflow that guarantees robust, playable, and complex web games from a single text prompt.

⚙️ The Architecture: An Autonomous Assembly Line

By separating the "thinking about design" from the "writing of syntax," hallucination drops drastically. The system orchestrates 5 distinct AI specialists working together:

  1. 🔍 Research Agent: Establishes context, mechanics, and game tropes before a single line of code is written.
  2. 📝 Script Agent (The Designer): Formulates a detailed blueprint and rule set based on the research.
  3. 🧠 Logic Agent (The Architect): Handles spatial reasoning, mathematics, and visual constraints, outputting precise pseudocode and a visual draw manifest.
  4. 💻 Coding Agent (The Developer): Compiles the context into functional, executable JavaScript using the Phaser.js framework.
  5. 🛡️ Validator Agent (The QA Tester): An autonomous QA loop that acts as a safety net. It catches syntax errors, missing assets, and API misuse, forcing self-correction from the Coding Agent up to 3 times.

The Validator Agent ensures the final output is a completely self-contained, playable game.html file that runs instantly in any modern browser without a local server.

🚀 The Challenge: Scaling with Reasoning Models

The biggest challenge right now is extracting maximum reasoning capability while staying under the rate limits of free-tier models. The Coding Agent must hold the Research Report, Game Design, Pseudocode, and Draw Manifest all in its active memory.

This engine reaches its full potential when powered by high-intelligence, frontier reasoning models (such as Gemini 2.5 Flash/Pro with extended thinking budgets). The architecture is proving that multi-agent orchestration is the future of complex code generation.


🛠️ How to Use It Efficiently

1. Prerequisites

Ensure you have Python 3.8+ installed along with the required Google GenAI SDK:

pip install google-genai python-dotenv

2. Configuration

Create a .env file in the root directory and add your Gemini API key:

GEMINI_API_KEY="your_api_key_here"

3. Running the Engine

Simply run the pipeline orchestrator from your terminal. You can pass your concept directly:

python pipeline.py "make a neon-style platformer game with a double jump"

Or run it interactively:

python pipeline.py
# Prompt: Enter your game concept:

4. Playing Your Game

The pipeline will stream logs detailing the time taken by each agent. Once complete, it generates:

  • build/web/game.html 🎮: The final playable game! Open this file directly in any web browser.
  • output/: Contains the markdown files generated by each agent (Research, Design, Logic, and Validation). Read these if you want to peer into the AI's "brain" and see exactly how it planned your game!

Built utilizing Advanced Multi-Agent AI architecture.

About

A state-of-the-art Multi-Agent AI system that autonomously researches, designs, codes, and validates playable Phaser.js games from a single text prompt.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages