Download presentation
Presentation is loading. Please wait.
Published byRalf Clarke Modified over 9 years ago
1
NPC Adaptation in Interactive Fiction By: Ryen Wilkins Adviser: Dr. C. David Shaffer
2
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
3
Genetic Algorithm (GA) a) Create random population (set of chromosomes) b) Evaluate each chromosome using fitness function c) Select best n to continue into next generation d) Perform genetic operations - Mutation - Crossover e) Repeat from b until desired fitness is achieved
4
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
5
TADS 3 Dialogue Example
6
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.
7
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.
8
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
9
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.
10
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).
11
Mutation and Crossover Mutation: - New random value. - Mutate two at a time. Crossover: - Cross and switch multiple values across two members. - Add both.
12
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.
13
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.
14
Uniform Player RCK Results (50 iterations/set – 5 generations) Total Wins Trial #
15
Rock focused player (75%) 50 iterations
16
Cloth focused player (75%) 50 iterations
17
Knife focused player (75%) 50 iterations
18
25-50-25 – 50 iterations
19
Me (R: 11 C: 8 K: 6) 50 iterations
20
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.
21
Second level (uniform)
22
Uniform – 50 generations
23
Uniform – 100 generations
24
Second level (25-50-25)
25
Second level (25-50-25 50 generations)
26
Second Level (me)
27
Second level (me – 50 generations)
28
Future Work Expand to a more difficult game: - Waving Hands: http://www.gamecabinet.com/rules/Wavi ngHands.html
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.