Spell Conjurer
An experimental project exploring how Large Language Models and runtime compilation can be used to give players direct control over creating new gameplay mechanics inside a running game.
Abu Rayan Bhuyan • Jose Alberto • Mohammad Shah
Overview
This project explores how modern AI can remove traditional modding barriers and expand player freedom without requiring knowledge of a game's internal systems. Spell creation is the core mechanic: players start each run with no predefined spells and generate them dynamically via prompts. Each spell is unique and did not exist in the original game code.
The system combines LLM-driven code generation, gameplay validation, and a custom runtime compilation pipeline that injects new mechanics during active gameplay.
Technical Focus
LLM Driven Spell Generation
The LLM creates context-aware spell logic that integrates with existing systems. It also sets balancing parameters like damage, range, cooldowns, and visuals, ensuring spells are usable and fair. Generated spells persist across runs and can influence future encounters when used by enemies.
Runtime Compilation Pipeline
Spells are generated as code, requiring a pipeline that validates, compiles, and safely injects them at runtime without interrupting gameplay.
AI and Procedural Content
Beyond spells, enemies use a weighted decision-making model to select movement, targets, and spells based on threat and positioning. The system adapts dynamically to player behavior. The LLM also generates grid-based maps for each run following rules that ensure playable layouts.
Architecture Decisions
All spells are generated at runtime with no prewritten logic. They interact with the game via a unified interface, allowing both players and enemies to use them consistently. Generated code is isolated from core gameplay to minimize risk while keeping flexibility.
Outcomes & Learnings
Spell Conjurer shows how LLMs can enable real-time gameplay system creation rather than just static content. Key takeaways include:
- Integrating LLMs into core mechanics
- Designing safe runtime compilation pipelines
- Balancing AI-generated mechanics for players
- Creating adaptive AI responsive to player-generated systems
My Contributions
- Core game design and gameplay systems architecture
- Runtime code injection pipeline for compiling and integrating LLM-generated spell logic
- Prompt engineering and optimization for consistent, balanced spell generation
- AI behavior system with weighted decision-making for NPC spell selection and targeting
Gallery