Generating Video Game Scripts with Style (2023)

Abstract: While modern language models can generate a scripted scene in the format of a play, movie, or video game cutscene the quality of machine generated text remains behind that of human authors. In this work, we focus on one aspect of this quality gap; generating text in the style of an arbitrary and unseen character. We propose the Style Adaptive Semiparametric Scriptwriter (SASS) which leverages an adaptive weighted style memory to generate dialog lines in accordance with a character’s speaking patterns. Using the LIGHT dataset as well as a new corpus of scripts from twenty-three AAA video games, we show that SASS not only outperforms similar models but in some cases can also be used in conjunction with them to yield further improvement.

## introduction as the affordances of large language models (llms) continue to reveal themselves, this technology hints at the possibility of transformative changes to narrative media such as scriptwriting, songwriting and journalism. in this work, we focus on scriptwriting for aaa foot_0 video game dialog, a domain similar to the scripts used in movies, television and theater but with its own unique flavor that often features larger-than-life characters and action-packed dialogs. our particular goal is to advance the ability to incorporate a character style or voice in responses generated by llms. the importance of this aspect is motivated by the observation that in a aaa game a character's lines will often be written by several scriptwriters asynchronously, meaning that any assistance in maintaining a consistent style is a boon. central to the problem is the representation of a character's style, with recent work using attributes such as target styles @xcite , character description @xcite , previous character utterances @xcite and conversation history @xcite . the approaches presented can be partitioned into two categories; the first, which we call explicit style, consists of a short text sample that explicitly describes the character, their profession, age, interests, and other traits. the second, which we will call implicit style, uses a list of previously authored utterances from a character instead. considering the ultimate application of these techniques in aaa game development, we propose the use of implicit style provided at inference time as most suitable for several reasons. first, it can be too limiting to summarize the style of a character narrator: marcus has hacked the final computer: speakera: ladies. gentlemen. wrench. you are now talking to the dedsec master. speakerb: nice! so how did it end? speakera: well... i signed up with the nsa in exchange for turning over personal data on every dedsec member. speakerc: marcus, i am going to hit you. speakera: it was a recruitment tool, like i thought. but i did a little extra and erased all traces i was ever there... along with the other two people who had filled the forms. maybe when the nsa never calls them back, they'll turn to dedsec. speakerc: fingers crossed. with a few labels or utterances @xcite . second, due to production constraints of the already complex narrative pipeline in the video game industry, models should be locked and not involve re-training if possible or else they risk becoming a pipeline blocker. finally as the writing process naturally develops a character through the course of scriptwriting, using inference time implicit style allows the model to adapt as the character's lines manifest in other scenes of the game. it is worth noting that methods which employ small samples of implicit style @xcite @xcite achieve strong performance but do not fully leverage this continuous increase of character's lines. to harness the signal of implicit style we build on the k-nearest neighbour language model (knn-lm) @xcite , adapting and improving it for the task of style-controlled generation. our model, the style adaptive semiparametric scriptwriter (sass), provides a drop-in replacement for a traditional language model architecture that scales well with the number of reference character lines supplied as implicit style, does not require added work from the script writers to keep up to date, and can be used orthogonally to other methods of style-controlled dialog generation. an illustration of our method is shown in figure 1 . our automatic evaluations show that sass generates responses that are more aligned with a target character style without sacrificing fluency when compared to both knn-lm and a finetuned llm baseline. ## related work we continue a long thread of study in style controlled dialog generation and the closely related topic of style transfer where the term style is heav-ily overloaded, often treating style as a categorical variable such as emotion, formality, or sentiment @xcite @xcite . we differentiate this notion of ephemeral style from the character style which is always present to some degree in a character's speech regardless of situation, of which the latter is our focus. recent research into methods incorporating explicit style has been fueled primarily by the persona-chat @xcite and light datasets @xcite . examples include @xcite which augments personas during inference and @xcite which utilizes the persona in llm prompting. previous approaches to the use of implicit style vary from concatenation of the references to the conversation history @xcite , to the construction of artificial prepended dialog @xcite , to approaches more similar to our own which seek to directly capture the frequent words used by a character as a proxy for their style @xcite . another approach to implicit style generation and transfer is learn a mapping to a vector style encoding @xcite which allows for inference time adaptation to arbitrary styles. our work also serves as a direct improvement to the k-nearest neighbour language model @xcite for which some previous attention has been paid to the intersection with style conditioning @xcite . ## dataset as no public dataset of video game dialog exists, we leverage our privileged access to the back catalog of all ubisoft games to build one. from a pool of 23 games that are sufficiently narrative for both datasets, we replace all script cue names with an added special @xmath0, although names are preserved in the dialog text. we evaluate only on dialogues where the target character has spoken strictly less than three times to avoid relying on the previous conversation history as a style indicator. 60% of the scenes are used to supply the indices of implicit style and we study the twenty characters with the highest number of lines in the remaining 40%. ## method our choice of model arises from our guiding hypothesis that a principal component of character style is simply their preferential choice of words that are either optional or semantically exchangeable with other words in context. sass consists of two components: both components provide a categorical distribution over the token vocabulary of the language model, and a style adapter combines these two components. our model architecture draws on knn-lm @xcite and adaptive semiparametric language models @xcite , improving on the gating mechanism of the latter to better choose when to leverage implicit style and when to rely on llm generation. ## results & discussion our results demonstrate that both our use of the pca probability distribution as a retrieval key as well as a dynamic style adapter lead to improvements over the strong baseline of kn n -lm r . we also show that sass can be used in combination with other methods such as pdp @xcite and explore the effects of size of the style index on performance. considering first the use of the pca probability distribution as an alternative to the llm hidden state used in k-nearest neighbor language models as a retrieval key, ## conclusion we present the style adaptive semiparametric scriptwriter (sass), drawing inspiration from the closely related k nearest neighbor and adaptive semiparametric language models. in particular we propose new formulations of the encoder for retrieval as well as the determination of the style interpolation parameter and demonstrate that they lead to improved performance. ablation studies reveal that the benefits of our approach manifest even with small amounts of reference style index material, and it is our intention to integrate this in our internal writing assistance tools in the near future. we perform experiments on two datasets, the light dataset as well as a first of its kind dataset of video game script dialogs, ubiscenes, and demonstrate that the difference in style between professionally authored and crowdsourced text is a crucial consideration for style controlled generation research. we regret that we cannot release ubiscenes publicly due to concerns of its use in products that do not respect the intellectual property of their data sources. however, we are open to speak with academic collaborators that are interested in working with this data for targeted projects and invite them to reach out to the authors.