Video game screenshot: Macbeth in castle overlooking green mountains and blue sky
Players try to talk Macbeth down from a violent path in the new UC Davis-developed game Stay Thy Blade.

Rewriting Macbeth: New UC Davis Game Uses AI to Teach Conflict De-Escalation

It’s Act 3, Scene 2 of Shakespeare’s Macbeth. The titular character has just killed the Scottish king and is on the brink of committing more violence to keep his new crown. For those who know how the play ends, Macbeth proceeds to his eventual doom. But what if you could talk him out of making such drastic, life-altering decisions? 

In Stay Thy Blade, players can do just that. The interactive, AI-driven game, developed at the University of California, Davis, by two Ph.D. students in computer science in collaboration with a professor of English, allows players to speak directly to Macbeth and attempt conflict de-escalation strategies to try to change his mind at this crucial juncture of the play.  

As a game, Stay Thy Blade promises intrigue and high-stakes drama. As a teaching tool, it offers something more: a chance to practice strategies to keep real-life drama — and the potential for violence — to a minimum. 

From Shakespeare Workshop to Digital Game

The concept for Stay Thy Blade is the brainchild of Gina Bloom, a professor of English at UC Davis. An expert in Shakespeare, applied theatre and education, Bloom has been working on a research project with a colleague in South Africa, which has one of the highest criminality scores in the world, according to the World Population Review. 

Together, they developed a series of workshops that used Shakespearean scenes already being taught in the classroom to facilitate conversations about violence de-escalation. 

“The idea was to take scenes in Shakespeare where there’s a character who is becoming violent, and say, ‘Could we step back from that and think about where the violence is coming from and if there’s a way to change the narrative?’” she said. 

Bloom, who also co-developed the motion capture-based Shakespeare game Play the Knave, saw an opportunity to expand this work. 

Computer science Ph.D. students Kyle Mitchell and Nicholas Treynor, trees in background
Computer science Ph.D. students Kyle Mitchell, left, and Nicholas Treynor built the digital interface of Stay Thy Blade. (Mario Rodriguez/UC Davis)

“I thought, ‘Wouldn’t this be cool if we could essentially digitize this activity?’” Bloom said. “Can we deliver applied theater techniques without a human facilitator?” 

Bloom connected with Kyle Mitchell and Nicholas Treynor, Ph.D. students in computer science, through the UC Davis Center for Artificial Intelligence and Experimental Futures, which also now funds their collaborative and interdisciplinary research.  

Mitchell and Treynor work in the Social Intelligence, Narrative and Games Lab, or SING, led by Associate Professor of Computer Science Josh McCoy. Mitchell conducts research on character design for video games, while Treynor focuses on AI and storytelling.   

“Our expertise is largely in building games and playable experiences with an emphasis on trying to build more complex characters and interactions than you’re likely to see in the sorts of games on the market,” Treynor said. 

For both, the concept offered an opportunity to experiment with up-and-coming AI tools, such as natural language processing for player-to-character interactions and symbolic systems for setting character traits. 

To Render Macbeth in Code

Mitchell in black motion-capture suit with markers standing T-pose in a lab
Mitchell wore a motion-capture suit and performed physical movements to bring Macbeth to life in the game. (Mario Rodriguez/UC Davis)

The team began with the game’s main character. 

In Act 3, Scene 2, Macbeth contemplates continuing down a path of violence to maintain his power. His emotional instability is what makes this scene an ideal first test case for Stay Thy Blade. 

“It’s sort of a tipping point,” Treynor said. “We’re offering the players the opportunity to intervene.” 

To bring Macbeth to life, Mitchell built a rule-based psychological model of Macbeth using symbolic systems, a type of AI that uses structured variables to represent complex ideas. In Stay Thy Blade, the variables model Macbeth’s psychology, including traits like paranoia and ambition, emotional stances like defensiveness and vulnerability and evolving beliefs about whether the player can be trusted. Using symbolic systems to build Macbeth allowed Mitchell to keep Macbeth’s personality and emotional logic coherent throughout player interactions, whereas something like a large language model could generate inconsistent responses. 

“Gina, Nick and I all sat down and thought about what makes Macbeth Macbeth,” Mitchell said. “What are his defining traits that would be important in this de-escalation scenario to believe about the character?” 

Mitchell says one of the trickier aspects of building Macbeth — a character that Mitchell has played on stage — was programming the character to obey the dramaturgical rules that are set while still creating a fun gaming experience and a teaching tool.  

“You want him to be irritable, you want him to be angry, you want him to be hard to persuade because that is the kind of character that he is,” he said. “But we can't make it too hard, and we can't have the rules punish the player in situations where they are making reasonable attempts to de-escalate things.” 

One way Mitchell worked around this was through a top-down override. If a player says something rhetorically beautiful and truly moving, they automatically succeed in making Macbeth calmer. This does not necessarily guarantee that the player will win the game; Macbeth needs to reach a certain level of calmness for the player to win. 

From Conversation to Computation

Treynor speaking into a handheld microphone at a computer desk
Treynor demonstrates gameplay by speaking into a microphone. (Mario Rodriguez/UC Davis)

During gameplay, the player interacts with Macbeth by speaking into a microphone. 

Treynor, who led development of the game’s backend, designed a pipeline that translates the player’s spoken words into actionable data. The audio is transcribed using OpenAI’s Whisper model, then analyzed through a large language model, or LLM. 

The LLM has been trained to identify one of five possible de-escalation strategies, such as redirecting the conversation or appealing to Macbeth’s logic, in the player’s speech and assigns a score based on how effective the response is likely to be. 

“The things that we're hoping the player is going to be trying,” Treynor said, “are redirecting Macbeth's attention from the scenario, or suggesting they take a walk and talk about these things, creating some space, maybe trying to be a little bit more rational with him. It’s a very different task than something like a dialogue tree, where you click from options.” 

The system then updates Macbeth’s emotional state based on the strategy, score and personality traits. Then it selects the most appropriate response from a pool of about 80 pre-written dialogue options, not AI-generated ones, for a more authentic character voice. If the strategy isn’t working, Macbeth will continue to escalate, but if the player is using more effective strategies, Macbeth will de-escalate. 

A Hybrid Approach to AI

The system’s strength lies in combining two different approaches to artificial intelligence. 

An LLM alone would interpret human speech but struggle to maintain a consistent personality. A symbolic system can model a character’s psychology, but it would be extremely labor-intensive to make it understand natural speech. 

Combining the two technologies has allowed Mitchell and Treynor to create a Macbeth that has personality, understanding and reasoning, resulting in more authentic interaction with the player. 

“Where symbolic systems are weak, large language models excel, and I think where large language models are weak, symbolic systems excel,” Mitchell said. “By merging these kinds of systems together, we can really create something truly, truly powerful.”

The Next Act

Games like Stay Thy Blade allow people to practice these de-escalation strategies in a safe digital space without fear; they can test different approaches, make mistakes and try again without real-world consequences. For Bloom, Mitchell and Treynor, Shakespeare's plays were a perfect fit for exploring these skills — not only because they are rife with high-stakes situations, which they are, but because Shakespeare is already prevalent in the educational zeitgeist. 

“It’s not that Shakespeare is special in how he represents these issues. It’s that these plays are already so central to education,” Bloom said. “Shakespeare’s omnipresence in schools is an opportunity to engage people in a very important conversation about violence in our societies and give them a chance to practice non-violent ways of dealing with conflict.”

Mitchell, Treynor and Bloom have already begun to iterate on the game. They recently developed a second scenario using a scene from Romeo and Juliet about domestic violence. Bloom will host play sessions with her students this spring to gather helpful player feedback on the new scene as well as on a virtual-reality version of Stay Thy Blade that the group is currently developing in partnership with alum Nick Toothman. Toothman earned his Ph.D. in computer science at UC Davis, conducting research under Professor of Computer Science Michael Neff, whose Motion Lab has been instrumental in developing Stay Thy Blade’s avatar animation system.  

Shakespeare’s omnipresence in schools is an opportunity to engage people in a very important conversation about violence in our societies and give them a chance to practice non-violent ways of dealing with conflict.” - Gina Bloom

This summer, the team will be working on a new collaboration with Adult Protective Services Northern Academy at UC Davis to develop a version of the game that can be used to help train social workers. And once the model is finely tuned, the range of characters it can embody is endless, from fictional favorites to historical figures, inviting players into their interactive digital worlds.   

“We really want this to succeed not only as a game, but as a pedagogical tool,” Mitchell said. 

Primary Category

Secondary Categories

Education & Outreach Students

Tags

More Engineering News