Procedurally generating an initial character state for ... - BTH

42
Bachelor of Science in Digital Game Development June 2020 Procedurally generating an initial character state for interesting role-playing game experiences Emil Lindholm Faculty of Computing, Blekinge Institute of Technology, 371 79 Karlskrona, Sweden

Transcript of Procedurally generating an initial character state for ... - BTH

Bachelor of Science in Digital Game DevelopmentJune 2020

Procedurally generating an initialcharacter state for interestingrole-playing game experiences

Emil Lindholm

Faculty of Computing, Blekinge Institute of Technology, 371 79 Karlskrona, Sweden

This thesis is submitted to the Faculty of Computing at Blekinge Institute of Technology in partialfulfilment of the requirements for the degree of Bachelor of Science in Digital Game Development.The thesis is equivalent to 10 weeks of full time studies.

The authors declare that they are the sole authors of this thesis and that they have not usedany sources other than those listed in the bibliography and identified as references. They furtherdeclare that they have not submitted this thesis at any other institution to obtain a degree.

Contact Information:Author(s):Emil LindholmE-mail: [email protected]

University advisor:PhD Prashant GoswamiDepartment of Computer Science

Faculty of Computing Internet : www.bth.seBlekinge Institute of Technology Phone : +46 455 38 50 00SE–371 79 Karlskrona, Sweden Fax : +46 455 38 50 57

Abstract

Background. In role-playing games there is a big demand for large open-worlds thata user can explore as they desire. At the same time the demand to keep productioncosts and time at a low level, there is demand to use procedural generation to createmuch of the assets in games.Objectives. In this thesis we attempt to create interesting and believable characters,in an initial world state, using procedural generation techniques.Methods. To this end we present a personality structure based on four topics thataffect humans in many ways.Results. The implemented prototype is examined through a user study in order toverify if the generated characters are interesting and believable.Conclusions. The results reveal that although the personality structure can createinteresting characters, it is not enough on its own. To this we present several areasfor future work.

Keywords: Procedural character generation, Random number generation, Markov’schain, Game content

i

Acknowledgments

I wish to thank my supervisor, Prashant Goswami, for his good advise and deeplyhelpful feedback.

I also want to thank my girlfriend, Nicole, for her constant support and lovethrough this work.

iii

Contents

Abstract i

Acknowledgments iii

1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Aim and Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.5 Research question . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Related Work 5

3 Method 73.1 Research questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.2 Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2.1 Psuedo random number generation . . . . . . . . . . . . . . . 73.2.2 Name generation . . . . . . . . . . . . . . . . . . . . . . . . . 83.2.3 World elements’ structure . . . . . . . . . . . . . . . . . . . . 83.2.4 Personality structure . . . . . . . . . . . . . . . . . . . . . . . 103.2.5 Menu system and Player . . . . . . . . . . . . . . . . . . . . . 10

3.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.3.1 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.3.2 World elements’ structure . . . . . . . . . . . . . . . . . . . . 113.3.3 Personality structure . . . . . . . . . . . . . . . . . . . . . . . 113.3.4 Menu system and Player . . . . . . . . . . . . . . . . . . . . . 12

3.4 User Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.4.2 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.4.3 Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.4.4 Hypothesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.4.5 Subject selection . . . . . . . . . . . . . . . . . . . . . . . . . 133.4.6 Design type . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.4.7 Instrumentation . . . . . . . . . . . . . . . . . . . . . . . . . . 133.4.8 Validity discussion . . . . . . . . . . . . . . . . . . . . . . . . 133.4.9 Experiment execution planning . . . . . . . . . . . . . . . . . 143.4.10 Experiment analysis method . . . . . . . . . . . . . . . . . . . 14

3.5 Questionnaire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

v

4 Results 174.1 User study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.1.1 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.1.2 "What makes a character interesting?" . . . . . . . . . . . . . 18

5 Discussion 215.1 Motivations analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.2 Implementation analysis . . . . . . . . . . . . . . . . . . . . . . . . . 22

6 Conclusions and Future Work 256.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256.2 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

6.2.1 Text generation techniques . . . . . . . . . . . . . . . . . . . . 256.2.2 Relations between characters . . . . . . . . . . . . . . . . . . . 256.2.3 Visualisation of characters . . . . . . . . . . . . . . . . . . . . 256.2.4 Generation of backstory . . . . . . . . . . . . . . . . . . . . . 25

References 27

vi

List of Figures

3.1 Flow chart of the world elements and menu system . . . . . . . . . . 9

vii

List of Tables

3.1 Average speed of RNG methods . . . . . . . . . . . . . . . . . . . . . 83.2 User study questions . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

4.1 Answers to questions 1 through 8. SD = strongly disagree, D = dis-agree, N = neither, A = agree, SA = strongly agree . . . . . . . . . . 17

ix

Chapter 1

Introduction

1.1 Background

This thesis is motivated by the desire to generate a procedurally generated worldwith the capability of telling near infinite stories through the user’s interactions. Asthis aim is a too great of a challenge for a bachelor thesis we apply several limitationsto the prototype presented in this thesis.

In modern games there is often a desire for an open-world that is free to beexplored by the player in any order they desire. One of the genres that puts thehighest stress on this feature is role-playing games (RPGs). When entering theworlds of RPGs such as World of Warcraft (WoW) [2] or Skyrim [1] one can easilybe amazed at the sense of history the worlds contain. These worlds present a senseof complex backstory and unlimited adventures to be had for a new player. Fordevelopers who might seek to create an RPG themselves, the task of creating thisrich and complex world can seem very daunting.

In an effort to tackle this task of creating a world that feels lived in, many gamesnow rely on procedural generation (PG). PG has a wide range of applications [7].Games like No Man’s Sky [4], Dwarf Fortress [3] and .kkreiger [19] are great examplesof this. These games all rely heavily on PG yet give different experiences in playing.

In most areas of game development the techniques of procedural content gener-ation (PCG) has been used to great extents. According to Hendrikx et al.[7] PCGhas been tried and tested in all levels of game content generation. However, not alllevels have been equal in the amount of experimentation.

In their article, Hendrikx et al. divide game content into six general levels ofcontent. On the first level, named Game Bits, they place the generation of, forexample, textures, buildings, and sounds. The second level is Game Space andcontains indoor and outdoor maps as well as bodies of water. Above that, on thethird level, named Game Systems, they place ecosystems, road networks, urbanenvironments, and entity behavior. The fourth level, which will be the general focusof this thesis, is entitled Game Scenarios and holds puzzles, storyboards, levels, andstory. Level five, Game Design, consists of system design and world design. In thefinal and sixth level, named Derived Content, they have placed items generated basedon the playing of the game such as news and broadcasts, and leaderboards.

1

2 Chapter 1. Introduction

1.2 Scope

For this thesis, the intent is to further explore the fourth level of PCG, Game Sce-narios, and more precisely, story. Kybartas and Bidarra [9] have in their articlesuggested a further division to this topic. According to them, story can be put intoplot and space. Plot refers to the events that take place in any given story. Space en-capsulates the world where in the story takes place. In this thesis we focus primarilyon the second part, space.

For story-building purposes, the area of space is, in terms of PCG, fairly un-touched. In their article Kybartas and Bidarra present several tools which can gen-erate a story, or pieces of it, based on an input of a pre-made world or space. However,they also point to a lack of tools that can automatically generate said pre-made world.For a novice story-writer, be it for games, TV, books or movies, the challenge of cre-ating this, as Kybartas and Bidarra calls it, initial world state, can be a challenge.The initial world state holds the world as it stands when the story begins.

The driving forces in stories are usually the people or characters who inhabitthe world. As such, in order to create a procedurally generated initial world statethat can support a near infinite number of stories, we need to be able to generateinteresting and believable characters to populate the world.

This will therefore be the focus of our thesis. Generating an initial world statefilled with interesting and believable characters with the use of PCG. To generatean entire world with the amount of complexity it holds is a task to great for thescope of this thesis. Therefore, some limitations are enforced to guide the process ofworld-building.

• The prototype created only includes a single country. This to avoid the myriadof complex connections and interactions that would entail.

• Any element present in the prototype is highly simplified to give the illusion ofa larger complexity than what is there.

• The prototype is presented in a text-based format. The text will be hard-coded,meaning the same values will generate the same answers, independent of whenit is presented.

Taking these limitations into account, the aim of this thesis is to use PCG tech-niques, such as random number generation, to generate a simplified initial worldstate filled with interesting and believable characters.

1.3 Outline

Following this introduction section is the related works. Here you can find otherarticles which revolve around the topic of the thesis you are currently reading. Thesearticles are all found in the reference section at the back should further reading be ofinterest. Thereafter the method is presented. First the technical side, presenting theused algorithms and the structures for the simplified complexity. This is followed bythe online user study conducted as part of this work where the method is motivated

1.4. Aim and Objectives 3

and discussed. Then come the results and an in-depth analysis on the given responsesfrom aforementioned user study. A thorough section of deep discussion concerningall previous chapters follow the analysis. The thesis wraps up with some conclusionspresenting potential future work based on the results and discussion.

1.4 Aim and ObjectivesTaking the limitations presented in section 1.2 into account, the aim of this thesis isto use PCG techniques, such as random number generation, to generate a simplifiedinitial world state filled with interesting and believable characters. To achieve thiswe attempt to condense and focus on certain core aspects of imaginary world build-ing. The main focus is the attempt we make toward simplifying the people in thegenerated world. To achieve this aim we set four objectives we needed to accomplish:Planning, Implementation, User study and Analysis.

Planning: This step involved the majority of planning made during the project.In this step we test algorithms to use, create a structure for the generated world’selements and design the user study.

Implementation: This section consists of the coding of the prototype with theplanned structure.

User study: The performing of the user study, including the recruitment ofparticipants, conducting of the experiment and the collection of answered question-naires.

Analysis: This step includes the comparison of the results from the user studyto the hypothesis.

1.5 Research questionCan randomised characters have interesting and believable personalities?

Chapter 2Related Work

Procedural generation has been used in many different ways and to complete a longlist of tasks [7]. Therefore it is difficult to present all previous works touching thesubject at hand. This chapter attempts to bring to light work relevant and relatedto the topic at hand.

Hartsook et al. [6] attempted a model for procedural generation of game worldsintended to support pre-written stories. Their system bases the generation of theworld on the plot points of the story and the preferred play-style of the user. Inbroad bases their work is similar to the one presented here. The main differenceis that the world generation in our thesis does not take any predefined story intoconsideration. For our part, the focus is on creating an interesting world that canplay host to any amount of stories. No matter how long time it is active. The workpresented by Hartsook et al. is rendered in as a 2D map of the world with a fullgame system. Our own work is interacted with through text output and has onlysimple game mechanics.

Greuter et al. [5] implemented in their article, ”Real-time procedural generationof ’pseudo infinite’ cities ”, a similar technique to the one herein presented. Theirwork focuses on the generation of 3D geometry and Manhattan-like cities while oursaims to create a fantasy world presented in text form. It is however interesting tonote the similarities in both approaches up to the stage of presentation. As us, theytoo use the position of the buildings in order to set a seed for specific positions andthrough that guarantee consistent generation of each building, even after it falls outof view. Thereafter both systems differ in terms of what is to be generated, but bothsystems use the position based seed to generate each subsequent level of creation.

In modern games, be they for serious or entertainment, there is starting to show aneed for more affective game characters. A realistic response based on the emotionsof both the user and the game character is called for. Eva Hudlicka [8] presents inher article a need for an affective game engine. She also discusses emotion researchand computational emotion modeling in gaming. Ultimately she presents what anaffective game engine would need in order to be made. Although not directly relatedto this work it points at a key point of the prototype. The personality structure,which is based on topics that create emotional responses.

5

Chapter 3

Method

3.1 Research questions

As described in the introduction, the main research question of this thesis was Canrandomised characters have interesting and believable personalities?

This question looks at two subjective topics: interesting and believable. Wetherefore define these terms for the bounds of the thesis.

Interesting is defined as a user’s wish to learn more about a generated character’spast or future.

Believable is defined as the perceived variation to the characters as well as thenoted realism of the characters, if they seemingly fit in the environment they areportrayed. Believable is further determined by the generated character’s perceivedsimplicity as people, meaning if they seem too simple to be humans. It is also judgedby the characters potential extremism, if they are seen as too strong minded or tooextreme in their personality.

3.2 Planning

In this section we present what was developed during the first step of the project.

3.2.1 Psuedo random number generation

Almost all kinds of procedural content generation (PCG) require some type of randomnumber generation (RNG). In order to ensure a stable and varied result, a simpletest was performed to compare three methods. These were rand(), std::random andLehmer’s RNG [15]. The test consisted of filling a two dimensional array of booleanvalues (true/false). The RNG method was assigned a unique seed based on thelocation in the array. Each method was timed and results are presented in table 3.1.The array was also drawn to the screen to assert that the spread of values was variedin a desirable way, this step was not included in the timing.

Both std::random and Lehmer’s RNG proved good in this regard, but due to itsspeed the decision fell on the latter. Although the speed of the generation may notbe of great consequence to this prototype, future iterations upon this work will likelybe more demanding in performance of the RNG algorithm. Therefore we favor thefaster method of generation. The algorithm is fairly simple to implement and for thepurposes of this project robust enough.

7

8 Chapter 3. Method

Method Avg. Time

rand() 0.001160std::random 0.067793Lehmer 0.000269

Table 3.1: Average speed of RNG methods

3.2.2 Name generation

As the aim is to procedurally generate interesting and believable characters withinan initial world state, we needed to consider what would be needed for the charactersto be perceived as such. We argue that a major part that makes up the basis of acharacters is the name they have. A name gives the user a reference point whichthey can connect the various personalities of the characters to. In order to get an aswide variety of names for characters, which is needed to reduce a potential sense ofrepetitiveness in the characters, we needed a second algorithm that would work in ourprocedural approach. For this thesis, Markov’s chain was used. A Markov chain is astochastic process in which the probability of a particular state of the system in thenext time interval depends only on the current state and a set of defined transitionprobabilities. [18]. This means that the algorithm returns the next state to followbased only on the current state. In our case, with generating names, the currentstate is comprised of the three letters added last. The algorithm then generates aletter that follows, checks which the new three letters are and repeat the processuntil a termination sign is reached.

3.2.3 World elements’ structure

A large motivation to generating a world around the characters is to simulate apotential game like scenario. The purpose of this thesis is to see if randomly generatedcharacters can be interesting. Even though we primarily look at the charactersspecifically in this thesis it is also important to consider them in the environmentthat they are intended for. In similar ways it was motivated that the generated worldwould have a fantasy theme as many role-playing games can be found in this genre[1], [2], [3].

The world is generated based on a seed that is set based on the user’s positionin the world. When the user moves, the seed is updated accordingly, similar to thetechnique used by Greuter et al.[5] This way we ensure that, should the user returnto a formerly visited location they will encounter the same location. It also gives amaster seed to use as the foundation for generating any object in said location. Thehierarchy of the world is kept simple as the main focus of this thesis is the characters.Figure 3.1 shows the flowchart of the implemented prototype.

Biomes

Each location is given a biome. According to National Geographic: "A biome isan area of the planet that can be classified according to the plants and animalsthat live in it" [14]. To keep the prototype simple we use three types of biome.

3.2. Planning 9

Figure 3.1: Flow chart of the world elements and menu system

Plains/grassland, mountain and forest. The detailing of these were left to a minimum,thus giving more focus to the characters. But in order to give the sense of a plannedworld that the characters reside in some points of interest were added. Each biomehad a type of house, a water source for fishing and an area that could be explored fortreasures. This gives the user nothing in return, should they attempt to explore orfish. It is only added to give the world a sense of life except of the occasional citieswhere people live. Each biome was given a one in ten chance to have a city.

Cities and buildings

A city is in the prototype only a collection of buildings. When a city is created it isfilled with a randomized number of buildings. Based on the amount of buildings acity has, it is identified as different categories. A farmstead or hamlet is examplesof smaller places while an actual city has many buildings. Each city is also given aname, generated by use of Markov’s chain.

Buildings defines places for people to gather and live in. Upon creation of abuilding a randomized amount of people are set to live there. To reach any character,the user must enter a building.

10 Chapter 3. Method

People

A person within the prototype is has only a few defining features. They are given anage, gender and a name. A type of work is also assigned, although only six differentones are given. These are all based on random numbers generated through Lehmer’sRNG. The name is gotten by use of Markov’s chain, which returns a name dependanton the person’s gender.

The decision to not include visual features or other defining characteristics wasmade to give more emphasis to the personality structure, which is at the heart of thethesis.

3.2.4 Personality structure

We wished to emulate the emotions and reactions of humans. However, as thescope of this thesis is limited there was need for a way of creating something thatis experienced as more complex than it is. To this purpose, here we present a basicstructure for generating what can be perceived as complex human expressions. Thebasis of this structure is the thoughts that could be considered to divide people intoso called camps. In the prototype presented we use politics, family, law and religion.

Politics: Most people have some form of political interest. Although the interestmay take form in different ways dependant on age [11], environment [21] or otherdeterminants, it is still a topic that affect us to form our own opinions about it.

Family: Family is a fundamental concept that all humans have some relation to.All humans have their own relationship to their family, known or unknown. As suchwe believe the topic is relevant to include in our personality structure.

Law: Do we follow the law or are we okay with breaking it? Humans have for along time tried to punish those who break the law and bring justice to victims [17].Even though the majority of people today adheres to the law, it is still a point thatdefines our behaviour.

Religion: Religion has been around for thousands of years [13]. Its spread aroundthe world lets us assume that nearly all people have met the topic and formed theirthoughts about it. No matter whether a person believes or not, their thoughts will,in some areas, affect their actions and what they say.

These four topics, as motivated above, shape parts of the way most people willact and talk. As such we believe these to serve as a good underlying structure forsimplifying the human brain, to some extents.

3.2.5 Menu system and Player

For a prototype that is purely text-based the menu system of it needed to be change-able dependant on the user’s location. A lot of time was spent searching for waysto create a dynamic and easily adaptable system. As we found no one which wecould easily integrate we resorted to creating our own. The system was itself simple,letting the different locations that the user could be at handle their own menus.

In order to assert that the correct menu was used we decided that a Player classshould be used to keep track of the user’s location.

3.3. Implementation 11

3.3 ImplementationThis section describes the implementation phase of the project. Here we describethe process of creating the prototype. The prototype was developed using C++ inVisual Studio 2019 Community Edition.

3.3.1 Algorithms

Lehmer’s random number generation [15] algorithm was implemented assisted by anonline tutorial [16]. The algorithm was adjusted to work in the object-oriented styleof the prototype.

Markov’s chain was similarly implemented with assistance from an online tutorial[10]. The algorithm was converted to C++ and adapted to the object-oriented style.

3.3.2 World elements’ structure

This section covers the implementation specific steps of the prototype.

Biomes

The biome is the highest level of the world’s structure. At any time the programonly knows about the current biome that the user is occupying. If the user leavesthe biome the memory is released. At construction of the biome, a random numberis generated from Lehmer’s RNG to set the type of biome. A second number is thenproduced, used to set if a city exists in the given biome. If no city is given a randompoint of interest is generated. If there is a city, the prototype constructs said city.

Cities and buildings

When constructing a city the prototype generates a number of buildings. The amountof which defines the type of city it is. The Markov’s chain algorithm is then calledto generate a name for the city.

Buildings are created by setting a randomly generated number of people who livethere.

People

A person is the most complex element in the presented world structure. Constructionof a person starts with generating an age, with Lehmer’s RNG, a gender, a job, anda name using Markov’s chain. Lastly each person is assigned a personality structure.

3.3.3 Personality structure

Within the prototype the structure is quite simple. The four topics are given a ran-domized value, using Lehmer’s RNG, that determines their level of belief or devotionto said topic. A low value represents no belief or even hatred of the subject. Acharacter with high values will be deeply devoted, bordering on fanatic. Anyone inthe middle will have a fairly neutral tone about it.

12 Chapter 3. Method

These values are then linked to a sentence that is designed to express what thecharacter feels in the topic. In order to create a further sense of depth to the charac-ters a second check is made. This second pass connects the topics to each other byadding or changing the sentence the character utters.

3.3.4 Menu system and Player

The menu system we implemented allowed each element of the world to handle itsown menu. That way we could adjust the hard-coded replies from the charactersand the descriptive texts for each type of element.

The player class consisted of a number of boolean values (true or false) that wereset dependant on the location of the user. It also held the X and Y coordinates ofthe user, which were used to set the seed for each location.

3.4 User Study

In order to be able to answer our main research question we need find out if theproposed system serves its purpose. For our case we decided for a user study. Usinga user study allows us to collect subjective information in form of quantitative databy use of the Likert scale [12]. One may argue that the research question could beexplored with a systematic literature review (SLR). However, as we wish to exam-ine the perceived interest of the generated characters provide a user study is moresuitable.

3.4.1 Introduction

A simple program capable of procedurally generating a world with characters hasbeen implemented. The implementation uses Lehmer’s random number generationalgorithm and a Markov’s chain algorithm to enable the generation.

3.4.2 Definition

In this user study we attempt to evaluate if the generated characters are perceivedas interesting and believable. The terms interesting and believable are defined insection 3.1.

Object of study: The object of the study is the implementation created forthis thesis that utilizes procedural generation techniques to create characters forinteractive media.

Quality focus: The level of interest in generated characters as found by theparticipants is the quality focus. The amount of realism and variety the participantsperceived in the characters determined the believability of the characters.

Perspective: Ten generated characters was provided to the participants. Theparticipants chose which ones to interact with.

3.4. User Study 13

3.4.3 Context

The user study was conducted online by all participants, mainly due to the risksposed from the current pandemic. The participants were given a PDF-documentwith instructions and links to both the implemented program and questionnaire. Theobjective of the user study is to measure if the generated characters are perceivedas interesting by the participants. No comparison characters were given in orderto examine if the proposed personality structure is suitable to use for charactergeneration purposes.

3.4.4 Hypothesis

The hypothesis of this user study is that the participants will find the generatedcharacters interesting. The participants will notice the variations of characters andwish to know how the characters will evolve in their world.

Null hypothesis: The generated characters are not perceived as interesting orbelievable. The personality structure is not suitable for random character generation.

Alternative hypothesis: The generated characters are perceived as interestingand believable. The personality structure is suitable for random character generation

3.4.5 Subject selection

The user study was spread via social websites such as Facebook and other availablemethods for distribution. As such no specific subjects were approached. Participationwas voluntary.

3.4.6 Design type

The participants are handed a document with instructions and required links. Afterreading the instructions they need to follow the first link, taking them to the files forthe program. The participants download and install the program to their computerand run it. They can freely move around in the program until they have interactedwith ten characters, chosen by themselves which. Following this they need to followthe second link, taking them to the questionnaire. The estimated time of completionis 60 minutes or less.

3.4.7 Instrumentation

The guidelines for the participants is to interact with ten characters of their choos-ing, talking to them about two or more topics within the personality structure. Afterthese interactions the participants were asked to fill in a questionnaire. The ques-tionnaire can be found under section 3.5.

3.4.8 Validity discussion

The experiments validity is discussed in three ways: conclusion validity, internalvalidity and external validity [20].

14 Chapter 3. Method

Conclusion validity: The implementation might be the problem and not thetechniques explored: Lehmer’s random number generator and Markov’s chain. Thesample size of nine answered questionnaires might not be enough to draw any con-clusions as this could be statistically insignificant.

Internal validity: The sentences expressed by the characters are written by theauthor. These sentences might not be optimal.

External validity: The participants might be acquainted with the author, asthe user study was spread on social websites.

3.4.9 Experiment execution planning

The experiment was executed as follows: Participants were given a document withinstruction and in their own time perform the given tasks. The participants wereasked to interact with the characters before answering the questionnaire. As theexperiment was conducted online, no assistance from a supervisor could be offered.The goal was to have at least 20 participants fill out a questionnaire.

3.4.10 Experiment analysis method

The results from all answered questionnaires are presented in several tables. Al-though the program generates the same world for each participant, there is no wayof mapping which characters were interacted with. Therefore the analysis looksmainly at the generalized results. Do the participants perceive the characters asrealistic? Interesting? Do the participants notice a variety among the characters?These are examples of questions that was used in drawing the conclusions about thecharacters believablity.

3.5 QuestionnaireThe statements used in the questionnaire were designed based on the definitionsof the research question. Table 3.2 shows the statements used and what researchquestion it relates to. The user was asked to rate their agreement on a scale of 1 -5, where 1 meant "strongly disagree" and 5 stood for "strongly agree". Users werealso asked to motivate their answers in order to provide further understanding andmore valuable feedback.

Question 1 asks if the characters were interesting while the rest of them morepertain to the believability of the characters. Realistic in our case means that thecharacters seem to fit in the world they are portrayed in. Too simple and too extremecovers both the complexity the characters portray in their responses as well as theoverall perception of the participants.

The final question does not directly work to answer the presented research ques-tion. The decision to include this was made in order to provide a small foundationfor future iterations of the prototype here created. Further discussion on potentialfuture work will be brought up in chapters six and seven.

3.5. Questionnaire 15

Questionnaire

"The characters I interacted with were interesting.""The characters I interacted with were realistic.""The characters I interacted with were varied.""The characters I interacted with were too simple.""The characters I interacted with were too extreme.""Given the fantasy setting: The names of the characters were realistic.""I would like to find out about the characters’ backstories.""I would like to find out about the characters’ future in their world.""What defines an interesting character to you?"

Table 3.2: User study questions

Chapter 4Results

Results of the user study are presented in this chapter. In total there were nineparticipants who participated in the study.

4.1 User studyThis section presents the results from the user study. Each question is presented inorder in table 4.1. Thereafter comes a summary of the final question posed in thequestionnaire.

4.1.1 Results

The main focus of the user study was the interest and level of believability thecharacters gave the participants through their interactions.

SD D N A SA

"The characters I interacted with were interesting." 0 2 2 3 2

"The characters I interacted with were realistic." 0 1 2 6 0

"The characters I interacted with were varied." 0 2 3 1 3

"The characters I interacted with were too simple." 0 3 3 3 0

"The characters I interacted with were too extreme." 2 4 2 1 0

"Given the fantasy setting: The names of the characterswere realistic."

0 0 1 4 4

"I would like to know more about the backstory of thecharacters I interacted with."

0 1 0 5 3

"I would like to know more about how the characters Iinteracted with will evolve."

0 1 0 6 2

Table 4.1: Answers to questions 1 through 8. SD = strongly disagree, D = disagree,N = neither, A = agree, SA = strongly agree

The first question asks about the interest that participants got from the charactersthey interacted with. As presented in section 3.5, the next five questions mainly lookat the characters believability.

17

18 Chapter 4. Results

Realistic looks at how well the participants felt the characters fit into the worldthey are portrayed in. Varied is asked in order to assert that the random generationdoes not produce any noticeable patterns or that the characters are seen as too simi-lar. By asking about the characters perceived simplicity we can see if the personalitystructure is indeed aiding in the generation of characters that seem more complexthan they are. The question of too extreme characters is used to ensure that thecharacters are not made too extreme in their responses.

Questions seven and eight are again tied to the level of interest participants feltfor the characters. Interesting characters were defined in section 3.1 as a user’s wishto know more about the characters past and future.

4.1.2 "What makes a character interesting?"

In this section we analyse the final question posed in the survey. The responses werein the broader sense similar, yet differ on the lower levels. Therefore we present thisin further sections dedicated to their main subject as it comes to interesting characterdevelopment.

Backstory

Many of the participants mentioned that the backstory is one of the key ingredientsto an interesting character. Learning how someone became who they are and whythey have the opinions they express, mainly the more extreme opinions, can make agenerated character easier to relate to and so make it more interesting. There wasalso arguments that the backstory should be given in pieces and/or layers for theuser to work out their connections. However, the backstory should still make senseto how the character’s current state of opinion.

Personality

Personality was another major topic written about. Participants argue for clearand believable personality traits. These should not be told about to the user, butshown through a characters actions and responses. A character, especially a majorone, should posses certain unique qualities, according to some participants. Qualitiessuch as a hero’s unyielding loyalty to a cause that would cause them to lay down theirlife, should the situation arise. Other participants wrote that interesting charactershave goals, both long-term and short-term, and weaknesses such as fears and flawsin their personality.

Reactivity

The topic of reactivity came up in several responses. An interesting character shouldreact to the user’s actions. The character should as well have the possibility tochange their opinions about topics. Either through direct interaction with a user orthrough indirect methods were a user influences an event that makes the characterreevaluate their stance.

4.1. User study 19

Other points

This section analyses the points made by only a few participants.One participant mentioned that interesting characters have a duality in their opin-

ions. As example from the prototype was a character who expressed an uncertaintyin God’s existence, but they still gave thanks to God for their family.

Another participant put emphasis on the ability to meet the same character atmultiple places as long as their personality can support their being there. One canimagine meeting a lumberjack in their home and later stumble on to them in theforest.

It is also important that the characters have relationships between each other.Relationships with other characters could also influence the levels of opinions thecharacters have. A more strongly opinionated person that is together with a calmand collected person could affect each other in any direction.

Chapter 5

Discussion

5.1 Motivations analysis

In this thesis we examined if randomly generated characters can be interesting. Inorder to achieve this we utilised a random number generation algorithm, a Markovchain and a personality structure based on four topics that motivate human be-haviour. The characters were placed in a role-playing game environment with afantasy genre and presented in a text based format.

Looking at the numeric results of the user study alone the research question seemsto have a positive answer. Arguably the structure is a little to simple. However, asthe participants were asked to motivate their answers, another picture comes up. Inthis section we attempt to dissect these motivations to reach to a conclusion for theresearch question.

The general consensus seems to be that the characters indeed are perceived asinteresting and believable. Several participants wrote about a sense of consistencyamong the characters they talked to. This can on the one hand mean that thestructure is sound in its planning. On the other hand it can also mean that thoseparticipants had the fortune to talk to the "right" people. This due to the fact thatseveral of the other participants point out cases were consistency can be questioned.More than one participant referred to a three year old character who spoke as theadults in strong words against both law and the king of the land. Yet the child knewit was a child and therefore had no job. It is highly unlikely to come across someonelike that in the real world and a user’s immersion would therefore be broken.

This issue of children speaking as adults was something we did not consider. Inorder to give the characters more interest to the users, we added an age to them, notthinking that this problem would arise. In future works this should be adjusted sochildren speak in more believable ways.

Another point brought up is the lack of connections between the characters whoshare homes. As these would presumably be related in some way, and thereforeinfluence each others opinions, this broke the realism of the characters and reducestheir validity. This issue was expected to appear and we chose not to include aconnection between the characters. Both due to the fact that we wished to see howwell the structure stood on its own, without changes, and due to a lack of time toimplement this feature. However, as it is a reason for the participants loss of interestit is something to consider in future works.

The participants, for the most part, agree on that the characters are not toosimple nor too extreme. However, it needs to be discussed that they also felt the

21

22 Chapter 5. Discussion

characters lacked in some areas. The participants expressed a desire for descriptionsof visual features and that the replies given seemed to repeat themselves from differentcharacters. These things are features we knowingly kept out. Visual features includesa multitude of variables to consider and in order to implement the level of descriptionswe would have wanted, less focus would have been put in other areas.

For the characters replies to differ, we also would have to sacrifice other featureswe deemed more relevant, such as the second pass of the answers given. It wouldbe very interesting to implement either natural language generation or context-freegrammar in order to make the characters answer in more varied ways in future work.But the time constraints of this thesis made those options irrational approaches.

As such, we make an attempt to answer the research question posed in section3.1: Can randomised characters have interesting and believable personalities?. Withall the motivations considered we believe that the generated characters, as they nowstand, are not sufficient for believable character generation, although it should besaid that the characters appear to be interesting. However, it should be noticedthat if the motivations given by the participants that speak against the charactersbelievability are meet and solutions made, the structure can be a part of what makesinteresting and believable procedurally generated characters.

Taking a look at the proposed personality structure in the context of the generalworld it may not seem to contribute to any great extents. However, although it maynot stand on its own in the generation of interesting and believable characters, thestructure can still be used as an extra addition to assist in the aim of believableprocedurally generated characters.

5.2 Implementation analysisThere are many limitations to be found in the implemented prototype. For simplicitywe present them in a list before looking further at each in turn.

• No visual features for characters, or the world.

• Hard-coded responses for each topic in the personality structure.

• Values in the personality structure has no influence on surrounding characters.

• Only four topics in the personality structure.

The focus in the thesis was the personality structure and as such we made thedecision to exclude any visual features of the characters. This choice, combined withthe text-based format of the prototype, revealed how important a visual aspect canbe. Future iterations of this project should consider this.

Hard-coded texts for all character responses, and menus, cause the repetitivenature of these texts to be inevitable and expected. It would, given the opportunity,be better to implement a text generating feature like context free grammar or naturallanguage generation to handle at the least responses from characters to ensure theirvariety.

Without any influence of the people surrounding them the characters give a largersense of inconsistency. When generating a building, and the family that lives there,

5.2. Implementation analysis 23

one could start the generation of a fully random character, subsequent charactersgenerated are also randomly generated but are influenced by the previously generatedcharacters in the building.

Although the four topics used in the presented personality structure are onesthat affect much of our behaviour, they are only four. As such they present a greatlimitation to how the characters will act and evolve, should no other features beadded to this structure.

Chapter 6Conclusions and Future Work

6.1 ConclusionThe user study revealed flaws in the design of the personality structure and only insome cases were interesting characters met by the users. Therefore the conclusionof this work is that the proposed personality structure, on its own, is not capable ofproducing interesting characters. It could be successful if further steps were taken.

6.2 Future workThis section presents a few areas for future work.

6.2.1 Text generation techniques

The repetitive nature of hand written dialogue was a big issue to the realism of thecharacters. Therefore an implementation of text generating techniques like context-free grammar or natural language generation could provide more varied and believ-able results.

6.2.2 Relations between characters

Characters without relationships to each other are a reason immersion is brokenaccording to the participants in the user study. A solution as to how the charactersare assigned relationships and how these affect the personality structure would be agood area to explore further.

6.2.3 Visualisation of characters

The lack of visualisation of the characters also provide an area for continued work.The issue of giving the user visual cues that does not read as a list of features canbe an interesting topic.

6.2.4 Generation of backstory

Interesting characters need a backstory. This was made evident from the last questionposed in the questionnaire. As such, an area for future work is to generate believablebackstories to the generated characters based on their current state. The backstories

25

26 Chapter 6. Conclusions and Future Work

should be able to vary so characters with similar personality structure do not end upwith the same backstory.

References

[1] Bethesda. The elder scrolls v: Skyrim, 2011. Video Game.

[2] Blizzard. World of warcraft, 2004. Video Game.

[3] Bay 12 Games. Dwarf fortress, 2006. Video Game.

[4] Hello Games. No man’s sky, 2016. Video Game.

[5] Stefan Greuter, Jeremy Parker, Nigel Stewart, and Geoff. Leach. Real-time pro-cedural generation of ‘pseudo infinite’ cities. In Procedings of the 1st interna-tional conference on Computer graphics and interactive techniques in Australasiaand South East Asia, pages 87–ff, 2003.

[6] Ken Hartsook, Alexander Zook, Sauvik Das, and Mark O. Riedl. Toward sup-porting stories with procedurally generated game worlds. In 2011 IEEE Confer-ence on Computational Intelligence and Games (CIG’11), pages 297–304, 2011.

[7] Mark Hendrikx, Sebastiaan Meijer, Joeri Van Der Velden, and Alexandru Iosup.Procedural content generation for games: A survey. ACM Trans. MultimediaComput. Commun. Appl., 9(1), 2013.

[8] Eva Hudlicka. Affective game engines: Motivation and requirements. In Pro-ceedings of the 4th International Conference on Foundations of Digital Games,pages 299–306, 2009.

[9] Ben Kybartas and Rafael Bidarra. A survey on story generation techniquesfor authoring computational narratives. IEEE Transactions on ComputationalIntelligence and AI in Games, 9(3), 2017.

[10] Coding challenge 42.1: Markov chains - part 1. Tutorial on Markov chain re-trieved from YouTube.

[11] Aaron Martin. Young People and Politics : Political Engagement in the Anglo-American Democracies. Taylor and Francis Group, 2012.

[12] S. A. Mcleod. Likert scale. 2008.

[13] R.L. Montgomery. Special persons and the spread of religions. Pastoral Psy-chology, 65, 2016.

[14] Biome. Definition of biomes retrieved from National Geographic.

27

28 References

[15] S.K. Park and K.W. Miller. Random number generators: good ones are hard tofind. Communications of the ACM, 31(10), 1988.

[16] Procedural generation: Programming the universe. Tutorial on procedural gen-eration retrieved from YouTube.

[17] Mitchel P. Roth. An Eye for an Eye : A Global History of Crime and Punish-ment. Reaktion Books, Limited, 2015.

[18] Markov chain. Definition of Markov Chain retrieved from ScienceDirect.

[19] .theprodukkt. .kkreiger, 2004. Video Game.

[20] Claes Wohlin, Per Runesson, Martin Höst, Magnus C. Ohlsson, Björn Regnell,and Anders Wesslén. Experimentation in Software Engineering. Springer Scienceand Business Media, 2012.

[21] Yang Zhong. Political Culture and Participation in Rural China. Taylor andFrancis Group, 2012.

Faculty of Computing, Blekinge Institute of Technology, 371 79 Karlskrona, Sweden