This document provides a literature review for a dissertation on developing an AI system to interact emotionally with users. It summarizes key research in several areas:
1) AI systems in games focus on speed and resource efficiency over robustness. Decision making and agent-based systems are important.
2) Other fields develop behavioral models to define personality traits. One example uses parameters to simulate aggressive, fearful or sad behaviors in a pong game.
3) Emotional models inform realistic AI reactions. The PAD model measures emotions across pleasure, arousal, and dominance dimensions. Plutchik's wheel illustrates primary and secondary emotions.
1. 1
Evaluating the use of Artificial Intelligence methods to improve Non-Playable
Characters emotional interaction with the user
Mark Alexander McLachlan
Abertay University
School of Arts, Media and Computer Games
BSc Computer Games Application Development (Hons)
April 2016
2. 2
Acknowledgements
I wouldlike togive thanksto the staff of AbertayUniversityforthe fouryearsof educationinwhichI
have developedandbettermyself.Iwouldalsoliketogive thanksto myhonourssupervisorand
lecturerforArtificial Intelligence,DavidKing.Histeachings,advice andsupportwouldnothave
inspiredme totake thisroute and made thispossible.
I. Abstract
As gameshave grownoverthe many decade,there hasbeenmanydevelopmentsthathave
benefitedotherindustriesandresearchesthathave come fromthe gamingindustryandvice versa.
Artificial Intelligencehasbenefitedgreatlyfromthe relationshipitshareswithboththe technology
industryandof academia.Asimportantdevelopmentsare made,artificial intelligence isakeypartin
ensuringthatcertaintechnologiesof greatimportance donotfail andcan solve issuesastheyarise.
Gamesdevelopmenthasbeenyearningforthatadvancementtoo.Asgamesbecome more
complicated,the needforsmarter,andwell-designedartificial intelligence systemsare neededfor
manyneedsfromhelpingwithrunningthe game toreallybeingable tochallengethe player.This
papersintentionistoshowhowfuzzylogiccan be usedto helpdevelopmore realisticemotional
reactionsfromartificial intelligentagents. The fuzzylogicisappliedwiththe use of followingan
architectural model fordecisionmakingandpsychological emotionalmodelstoensure thatthe
agentsare as realistic,while remainingasplausible aspossible.The overall outcome of thisprocess
isthe abilityforthe agenttochange emotional statesdependingonthe situationthatitfaces.
Resultsshowthatemotional statescanbe chosenwhenfollowingtospecificemotiongroupswith
the use of a decisiontree torefine the emotionlisttobecome asspecificaspossible,before using
weightedvaluesassignedtothe emotionsinwhichthe agentdecidedonitsownwhatemotionis
mostappropriate.Therefore,the use of fuzzysystemsinconjunctionwithemotionalresearchand
aspectsoutside of the technologyfield,canholdbenefitsinunderstandingandcreatingagentsthat
react more like human.
3. 3
Table of Contents
Acknowledgements................................................................................................................... 2
I. Abstract.............................................................................................................................. 2
1. Introduction....................................................................................................................... 4
1.1 The initial problem....................................................................................................4
1.2 Research Question.....................................................................................................4
1.3 Dissertation Structure............................................................................................... 5
2. Literature Review.............................................................................................................. 6
2.1 Introduction............................................................................................................... 6
2.2 AI Systems inGames..................................................................................................6
2.3 AI Systems inother Fields ......................................................................................... 7
2.4 Emotional Models..................................................................................................... 10
2.5 The OCC Model.......................................................................................................... 12
2.6 Fuzzy Logic................................................................................................................ 14
2.7 Decision Trees.......................................................................................................... 19
2.8 Summary................................................................................................................... 20
3. Methodology.................................................................................................................... 21
3.1 Designing the Logic....................................................................................................... 21
3.1 How the user interacts with the system................................................................. 26
4. Results.............................................................................................................................. 27
5. Discussion........................................................................................................................ 37
6. Conclusions and Future Work ........................................................................................ 38
7. Appendices....................................................................................................................... 39
4. 4
1. Introduction
1.1 The initial problem
In a worldwhere graphical powerisnowdedicatedtoitsownhardware componentasa meansto
improve graphics use ingamesforrealisticworldsaswell ascharactermodels, the pushfor
developingmore convincingandbelievablecharactersisalmostata pointof beinga necessityto
meetthe standardof realism.Depthandcomplexityof charactersisexpectedtocome across in
realisticlooking,ornarrative heavygames.
However,Non-PlayableCharacters(NPCs) emotional interactionandpersonalitiesinvideogames,
are still atthispointintime,staticand pre-defined.Leavingopen-worldgamestosufferfrom
predictabilityandoftenun-convincingcharacterinteractiondue to dialogue, traitsorbehaviouras
beingpre-defined,leavinglittle tonorange of personalityandbelievability.
Lookingat howNPC’sconverse withthe playerinSkyrim(The ElderScrollsV:Skyrim2011)
demonstratesthatcharactersare merelyrepresentedbyscripteddialogue,withall havingaccessto
Bethesda’sspeciallycreated RadiantA.I framework (Bertz2011). Whichisimpressive intermsof
managingtheirin-game behaviouranddispositiontothe playerintermsof friendship,itfallsdown
interms of actuallyconversingwithcharacterswhentheysaythe same scripteddialoguethatother
characters of theirtype wouldsay.Thisessentiallyleavesthe playerpullingawayfromthe
surroundingNPC’sasthe wallsof believabilityfall.
At the opposite endof the spectrum,MassEffect(Mass Effect2007) was well knownforits
immersive storyandprogressivelydeepeningcharacters.Ithoweverlackedinitsimplementationof
itscharacters AI,as the charactersdepthwasall scriptedtofitinwiththe story, withouthavingany
effectonthe gameplayforthe characters.Evenin the latergames,itonlyaddeda value forbeing
loyal inwhichitunlockedaskill forthem.Still havinglittle tonoeffectonthe charactersbehaviours
or statesduringthe actual gameplay.
Thisprojectwill assessthe believabilityandsuccessof beingable tocreate multipledifferent
personalityagentsandpersonality/emotional algorithmsforthe use of videogame characters.
Buildingfrompreviousworkanddevelopingittomake NPCinteractionmore dependentonits
personalityandtoreact basedonitspersonality,emotionalstate and playersconversationchoices.
1.2 Research Question
The researchquestion is…:
How can an AI system be developed to interact with a user realistically on an
emotional level?
5. 5
The projectsaimsand objectiveswere dividedintothe followingpoints:
To analyse multiple currentanddifferenttechniquesusedincreatingArtificial Intelligence
for NPCs andAI IntelligentAgents.
To assessthe current use of AI techniquesincreatingNPC’sandAIintelligentAgents, in
termsof believabilityandfunctionality
To builda suitable interactivesystem/applicationforuserinteractionwiththe Artificial
IntelligenceAgentthroughthe use of conversation.
To determine the applicationssuccessfulnessintermsof believabilityandfunctionality.
To come to a conclusion onthe matterfor suggestionsof the future.
1.3 Dissertation Structure
The dissertationwillfollowthe structure of introducingthe backgroundandpointof the dissertation
at heading,alongwithitsaimsandobjectives throughoutsection1).Fromthere itwill move onto
section2), the literature reviewsection.Inwhichthere willbe the researchdone forthe foundation
of the projectfroma psychological,programmingandlogical pointof how emotional responsesare
understoodandimplemented.The methodologysectionfollows insection3),inwhichitwill specify
the approach and techniquesusedtoreachthe aimsand objectivessetoutinthe introduction.
Leadingonto the resultsinsection4) whichthe resultstakenfromthe applicationwill be discussed
and evaluatedbefore endingthe dissertation atsection5) witha conclusionbasedonwhatwas the
overall consensus of the approachandresearch,finishingwithsuggestionsonhow future work
couldapproach the topicinthe future.
6. 6
2. Literature Review
2.1 Introduction
Whenreviewingmaterial inregardstothe project undertaken, breakingdownthe necessary
topicsisof importance.Whenthinkingaboutdevelopingandtryingtoanswerquestions,its
bestto start off wide andnarrow the search.For obviousreasons,aprojectbasedon
artificial intelligence wouldbestbe servedwith general researchintothe fieldsof artificial
intelligence inbothcomputergamesdevelopmentandinotherfields.Whentryingto
approach the projectwithhumanbehaviourandemotionsinmind,lookingintothe
psychological conceptsandunderstandingwouldhelpenhance anddefine the valuesand
architecture of basingdevelopmentonsaidmodelsandresearch. Additional researchtopics
wouldbe the logical approachof how to achieve the artificial intelligence systemthrough
logicsystemsanddesignconcepts.
2.2 AI Systems in Games
Artificial IntelligenceSystemsingamestake adifferentapproachthantypical systems
developmentinotherfields. The mostimportantthingingamesdevelopmentistodevelop
somethingwithaslittle resourcesusedaspossible. Asthe focuswhendevelopingagame is
mostly prioritised onspeed, alotof AIsystemsare simplifiedwithclever spinstosimulate
intelligence, aswell asafocus on clevereralgorithms.These howeverdo notshare the same
robustnessasdevelopmentsuch asdatabase serverengineering.There isalsoalot of
drawingontechniquesfromotherfields,butmodifyingthembeyondtheiroriginal
resemblance anduse.Finallythe lastmajordifference fromdevelopinggameswouldbe that
developersmake adjustments indifferentways,leavingalgorithmsunrecognisablefrom
companyto company. (MillingtonandFunge 2009a)
Relevanttothe project,one of the mostimportantAI systemswouldbe decisionmaking.
Thisinvolvesthe characterworkingoutwhatto donext.Usuallyhavingeachagenthaving
differentrangesof behavioursthattheycouldchoose toperform.Suchasattacking,hiding,
exploringandsoforth.The decisionmakingsystemneedstodecide whatactionisthe most
appropriate ateach momentinthe game,withrelevance towhatthe agent’smostlikely
reactionwouldbe. (MillingtonandFunge 2009b).For example,the use of decisionmaking
for the animalsinvariousZeldagames,the animalswouldstaystill unlessapproachedbythe
player,atwhichtheywould move away.Formore complex decisionmakingagentsfrom
more recentgames,Destiny’s(Destiny2014) enemyAI agentshave decisionmaking based
on variousenemytypesaswell asdistance fromthe player.Where if theyare inclose
proximitytothe player, theywouldchoose tomelee the playerinsteadof usingranged
attacks. Enemieswithdifferentabilitieswill make decisions withregardstowhentouse
themsuch as whenbeingunderfire orthreatenedbythe player.
7. 7
Whenapproachingdevelopmentforgames,one of the importantaspectsof character
developmentisthe use of agent-basedAI.Thisisthe approachof producingautonomous
characters that take informationfromthe environmentandgame data,inwhichtheywould
determine whatactiontheywouldtake basedonsaidinformationandcarryout actionsthat
it deemssensible.The designisexplainedasbeingabottom-updesign,inwhich
considerationisgivenfirsttothe agent’sbehaviourtowhichthenimplementationof the AI
to supportit isdone.Insimple terms,developinghow the agentmovesanddecisionmaking
isthe basisfordevelopingatypical agentsAIsystems. (MillingtonandFunge 2009c)
In contrast,a non-agentAI wouldtendtotry and workout how everythingworksinatop
downapproach,in whicha single systemiscreatedtosimulate everything.Forexample, in
Grand TheftAutoIII (GrandTheftAutoIII 2001) the pedestrianandcars are calculated
dependingontime of dayandcity regionandare onlyturnedintographical peopleandcars
whenthe playercan see them.
2.3 AI Systems in other Fields
In more academicfields,therewasdevelopmentoncreatingbehaviouralreactive agentsfor
definingpersonalitytraitsforpong,oras theycalledtheirversion,Uberpong.(Delgado-
Mata, C., et al 2008a) It goesonto describe how there seemstobe a lackin behaviourfor
computerdrivenplayerandnon-playingcharacters.Inwhichtheylooktobringrobotics
inspiredbehaviouralAItechniquestosimulatepersonalitiesforcomputergames. The AIis
designedtoworkbydefiningfour parameters.These parametersare aslisted:
How the computerdrivenopponentapproachesthe ball’sdestination.
Firstsetof parameterstodefine the opponentspersonalityprofile (Aggressive,sad
or fearful)
Secondsetof parameterstodefine the opponentspersonalityprofile(audaciousor
cautious)
thirdsetof parameterstodefine the opponentspersonalityprofile.(impulsive,
predictive oranalytic)
8. 8
Fig. 1 – AI architecture of Uberpong (Delgado-Mata, C., et al 2008b)
From the above Figure (Fig.1),how the decision-makingisapproachedfirstlybyhow the
opponentapproachesthe ball’sdestinationusingthree methods.The firstistosimplyfollow
the ball,the secondisto erraticallyfollowthe ball inasimilarwayto the firstmethodby
usinga noise value tovelocityresponse,andthirdlyapredictive algorithmthatworksout
where the ball isestimatedtobe.The thirdmethodisusedfor‘smarter’opponents.
(Delgado-Mata, C.,etal 2008c)
In termsof how personalitiesplayintothe decisionmaking,forthe firstsetof parameters,if
the opponentisdefinedasaggressive,itwill tryandblockthe ball withthe bat tightenedso
as to deflectthe ball backwithanincreasedvelocity.If itisfearful,itwill tryandslow down
the ball downby tighteningthe batbefore the ball collideswiththe bat,andif itis sad,will
alwayshave the bat stretchedatall times. (Delgado-Mata, C.,etal 2008d) Below isa figure
of howsaidpersonalitieswouldaffectthe firstsetof parameters.
9. 9
Fig02. – Example of uberpong’sfirstpersonalityparameters (Delgado-Mata, C., et al 2008e)
From whatis demonstratedinfigure2, The secondsetof parametersdefinethe traitsof
audaciousandcautious. If it isdefinedasaudacious,itwill tryandcollide withthe ball witha
vertical movementsoasto make the ball take on differenteffectssuchasmovingoff at
differentangles,whileapersonalitytraitof cautiousdoesnottryand give the ball any
effects. (Delgado-Mata, C.,etal 2008f) Below isa figure of how the secondsetof
parameterswould affectthe game play.
10. 10
Fig.03 – Uberpong’sexampleof personality two paramters. (Delgado-Mata, C., et al 2008g)
Finally fromthe exampleinfigure 3, the third setof parameterstodefine personalityare
impulsive,predictable andanalytic.These define the type of strategythe opponentwilltake
by whenitwill use powerupswhenavailable tothem.If theyare impulsive,theywill use
powerupsas soonas they getthem.If theyare predictable,theywillwaithowevermany
secondsbefore usingthe powerups.Lastlyif the opponentisanalytic,itwill analyse the
momenttocause the mostdamage to the player. (Delgado-Mata, C.,etal 2008h)
2.4 Emotional Models
Emotional modelsare of use whendesigningartificialagentsasthe aimof creating
realisticallyreactiveAIsistomake themmore human-like.Withthatinmind,lookingat
modelsof personalitiesandemotionsbasedonhumansisworthresearchingtotryand
implementamodel basedonthe verypeople we are tryingtoimitate.
One such model of emotionswouldbe the Pleasure-Arousal-Dominance (orPAD)
dimensional modelof emotion. The model wasdevelopedwiththe ideaof beingable to
measure emotionalstatesusingthree numerical dimensionstorepresentall emotions.The
numerical dimensionsbeingPleasure,Arousal andDominance.Onthe Pleasure-Displeasure
scale,itmeasureshowpleasantanemotionis.Suchasfear or angerwouldscore highon the
displeasurescale,while joywouldscore highonthe pleasure scale. The Arousal-Nonarousal
scale measuresthe intensityof emotionssuchasrage beingahighscoringemotiononthe
arousal scale,whereasboredomwouldscore higheronthe non-arousal scale. Finallythe
Dominance-Submissivenessscale measureshow controllingornon-dominatingthe emotion
wouldbe.Forexample,angerwouldbe adominatingemotioninwhichitexpressesmore
dominatingreactions,whilefear,beingasimilarlynegativeemotion,wouldbe submissive as
it removesreaction.(MathWorks2015)
11. 11
Anotherapproachof emotional statesisthe Plutchik’swheel of emotions asshowninfigure
4. It is an infographthatusesthe colourwheel toillustrate variationsandeffectsof the
relationshipsamongemotions.The currentapplicationsof the wheel are beingusedin
roboticsand sentimentanalysis.The model showseightprimaryemotionswitheachof their
correspondingemotionsacrossfromeachother.Joyversussadness,trustversesdisgust,
fearversusangerand anticipationversessurprise.Alongwithcontrastingemotions,they
alsohave varyingdegreesof intensity,indicatedbycolourintensitydecreasing, asthe
intensitydecreases.There isalso the inclusion of secondaryemotionsbetweentwo
combiningemotionssuchasoptimismbeingacombinationof anticipationandjoy,Love
beinga combinationof joyandtrustetc. Alsohavingtheircontrastingemotionat the
opposite side of the diagram.
Fig 04. - Plutchik's wheel of emotions (WhatIs 2012)
12. 12
2.5 The OCC Model
The Ortony,Clore and CollinsModel (OCCModel) asshownbelowinfigure 5, isan
architectural model thatwasdesignedforthe use of givingstructure tocreatingemotionally
reactive agents.Ittakesintoconsiderationhow anartificial agentwouldreacttoa given
situationsuchas an eventthathashappened,the actionof itself oranotheragenttowards
an object.Furtherrefiningitdownbasedonhow it wouldperceivethe situationinregards
to howit wouldaffectitselforothers.Once ithas those pointsdecided,itwouldmove onto
howit wouldreactemotionallyeitherin apositive ornegative way. (Steunebrink,Dastani
and Meyer2009)
Fig. 05 – Diagram of the OCC model
Breakingdownthe model,itdescribesahierarchythatclassifies22emotiontypes.It
containswithinthe hierarchythree branches,beingexplainedasconsequencesof events
(E.g.Joy andresentment),actionsof agents(E.g.Pride andReproach) andaspectsof objects
(E.g.love andhate).Additionallythere are some branchesthatcombine toforma group of
compoundemotions,inparticularemotionsconcerningconsequencesof eventscausedby
13. 13
the actionsof agents.(E.g.Gratitude andAnger) Because the notionsof events,actionsand
objectsare commonlyusedinthe designingof agentmodels,thisdoesmake the OCCmodel
suitable forthe use of artificial agents.
The understandingof howeachemotiontype interactsorcausesa particularoutcome is
importantto be able to develop anemotionallyreactive system properlywiththe use of the
OCC model.Inwhichthe followingtable(Fig.06) holdsthe author’sexplanationof each
emotiontype tohelpwiththe understandingof the use of the model. The examplegivenfor
the specificationexample was“fear”inthe OCCmodel.
Fig. 06 – The emotion type specifications
The example givesusthe understandingof theirbeingthree elementsinvolved.
1) The type specificationprovides,inaconcise way,the conditionthatwouldtriggeran
emotionof the type inquestion.
2) A listof tokensisprovided,whichshowswhatemotionwordscanbe classifiedas
belongingtothe emotiontype inquestion.(E.g.‘fright’,‘scared’,andterrified’are all
typesof fear.
3) For eachemotiontype,there are a listof variablesaffectingintensity.Thesevariables
are local to the emotiontype inquestion.Forexample,global variables(E.g.Arousal)
that affectall emotionswouldnotbe included.Inessence,the higherthe valuesare for
the emotional variables,the higherthe emotional intensity.
Below infigure 7, is a listof each of the emotiontypesbeinggiventype specifications, which
can be usedtofill the type elementin the developmentof anemotionallyreactive agent.
14. 14
Fig. 07 – The emotion type specifications
2.6 Fuzzy Logic
Fuzzylogicisthe approachof designating“degreesof truth”ratherthan Booleanlogicof
“true or false”whenmakingdecisions.ItwasfirstusedbyDr. Lofti Zadeh of the Universityof
Californiainthe 1960s. In whichhe was workingonthe problemof computersbeingable to
understandnatural languages.Inwhichthere were difficultiesof translatingactivitiesand
decisionswhentryingtouse absolute valuesof 0and 1.
FuzzyLogic worksbyhavingthe Booleanvaluesof 0 and 1 as extreme casesof truth,in
whichthe valuesbetweenthemare differentdegreesof truth.Example beingthatone
personcan’tbe both“tall”and “average”in height, buttheycanbe “0.4 of tall”And“0.5 of
average”at the same time.(Shownbelow infigure8)
15. 15
Fig. 08 – Height Fuzzy Sets showing memberships. ()
Fuzzylogicisa closerapproachindealingwithdatainthe same waypeople do. (WhatIs
2006) It useswordsratherthan numberstodefine values.The usesof wordsare less
precise thannumbers,howevertheiruse isclosertohumanintuition. Howeverfuzzylogicis
more of a compromise of crispand fuzzyvaluestobe able toobtainvaluesthatare more
similartohumandecisionmaking. There are 5stepsto the fuzzificationprocess.The process
goesFuzzificationof the inputvariables, applyingthe fuzzyoperator(ANDorOR) in the
antecedent, applyingthe implicationmethod,aggregate all outputsand Defuzzification.
The processof usingfuzzylogicworks asshownin figure 9.By beginningwith initialvalues
or crisp values,theyare putintoappropriate fuzzysets.Fuzzysetsare setsthatallow its
memberstohave differentgradesof membershipswiththe use of membership functions.
Usuallydefinedashavinga range of [0,1]. Once achieved,the membershipvaluesare passed
throughthe inference system,inwhichthe rulesthatestablishthe fuzzylogicare usedina
fuzzyinference system.Once those valueshave beenthough the inference system, theyare
readyto be defuzzified.Thisiswhere the conversionfromfuzzyoutputstocrispvaluestakes
place withvariousmethodsbydoingthe inverse processof fuzzification.
16. 16
Fig. 09 – Architecture of how Fuzzy systems work. (TutorialsPoint 2016)
Withthe fuzzyvalues,theyare usedinconjunctionwithwhatisknownas‘fuzzyrules’which
isthe wayof definingthe ‘if-then’rules.Inwhichthe humansolutionof ‘if-then’isconverted
intofuzzyrules. These canthenbe usedinconjunctiontocreate suitable membership
functionsinrelevance tothe fuzzysystem. Thisispartof the inference partof the processin
whichusingOR operandswouldbe consideredasinclusive whileusingthe ANDoperands
are consideredasexclusive.
In the well-knownexample of fuzzylogic,the tippingexample isusedtoexplainhow the rule
base systemsworkbasedonthe question.“Whatisthe right amountto tipyour
waitperson?”Inthe examplethe service andfoodqualityisthe valuesthatwould influence
the value of tip.The rulesinthe example are asfollows
Service - Poor Service - Average Service - Excellent
Food- Rancid Tip - Cheap
Tip - Average
Food- Generous Tip - Generous
The rule exampleswouldbe inanEnglish form…
If service ispoor or the foodisrancid,thentip ischeap.
If service isgood,thentipis average.
If service isexcellentorfoodisdelicious,thentipisgenerous.
17. 17
Withthe rulesinplace,the followingplot(Figure 10) showsthe rulesrelationstothe input
valuesandoutputvalue inthe fuzzylogicsystem.
Fig. 10 - The tipping example plot map of the fuzzy system
Defuzzifyingisthe stepinwhichtakingfuzzyvalues,theyare thenturnedintocrispvalues.
Thisis an importantstepin acquiringanoutputvalue thatcan be usedinapplications.This
involvesusinganalgorithmtoproduce the output. The most accurate algorithmtouse is
the centroidmethodinwhichitcalculatesthe centre of gravityto the valuesinwhichit
wouldbe usedas the crispvalue output.
18. 18
Fig. 11 - Centroid graph to find crisp values from fuzzy values (MathWorksa. 2016)
The way that the centroidmethodworksisbyfindingthe momentsof eachindividual
sectionof the area. Fromthere the momentsare calculatedbymultiplyingthe areaof the
shape bythe distance of the centre of gravityis forthat shape fromthe origin. The final
outputisthencalculatedby usingthe followingformula.
Fig. 12 – Equation for finding the centre of gravity. (Robertson 2013b)
Althoughthismethodisthe mostaccurate,itsdownside isthe complexityinhow itfindsits
accurate outputs,andthusmakesit the mostcomputationallycostly. (Robertson2013a)
Lookingat a lessaccurate defuzzificaitonmethod,usingthe Maximamethod(Meansof
Maximum) worksby findingitscrispoutputbycalculatingthe average value of where the
outputisat itsmaximumoverarange of values.Inthiscase,membershipdegrees. Put
simply,itaddsthe membershipdegreesmaximumvaluesanddividesthembythe number
of membershipstogainthe maximavalue.
19. 19
2.7 Decision Trees
DecisionTrees are a decisionsupporttool thatmodel decisionsusingatree like graphor
model,usingvariousvaluestodefineeachdecisionsuchasconsequences,probability,
resource cost,and utility.(Scikit-Learn2014) Decisiontreesclassifydataitemsbyposing
questionsaboutthe featuresassociatedwiththe items.
Fig. 13 – Example of Decision Tree (Data Table)
Fig. 14 – Example of Decision Tree
Each questioniscontainedinanode,andeveryinternal node pointstoone childnode for
each possible answertothe questionposed. (KingsfordandSalzberg2008 pp. 1011)
Followingthisconstruction,itformsahierarchy,encodedasatree. The initial node ornodes
withoutanyincomingedgesare referredtoasroots. Nodeswithoutgoingedgesare
referredtoas internal ortestnode.All othernodesare calledleaves(Oralsoknownas
terminal ordecisionnodes).Inthe decisiontree,eachinternal nodesplitsthe instance space
intonumeroussub-spaces. (Maimon, and Rokach 2005)
In the above example (Fig. 13and 14), Usingthe data from the table,considerday1 as the
example.Startingatthe root,the questionaskedis“Whatisthe outlook?”The table notesit
to be sunny,whichtakesyouacross the leftpathto anotherdecisionnode askingthe
20. 20
question“Whatisthe humidity?”Fromthe table,itisseenashigh,so the nextpathto take
isthe leftwhichleadstothe leaf whichstatestostayinside.
2.8 Summary
In conclusion,whathascome fromthe researchhas beentotake onthe approachof usingthe OCC
model architecture fordevelopingartificial intelligence agentswill be definedintoadecisiontree for
use of creatinga functional systemimplementation. Inwhichthe use of Plutchik'swheelof
emotions,inconjunctionwithfuzzylogicwill allow forcontrastingemotionsandfuzzysetsof
membershipsinwhichthe agentscanbe in emotional stateswhere the OCCmodel will be of use in
decidinghowtoproceedbasedonthe situationandemotional reaction.
21. 21
3. Methodology
3.1 Designing the Logic
To be able tocreate the frameworkforthe system, there isthe needtobe able todefine emotional
valuesthatcan then,be designed intoaworkingfuzzylogicsysteminconjunctionwiththe OCC
architecture.Withthatin mind,the initial designingwouldbe basedontwofactors.
1) The emotionsrequiredwiththe OCCarchitecture.
2) The emotionsthatPlutchik’swheel of emotionsare intermsof fuzzylogic.
Establishedinthe wheelof emotions,the diagramworkedbyhavingcorrespondingemotionsacross
fromeach other.Withthat inmind,the approach that wastakenwas to define those twoemotions
as one emotional value,inwhichthe crispvaluestheywouldtake wouldbe from -1to 1. -1 beingthe
negative emotionsmaximumvalue,with1beingit’scorrespondingemotionsmaximumvalue and0
beingthe neutral value.Withthe same logicappliedtothe otheremotions,the resultsbecame that
there was4 emotional valuesthatcouldthenbe usedforinputvaluestocreate fuzzyinference
systemsformore emotional values.
To obtainthe valuesthatare betweentwoemotionsfromthe diagram,thiswouldbecomethe
outputvalue of the two emotionsnexttoit.Thusthe fuzzyinferencesystemwouldbecomeaninput
of twocrispemotional valuestoproduce membership valuesforeach.Inwhichthe fuzzysystem
couldthenproduce fuzzyoutputof membershipfunctionsinwhichitwouldfallonto.Finallybeing
able to produce a crispvalue outputof what the secondaryemotionwouldbe.
22. 22
Fig. 15 – Example of how inputs and outputs are taken from Plutchik's wheel
Shownabove (Fig.15) isthe conceptof usingtwoemotions,bothcomplimentingeachotheras
emotional inputsandoutputs.Withthatconcept,usingtwoemotionalinputs(eachinputbeingboth
itscontradictingemotions),theycanbe usedtofindthe secondaryemotionsthattheywouldhave
combinedineffecttomake.Withthisidea,the needof fuzzyinferencesystemshasbeencutinhalf
from8 single emotioninputsandoutputs,to4 complimentaryemotional inputs andoutputs.
In the nextthree paragraphs,the explanationprogressestoshow how the Englishif-thenstatements
wouldbe understoodintermsof howthe inputcouldbe usedto obtainthe desiredoutput.Inthis
case,due to usingtwoemotionsforan input or output,thismeansthatthere can everbe a time
where the agentcouldbe inboth of those emotional states(ie.Theycanbe ina state of sadnessor
joy,but cannotbe both ina state of sadnessandjoy.) Withthat inmind,there are three statesof
fuzzinessinwhichitmayfall under. –Emotion,neutral or+Emotion.Fromthere it’sasimple case of
usinga fuzzy matrix inwhichto showhow the outputstateswouldbe achievedwitheachinputstate
possibilityandmembershipstates.
23. 23
-SadnessJoy+ Input
-Sadness Neutral +Joy
-Disgust -Hate -Hate Neutral
-DisgustTrust+ Input Neutral -Hate Neutral Love+
+Trust Neutral Love+ Love+
From the fuzzymatrix as shownfromabove,the creationof fuzzyrulescanbe made.In thiscase
shownbelow, there are 9rulesintotal to accountfor each inputstatesandoutputstates.An
example of the Englishforthe ruleswouldbe.
If –SadnessJoy+is –Sadness and–DisgustTrust+is –Disgustthen–HateLove+is –Hate
If –SadnessJoy+isJoy+and –DisgustTrust+is Trust+ then–HateLove+ isLove+
Withthe fuzzyrule setdefined,the fuzzyinference systemcanbe created.Inwhichhavingvaluesfor
each inputbeingpassedthroughthe fuzzyinference systemwillproduce amembershipvaluesin
whichthe values wouldmosthave degreesin.Toobtaincrispvaluesfromthe membershipvalues,
defuzzificationisneededtogetthe desiredoutcome.Forthisthe use of the centroidalgorithmis
usedto produce viable crispvalues.
Fig. 16 – Fuzzy Inference system of rules for SadnessJoy & DisgustTrust = HateLove
24. 24
Fig. 17 – Fuzzy Systems Output diagram for SadnessJoy & DisgustTrust = HateLove (Centroid)
As well asthe centroidmethodbeingused,the use of the maximamethodisusedasa comparison
to see interms of developinganemotionallyreactivefuzzysystem, whichwouldbe the besttouse
interms of realismanduse of computational resources.
Fig. 18 - Fuzzy Systems Output diagram for SadnessJoy & DisgustTrust = HateLove (Maxima)
Withcrisp valuestoannotate eachof the 16 emotions,the nextstepistoestablishhow each
emotiongoesintoeachof the emotionsassignedinthe OCCmodel.Asshownpreviouslyinfig.06,
the listof emotionsneedtomake use of the emotional valuesthatthe fuzzyinference systems
produce.Breakingdowneachemotiondownbythe use of havingeitherone ortwoemotional
inputsforthe emotional outcome,the approachintohow eachemotionwouldworkwiththe
systemsare as follows:
26. 26
In the eventof usingtwoemotions,the ideawouldbe toaddthe twoemotional valuesfromthe
fuzzyinference systemsinputsandoutputsanddivide thembythe number of valuesused.Inthe
eventof an opposingvalue,itwillmake the inputforthatvalue null asif ithad no weightingtoit.
The valuesassignedtoeachemotionwouldthenessentiallybecome weighteddecisionsinwhichthe
program can thenfollowthe decisiontree andchose whichemotionitismostlikelytouse
dependingonthe situation. Thismethodmaynotbe the bestapproachas itperhapsdoesn’tgive
more accurate valuesthanproducingfuzzyinference systemsforeachemotion,howeveritisthe
more simplerandcost effective wayof maintainingasimple fuzzysystemof emotionstoproduce
diverse emotional reactions.Aswellasanyemotional conflictbeingseparateddue tothe
categorisingof typesof reactionsmeanthatinpractice witha particular situation,the systemwill
use what isthe most appropriate basedonthe projectedtype of reactiontothe situation.Suchas
reactingto an event,meansthatthe agentwouldnotbe usinga reactionbasedemotionorobject
basedemotion.Aswell asthe use of the OCC model inconjunctionwithadecisiontreearchitecture,
the emotional reactionsshouldbe more selectiveandspecific.
Establishingthatthe OCCmodel wouldbe adaptedintoadecisiontree structure,thiswouldallow
for the program to differentiate decisionsbasedoninformationithastogive the emotional reaction
bestsuitedtothe situation.
3.1 How the user interacts with the system
The ideais to runthe programas a commandpromptprogram, in whichthe displayinterface isall in
text.The user’sinteractionwiththe systemstartswithsimplyrunningthe fuzzysystemswithuser
definedinputs.Thisallowsforthe usertotest the systembyhavingcontrolledinputsandgetting
fixedoutcomes.Afterthe fuzzysystemshave beenran,the user maytestto see whatwouldbe the
outcome emotionwhenchoosingwhatexactlythe AIisreactingtothroughthe choicesthroughthe
decisiontree foremotionalchoices.
An example of thiswouldbe the userinputtingthe valuesforeachof the emotional inputsforthe
fourinputsof the fuzzysystems.Once thatisdone,the userhasthe choice of whatpath to take the
emotional decisiontree.Inwhichonce the usergetsto the endof the tree,the outputwouldbe the
membershipvaluesof all the fuzzy systemsalongwiththe emotional valuesof all 22 emotions,
finallyshowingwhatthe programdecidedwasthe emotionalresponse tochoosingthe situationfor
the AI to respondto.
A secondsimulationmaybe runin whichthe userchoosesthe situationthat the AIis to respondto.
Afterthat,the user can change the inputvaluesatreal time withpre-definedkeystoeachof the
inputs.All whileshowingreal time informationof the membershipvaluesof the fuzzysystemsand
the emotional state thatthe agent isin.This allowstoshow real time changingof the emotional
state of the agent.
Finallythe usermayrun bothsimulationswiththe fuzzy’sdefuzzificationmethodsof centroidand
maximato getdifferentcrispoutputvaluesinwhichfortestingpurposes,canbe usedtoshow the
difference indatabetweenthe twodifferentdefuzzification methodstocome to a consensusasto
whatwouldbe the most appropriate methodforthe use of an emotionallyreactiveagent.
33. 33
Test Number Emotional HighestWeight
1 FearsConfirmed
2 Disappointment
3 Relief
4 FearsConfirmed
5 Satisfaction
6 Satisfaction
7 FearsConfirmed
8 Disappointment
9 Relief
10 Relief
Fig 28. Prospect-Based (Centroid)
Test Number Emotional HighestWeight
1 Joy
2 Distress
3 Joy
4 Joy
5 Joy
6 Distress
7 Joy
8 Distress
9 Joy
10 Joy
Fig 29. Well-Being (Centroid)
Test Number Emotional HighestWeight
1 Anger
2 Gratitude
3 Anger
4 Gratitude
5 Anger
6 Anger
7 Gratitude
8 Gratitude
9 Anger
10 Gratitude
Fig 30. Well-being attribution (Centroid)
34. 34
Test Number Emotional HighestWeight
1 Reproach
2 Pride
3 Pride
4 Pride
5 Pride
6 Shame
7 Pride
8 Shame
9 Pride
10 Pride
Fig 31. Attribution (Centroid)
Test Number Emotional HighestWeight
1 Love
2 Love
3 Hate
4 Hate
5 Love
6 Hate
7 Hate
8 Love
9 Love
10 Love
Fig 32. Attraction (Centroid)
Test Number Emotional HighestWeight
1 Happy For
2 Pity
3 Gloating
4 Happy For
5 Gloating
6 Resentment
7 Resentment
8 Resentment
9 Happy For
10 Gloating
Fig 33. Consequences for other (Maxima)
35. 35
Test Number Emotional HighestWeight
1 FearsConfirmed
2 Satisfaction
3 Satisfaction
4 FearsConfirmed
5 Satisfaction
6 Disappointment
7 FearsConfirmed
8 Disappointment
9 Satisfaction
10 Satisfaction
Fig 34. Prospect-Based (Maxima)
Test Number Emotional HighestWeight
1 Joy
2 Distress
3 Joy
4 Joy
5 Joy
6 Distress
7 Joy
8 Distress
9 Joy
10 Joy
Fig 35. Well-Being (Maxima)
Test Number Emotional HighestWeight
1 Remorse
2 Gratitude
3 Gratification
4 Anger
5 Gratification
6 Remorse
7 Anger
8 Anger
9 Gratification
10 Gratitude
Fig 36. Well-being attribution (Maxima)
36. 36
Test Number Emotional HighestWeight
1 Shame
2 Pride
3 Pride
4 Reproach
5 Pride
6 Reproach
7 Reproach
8 Pride
9 Pride
10 Pride
Fig 37. Attribution (Maxima)
Test Number Emotional HighestWeight
1 Love
2 Love
3 Love
4 Love
5 Love
6 Hate
7 Love
8 Love
9 Love
10 Love
Fig 38. Attraction (Maxima)
37. 37
5. Discussion
From the testresults,there doesseemtobe adiverse choice inemotionalreactionforthe majority
of emotional choices. Figures27to 32 are the emotional testingwiththe use of the centroidmethod
for the defuzzifyingof the emotionalvalues,while figures33to 38 makesuse of the defuzzifying
methodof Maxima. In figure 27, the resultsshow thatfromthe tentestsdone,there wasa range of
emotional statesthatincluded“Happyfor”,“Gloating”and“Resentment”.Howeverthere didseem
to be a lackof an emotional reactionfor“Pity”fromthe fourchoicesof an emotional reactiontothe
fortune of others. Thisisprobablydue tothe assignedvaluestodefiningthe emotional state of
“pity”are perhapsnotcorrect in beingable toachieve itbecomingthe highestweightedemotion
fromthe choices.Figure 28 showsthe range of emotional statesof “FearsConfirmed”,
“Disappointed”,“Relief”and“Satisfaction.”Thisseemedtobe more successful inbeingable togive
a well-roundedandrangedof emotionalchoicesforprospectbasedemotions.
From figure 29, inwhichthe emotional testforwell-beingemotional states,itshowsthatthe
emotional reactionsachievedare “Joy”and“Distress”.Managingto achieve havingbothemotional
responsesforthe agent’swell-being.FromFigure 30,for emotional statesforthe well-being
attributionforagents,the emotionalstatesachievedwere “Anger”and“Gratitude”.Howeverthis
particularpart of the tree didnotgive reactionsto“gratification”and“remorse”.Thiscouldof
course be due to the chance that these twochoicesdidnotappear,but the more likely answeristhe
choicesof the emotional inputsandoutputstobe usedfromthe fuzzysystems.
Figure 31 showsthe emotional state resultsforanagent’sattribution.The emotional statesachieved
fromthe testingwere "Reproach”,“Pride”and“Shame”.Asthe same as before,itismissingthe
emotional state of “Admiration”.Finallyforfigure 32,lookingatemotional attractionforthe agent,
the testingshowsthatthe emotional statesthatwere achievedwere “Love”and“Hate”.
Figure 33 showsthe consequencesforothersemotional statesthatthe agentwouldchoose.The
emotional statesthatwere achievedwas“Happyfor”,“Pity”,“Gloating”and“Resentment”. This
testingdemonstratedthatthe decisionmakingprocesshere makesusesof all the emotional
responsesavailable. Figure 34Showsthat the testingachievedthe emotional statesof “Fears
Confirmed”,“Satisfaction”and“Disappointment”.The emotional state of “Relief”wasmissingfrom
the testresults.
Figure 35 forthe well-beingemotional decisionsshow thatthe highestweightedemotionsachieved
were “Joy”and “Distress”.Bothof whichare the onlypossible outcomesforexpressingemotional
statesfor the agentswell-being.Figure36showsthe testingforwell-beingattributionsforagents.
The statesthat theyachievedare “Remorse”,“Gratitude”,“Gratification”and“Anger”.The testing
here showsthatall the emotional statesavailable foranagent’swell-beingisachievable.
Figure 37 forthe agent’sattributionstatestestingshowsthatthe emotionsthatwere obtainedfrom
the testingdatawere “Shame”,“Pride”and“Reproach”.The testingdatadoesnothave the
emotional state of “Admiration”.Finallyfigure 38showsthe testingdata forthe attraction foran
agent.The testingshowsthatthe emotional statesthatwere achievedwere both“Love”and“Hate”.
38. 38
Comparingboththe resultsfromthe differentdefuzzifying methods,theybothseemedsuccessful at
deliveringvaryingemotional states.Fromthe testdata,itseemsclearthatthere isissuesinwhich
the emotionsare selected.Furthertweakingof the aspectsof the rulesforthe fuzzysystemsorwhat
valuesgointoeach emotioncouldimprovethe runningandselectivenessof the system.
6. Conclusions and Future Work
In conclusion,the projectwassuccessfulinprovidingasimple lookatapproachinganddeveloping
emotionallyreactiveagents.Havingagentsemotionalstatesbeingeffectedmore realisticallywith
the use of fuzzylogic,allowedforaprogressivelyanddynamicallyadjustable emotional system.With
that beingsaid,there couldhave beenimprovementstothe development.Suchashavingfuzzy
systemsforeachof the individual22 emotions,ratherthanachieving4emotional,fuzzyoutputsfor
the use of creatingemotionallyreactive agents. Anotheraspectthatcouldhave beendifferentthat
couldhave improvedthe projectwastohave had the four inputemotionsas8 separate emotions
for ease of programmingasthe use of negative valuestohave one variable equal totwoemotions,
while mayhave cutdownthe numberof variablesinuse,didputrestrictionswhentryingtospecify
the emotional weightvaluesforthe 22 emotions. Forfuture development,the researchandtesting
of the otherpossible methodsof defuzzificationcouldhelp expandonperhapswhatwouldbe the
bestfunctionfordefuzzification. Otherfuture suggestionthatcouldhelpwiththe developmentof
emotionallyreactiveagentswouldbe tosee whatpsychological modelsorconceptsof the human
psyche couldhelpfurther the developmentof life like andinteractivelystimulatingagents.