Bevy AI Agent - AI-Powered Game Development Assistant
Bevy AI Agent is a comprehensive library and CLI tool that leverages cutting-edge AI models (GPT-4, Claude-3, Gemini) to accelerate Bevy game development through natural language code generation, intelligent feature addition, and automated code optimization.
Features
AI Model Integration
- OpenAI: GPT-4, GPT-4-Turbo, GPT-3.5-turbo
- Anthropic: Claude-3-opus, Claude-3-sonnet, Claude-3-haiku
- Google: Gemini-pro, Gemini-pro-vision
Dynamic Code Generation
- No more rigid templates - AI generates contextual, unique code
- Understands complex game concepts and mechanics
- Creates complete, working Bevy applications from scratch
- Context-aware feature additions that integrate seamlessly
Game Development Features
- Natural Language Game Creation: Describe your game in plain English
- Intelligent Feature Addition: Add complex systems with AI assistance
- Code Analysis & Optimization: AI-powered code review and improvements
- Smart Dependency Management: Automatically detects and manages Cargo dependencies
- Template System: Built-in templates for common game types
- Project Management: Track AI conversations and generated files
Installation
CLI Tool
Library
Add to your Cargo.toml:
[]
= "0.1.0"
= { = "1.0", = ["full"] }
Quick Start
1. Configure API Keys
# Configure OpenAI (recommended)
# Or use Anthropic
# Or use Google
# Set default model
2. Create Your First AI-Generated Game
# Create a 2D platformer
# Create a 3D space shooter
# Create a puzzle game
3. Add Features to Existing Games
4. Improve and Optimize Code
# Improve performance
# Enhance readability
# Add better structure
Advanced Usage
Complex Game Creation
# Roguelike with procedural generation
# Physics-based puzzle game
# Tower defense with AI
Model Selection
# Use specific models for different tasks
Code Analysis and Debugging
# Get AI explanations of your codebase
# Debug specific issues
# Analyze specific files
Project Management
# View project information
# Show project statistics
# View AI conversation history
# Clean up generated files
Build Operations
# Build your game
# Run your game
# Check for errors
# Run clippy lints
# Format code
Template System
# List available templates
# Show template details
# Create game from template
Library Usage
Basic Usage
use ;
async
Advanced Project Management
use ;
use PathBuf;
async
Custom AI Requests
use ;
async
Real-World Examples
Metroidvania Game
Generates:
- Interconnected world systems
- Power-up mechanics
- Ability-gated progression logic
- Map and exploration systems
Dialogue System
Creates:
- NPC interaction systems
- Dialogue tree management
- UI components for conversations
- Audio integration hooks
A* Pathfinding
Implements:
- Pathfinding algorithms
- Navigation mesh generation
- Dynamic obstacle detection
- AI behavior integration
Configuration
Configuration File
Bevy AI stores configuration in ~/.bevy-agent-config.json:
Environment Variables
You can also configure using environment variables:
Project Configuration
Each Bevy AI project includes a .bevy-agent.json file that tracks:
- Project metadata
- AI conversation history
- Generated files
- Dependencies
- Custom templates
🔮 Key Advantages Over Templates
- Unlimited Creativity: Not constrained by predefined templates
- Context-Aware: Understands your existing codebase
- Learning: Benefits from the latest AI model improvements
- Explanatory: Can explain and teach as it generates code
- Adaptive: Handles edge cases and unique requirements
Architecture
Core Components
-
AI Integration Layer (
src/ai/)- Multi-provider AI client (OpenAI, Anthropic, Google)
- Model-specific prompt optimization
- Response parsing and code extraction
-
Project Management (
src/project.rs)- Project lifecycle management
- Conversation history tracking
- File generation monitoring
-
Template System (
src/game_templates.rs)- Built-in game templates
- Custom template support
- Context-aware code generation
-
CLI Interface (
src/cli.rs)- Command-line interface
- User interaction handling
- Progress reporting
-
Utilities (
src/utils.rs)- Code analysis tools
- Build system integration
- File system operations
Supported AI Models
| Provider | Models | Context Length | Strengths |
|---|---|---|---|
| OpenAI | GPT-4, GPT-4-Turbo, GPT-3.5-turbo | 8K-128K | Code generation, debugging |
| Anthropic | Claude-3-opus, Claude-3-sonnet, Claude-3-haiku | 200K | Long context, reasoning |
| Gemini-pro, Gemini-pro-vision | 32K | Multimodal, fast inference |
Built-in Templates
- Basic Game: Simple 3D scene with camera and lighting
- 2D Platformer: Physics-based platformer with player movement
- 3D FPS: First-person shooter with mouse look and movement
- Puzzle Game: Grid-based puzzle mechanics
- Strategy Game: RTS-style unit management and resources
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
Running Examples
# Set up API keys
# Run CLI examples
📄 License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
🙏 Acknowledgments
- The Bevy team for creating an amazing game engine
- OpenAI, Anthropic, and Google for providing powerful AI models
- The Rust community for excellent tooling and libraries
🔗 Links
Status
This project is actively developed and maintained. We aim to support the latest versions of Bevy and provide cutting-edge AI integration for game development.
Current Status:
- Core AI integration ✓
- Multi-provider support ✓
- Project management ✓
- Template system ✓
- CLI interface ✓
- Web interface (planned)
- IDE plugins (planned)
- Asset generation (planned)