the growth of the npc
DESCRIPTION
NPC Adaptation in Interactive Fiction. The growth of the npc. By: Ryen Wilkins Adviser: Dr. C. David Shaffer. Introduction. Description: - Can Interactive Fiction (IF) take advantage of machine learning to build a more compelling story? - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/1.jpg)
THE GROWTH OF THE NPCNPC Adaptation in Interactive Fiction
By: Ryen WilkinsAdviser: Dr. C. David Shaffer
![Page 2: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/2.jpg)
Introduction Description:
- Can Interactive Fiction (IF) take advantage of machine learning to build a more compelling story?
Implementation:- Focus on Genetic Algorithm- Limited story with learning character(s)- TADS 3 Interactive Fiction authoring system- Rock, Paper, Scissors
![Page 3: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/3.jpg)
Genetic Algorithm (GA)a) Create random population (set of chromosomes)b) Evaluate each chromosome using fitness functionc) Select best n to continue into next generationd) Perform genetic operations- Mutation- Crossovere) Repeat from b until desired fitness is achieved
![Page 4: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/4.jpg)
Interactive Fiction Story in which the reader interacts with
characters or items, typically impacting the story line.
Several genres exist There are several IF authoring systems:
Inform, TADS, Adrift, Quest… None include support for machine
learning
![Page 5: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/5.jpg)
TADS 3 Dialogue Example
![Page 6: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/6.jpg)
TADS 3 Similar in appearance to C++, Java and
Javascript. Prototype-based language. Standard object library (Adv3 library). Built in random generator. Debugging tool. Replay function. Vectors.
![Page 7: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/7.jpg)
Incorporating GA in TADS 3 Used Object-Oriented Implementation of
Numerical Methods by Didier Besset Convert from class-based OOL to
prototype-based OOL. Deal with differences in library, random
generator, collections, iteration, etc.
![Page 8: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/8.jpg)
Incorporating GA in TADS 3 Pre-test: Partition Problem Vector of weights. Each must be assigned to
a left or right scale. Goal is to get as close to balanced as
possible. Chromosome: Vector of 1s (left) and 0s
(right) Results: Simple test shows genetic algorithm
is capable of being implemented in TADS 3
![Page 9: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/9.jpg)
Next Step Can I get a character in the story to
react to the reader’s decisions? Need a setting.
- Reader is a wizard trapped in a dungeon.- Discovers that he will be released from the dungeon if he can defeat a guard in a game of rock, cloth, knife.
![Page 10: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/10.jpg)
Rock, Cloth, Knife Chromosome: Probabilities that this guard
will select rock, cloth or knife. Initial population size: 100 From reader: 5 sets of 5 rounds each Fitness: Number of sets in which the
chromosome defeats the player. (50 iterations per set.)
Compared with system where rock, cloth and knife have equal probability (uniform).
![Page 11: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/11.jpg)
Mutation and Crossover Mutation:
- New random value.- Mutate two at a time.
Crossover: - Cross and switch multiple values across two members.- Add both.
![Page 12: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/12.jpg)
Initial Results “Good” members were lost in mutation. Adding both crossover members could
trap algorithm when too many poor members were made because of it.
![Page 13: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/13.jpg)
Mutation and Crossover revisited Creep mutation – Small amount added
or subtracted to a value. More even results and don’t lose “good” members.
Crossover over one value and only add a single new member.
![Page 14: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/14.jpg)
Uniform PlayerRCK Results (50 iterations/set – 5 generations)
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
Total Wins
Trial #
![Page 15: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/15.jpg)
Rock focused player (75%)50 iterations
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 16: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/16.jpg)
Cloth focused player (75%)50 iterations
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 17: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/17.jpg)
Knife focused player (75%)50 iterations
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 18: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/18.jpg)
25-50-25 – 50 iterations
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 19: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/19.jpg)
Me (R: 11 C: 8 K: 6) 50 iterations
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 20: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/20.jpg)
Conclusions Genetic algorithm creates better
opponents for specialized strategies than a uniform strategy, the only option built in with TADS 3.
Results can be used to create a character(s) that will seem to react to how the reader plays the game.
![Page 21: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/21.jpg)
Second level (uniform)
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 22: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/22.jpg)
Uniform – 50 generations
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 23: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/23.jpg)
Uniform – 100 generations
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 24: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/24.jpg)
Second level (25-50-25)
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 25: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/25.jpg)
Second level (25-50-25 50 generations)
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 26: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/26.jpg)
Second Level (me)
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 27: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/27.jpg)
Second level (me – 50 generations)
1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
GAUniform
![Page 28: The growth of the npc](https://reader036.vdocuments.mx/reader036/viewer/2022062520/568165cd550346895dd8dbd4/html5/thumbnails/28.jpg)
Future Work Expand to a more difficult game:
- Waving Hands: http://www.gamecabinet.com/rules/WavingHands.html