AIResearch AIResearch
Back to articles
Coding

AI Lets Players Create Spells With Words

A new game uses a language model to turn natural language prompts into custom spells, blending player creativity with AI-driven gameplay for a unique interactive experience.

AI Research
March 26, 2026
4 min read
AI Lets Players Create Spells With Words

Imagine playing a video game where you can design your own magical abilities simply by typing a description, like 'a trap that holds the enemy to the ground,' and watching it come to life instantly. This is the core idea behind SpellForger, a project developed by researchers at the Universidade Federal do Rio Grande in Brazil, which aims to transform how players interact with games by making artificial intelligence a direct part of the gameplay. Unlike traditional games where spells are pre-defined, SpellForger uses a language model to interpret player prompts and generate unique spells in real time, offering an unprecedented level of personalization. This approach moves beyond typical AI applications in gaming, such as controlling non-player characters, and instead positions AI as a co-creation tool that empowers players to shape their own strategies from the start. By bridging natural language with game mechanics, the project highlights a shift toward more dynamic and creative experiences in digital entertainment.

The key finding of this research is that a supervised-trained BERT model can effectively map textual descriptions to specific spell attributes, enabling real-time generation of custom spells within a game environment. The system interprets player prompts and assigns them to one of several spell types, such as Projectile, Fireball, Thunder, Trap, or Area Effect, based on the input. For instance, the example prompt 'a trap that holds the enemy to the ground' would be classified as a Trap type, represented numerically as '3' in the system. Beyond type classification, the model also balances numerical parameters like Power, Speed, Area, and Color, and determines status effects through a matrix that defines interactions like health debuffs or speed boosts. This allows each spell to be tailored to the player's description while maintaining competitive integrity, as the AI adjusts costs and effects to ensure fairness. The result is a functional prototype where player creativity drives the gameplay, validating the use of AI as a central mechanic rather than just a background tool.

Ologically, the researchers built SpellForger using the Unity Game Engine for development and Python for the AI backend, leveraging machine learning libraries like PyTorch and Scikit-learn. The core of the system is a BERT-based model, chosen for its speed after training, which acts as a supervised model trained on a dataset of spell descriptions paired with their corresponding attributes. This dataset was created synthetically using a few-shot technique with GPT-3, where initial manually crafted examples guided the generation of new data to cover various spell features. The model processes player prompts through a script that communicates between Unity and Python, analyzing the text to associate it with a spell type, adjust status parameters, and generate effects. These outputs are then mapped to predefined spell prefabs in Unity, which reconfigure themselves based on the parameters, with triggers and effects attached dynamically to create the spell's behavior. The entire process runs locally on the user's computer, taking an average of 200 milliseconds, though the paper notes that further studies are needed to account for different hardware setups.

In terms of , the project delivered a working prototype that demonstrates real-time spell generation, as shown in a demonstration video linked in the paper. The system successfully interprets diverse prompts and produces spells with customized types, statuses, and effects, such as assigning numerical values for parameters and populating a status effects matrix that defines interactions like damage or debuffs. For example, the matrix uses rows for triggers (like collision with an enemy) and columns for statuses (like Health or Speed), with values ranging from -1 to 1 to indicate positive or negative modifiers. The researchers also monitored the dataset distribution through graphs, such as Figure 1, which shows the spread of spell types to ensure balanced training examples. This data-driven approach helps maintain variety and fairness, as spell costs are calculated from base costs and weighted contributions of statuses and effects, with some negative weights reducing cost for less advantageous effects. The prototype thus showcases how AI can enable a gameplay loop centered on player creativity, with spells generated on-the-fly to support strategic personalization and replayability.

Of this work extend beyond gaming, as it represents a novel application of AI in interactive media where natural language becomes a direct interface for content creation. By allowing players to describe spells in their own words, SpellForger fosters a deeper sense of agency and immersion, potentially revolutionizing how games are designed to incorporate user input. This could lead to more adaptive and personalized experiences in other domains, such as educational tools or creative software, where AI interprets human language to generate custom content. In the gaming industry specifically, the project opens new paths for AI usage as a co-creation tool, enabling developers to build systems that respond dynamically to player expressions rather than relying on predefined options. The researchers suggest that a successful implementation could inspire similar approaches in other games, making AI more accessible as a gameplay mechanic and encouraging innovation in procedural content generation. Ultimately, this bridges the gap between technical AI research and practical, engaging applications that prioritize user creativity.

However, the paper acknowledges several limitations that must be addressed in future work. One major is the need to create and maintain a dataset for training the model, which can be difficult for developers without specialized expertise, as it requires generating synthetic data and ensuring balanced distributions across spell features. The researchers used GPT-3 to automate this process, but noted that many examples had to be cut due to repetitive or unhelpful generation, indicating room for improvement in data quality. Additionally, the current system relies on a fixed set of spell types and parameters, which may limit the diversity of spells that can be created compared to more generative models. The paper also mentions that the 200-millisecond processing time is an average estimate, and precise measurements across different hardware setups are still needed to optimize performance. To overcome these hurdles, the researchers propose future developments, such as building automated pipelines powered by generative models to simplify dataset creation, making AI tools more accessible for game developers and expanding the potential for dynamic content generation.

Original Source

Read the complete research paper

View on arXiv

About the Author

Guilherme A.

Guilherme A.

Former dentist (MD) from Brazil, 41 years old, husband, and AI enthusiast. In 2020, he transitioned from a decade-long career in dentistry to pursue his passion for technology, entrepreneurship, and helping others grow.

Connect on LinkedIn