SpellForger: Prompting Custom Spell Properties In-Game using BERT supervised-trained model
📝 Abstract
Introduction: The application of Artificial Intelligence in games has evolved significantly, allowing for dynamic content generation. However, its use as a core gameplay co-creation tool remains underexplored. Objective: This paper proposes SpellForger, a game where players create custom spells by writing natural language prompts, aiming to provide a unique experience of personalization and creativity. Methodology: The system uses a supervisedtrained BERT model to interpret player prompts. This model maps textual descriptions to one of many spell prefabs and balances their parameters (damage, cost, effects) to ensure competitive integrity. The game is developed in the Unity Game Engine, and the AI backend is in Python. Expected Results: We expect to deliver a functional prototype that demonstrates the generation of spells in real time, applied to an engaging gameplay loop, where player creativity is central to the experience, validating the use of AI as a direct gameplay mechanic.
💡 Analysis
Introduction: The application of Artificial Intelligence in games has evolved significantly, allowing for dynamic content generation. However, its use as a core gameplay co-creation tool remains underexplored. Objective: This paper proposes SpellForger, a game where players create custom spells by writing natural language prompts, aiming to provide a unique experience of personalization and creativity. Methodology: The system uses a supervisedtrained BERT model to interpret player prompts. This model maps textual descriptions to one of many spell prefabs and balances their parameters (damage, cost, effects) to ensure competitive integrity. The game is developed in the Unity Game Engine, and the AI backend is in Python. Expected Results: We expect to deliver a functional prototype that demonstrates the generation of spells in real time, applied to an engaging gameplay loop, where player creativity is central to the experience, validating the use of AI as a direct gameplay mechanic.
📄 Content
The application of Artificial Intelligence (AI) in games has been used in the past for several applications, most often for Non-Player Characters (NPC) behavior, with simple methods such as Finite-State Machines [Jagdale 2021], and in recent years more complex systems using Machine Learning [Senanayake 2025]. This work presents a project called SpellForger, a game that advances in this direction by using Natural Language Processing (NLP) as a central playability mechanic.
The main concept of SpellForger is the freedom the players have to create their own spells by writing a description in a prompt. Then, a Large Language Model (LLM) interprets it and generates a unique spell for the player. This system aims to provide an unprecedented level of personalization and creativity, where the player’s strategy begins at its own spell forging.
The remainder of the paper is organized as follows. Section II presents a literature review. The methodology and game proposal are presented in Section III, and the gameplay is detailed in Section IV. Finally, in Section V, some final remarks are made, and directions for future research are indicated.
Procedurally Generated Content (PGC) in games is not something new; titles like No Man’s Sky [Hello Games 2016] and Minecraft [Persson 2010] use it to create diverse and large worlds. ChatGepetto [Lima et al. 2023] uses GPT, a generative model, to create game narratives in real time. In [Amaral et al. 2022], a transformer deep learning model is used to generate music in real time, with the intention of creating personalized experiences for different users. In [Awiszus et al. 2023], a BERT model is used to generate Minecraft world snippets. Bidirectional Encoder Representations from Transformers (BERT) [Usherwood e Smit 2019] is a model that takes text and encodes it into a representation for other models. We can then add a layer that takes the result of the model and turns it into desired values, by the process called fine-tuning, so it can adapt to any specific task.
Our project differentiates itself by applying those technologies not in narrative or landscape generation, but in the game’s central mechanic interactions. Games like Galactic Arms Race [Hastings e Stanley 2010] have attempted to personalize the user experience in the central mechanic by understanding their preferences with machine learning, but this method is different from ours as it does not give the user full control of what’s available to them. Rather than giving players options and trying to understand their preferences, our focus is on allowing players to access any option they wish through their expression, allowing them to explore and learn how our system reacts to their interaction. The use for interpreting prompts and turning them into parametrized abilities represents a novel approach to playability personalization.
This section explains our work in more detail, within the technological aspects of the proposed system.
Our development used the Unity Game Engine, chosen due to its robustness and ample support for 3D and multiplayer games. The AI logic to the spell generation was developed in Python, using machine learning libraries (PyTorch [Paszke et al. 2019] and Scikit-learn [Pedregosa et al. 2011]). For the language model, we used a BERT-based architecture, where the model is trained like a supervised model, with a dataset of spell descriptions and their respective numerical and functional attributes, making it a bridge between human language and game logic. The BERT model was chosen due to its speed after training, being more lightweight than a generative model like GPT-2 would be.
The innovative part of our project resides in the magic generation, where the AI acts as an interpreter and balancer of the forged spells. Our methodology of using a BERT model meant we would require to define a spell within a fixed amount of resulting parameters. In order to define a system that could generate dynamic behavior, we had to choose relevant values that could allow for variety. Thus, the characteristics of a spell were chosen to be: its type, its status, and its effects.
When a player starts a new match, they must insert a prompt. For this section, we will use this example of input a user might type: “A trap that holds the enemy to the ground.” Unity will then communicate with Python code through running a script, which imports the language model that will analyze and associate the description with a spell type from the available types defined for the system. It will also adjust the status parameters that will further customize the spell and generate the status effects for that spell. The Unity system will then receive those results and map them to a specific spell prefab, which will reconfigure itself based on the parameters. Finally, the Trigger scripts will be attached to the game object of the spell based on the status effects (Section 3.2.3). Any other triggers will also be incorporated when they a
This content is AI-processed based on ArXiv data.