SlideShare una empresa de Scribd logo
1 de 40
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
-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
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:
25
EventBasedEmotions
Joy Joy+
Distress -Sadness
Happy-For Submission+&Joy+
Pity Submission+&-Sadness
Gloating -Contempt&Joy+
Resentment -Contempt&-Sadness
Hope -Anticipation&Joy+
Fear -Anticipation&-Sadness
Satisfaction Awe+
Fears-Confirmed -Aggresion
Relief Surprise+& Joy+
Disappointment Surprise+& -Sadness
ReactionBasedEmotions
Pride Optimism+&Joy+
Shame -Disapproval & -Sadness
Admiration Optimism+&Joy+
Reproach -Contempt&-Disapproval
Gratification Submission+&Optimism+
Remorse -Disapproval
Gratitude Optimism+
Anger Anger+
Object-basedEmotions
Love Love+
Hate -Hate
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.
27
4. Results
The followingresultsstartwith firstlyshowingtestvariablesforshowingthe fuzzysystemsare
handlingthe valuesandgettingthe rightoutput.Inwhichitfollowstoshow all fuzzyinference
systemsoutputswithrandomvariablesforall 4of the inputs.Fromthere,the 22 emotional states
gettheirweightedvalues.Finallyatesttoshow whathighestweightedemotionisforeachendof
the decisiontree paths. The firsttwotablesforthe emotional fuzzyengines(Figures19and 20) has a
listof basic teststo showthe rulesat workand theiroutput,while the lasttentestsare random
values.The followingtwofigures(Figure 21and 22) are the testingusingrandomvaluestoallow for
a more diverse testingpool.
Test
No.
-SadneesJoy+
Input Values
-DisgustTrust+
Input Values
-HateLove+
Mem.Values
(Centroid)
-HateLove+
Mem.Values
(Maxima)
1 0 0 Negligible 0
2 1 0 0.673 1
3 0 1 0.673 1
4 1 1 0.673 1
5 -1 0 -0.673 -1
6 0 -1 -0.673 -1
7 1 -1 Negligible 0
8 -1 1 Negligible 0
9 -1 -1 -0.673 -1
10 0.5 0 0.124 0.25
11 0 0.5 0.124 0.25
12 -0.5 0 -0.124 -0.25
13 0 -0.5 -0.124 -0.25
14 0.5 0.5 0.124 0.25
15 -0.5 -0.5 -0.124 -0.25
16 0.5 -0.5 Negligible 0
17 -0.5 0.5 Negligible 0
18 1 0.5 0.616 0.75
19 0.5 1 0.616 0.75
20 -0.5 -1 -0.616 -0.75
21 -0.5 1 0.124 0.25
22 0.5 -1 -0.124 -0.25
23 -1 -0.5 -0.616 -0.75
24 -1 0.5 -0.124 -0.25
25 1 -0.5 0.124 0.25
28
26
27
Random
NumbersTest
Random
NumbersTest
01 0.25 0.5 0.0124 0.25
02 -0.06 0.19 0.0167 0
03 0.73 -0.22 -0.24 0.87
04 0.57 -0.87 -0.0804 0
05 0.54 0.56 0.15 0.77
06 -0.01 -0.9 -0.484 -0.95
07 0.29 -0.17 -0.0262 0
08 -0.38 0.5 0.0443 0.25
09 0.84 -0.35 0.196 0.83
10 0.24 0.27 0.0372 0
Fig 19. Hate to Love Fuzzy System
Test
No.
-DisgustTrust+
Input Values
-FearAnger+
Input Values
-ContemptSubmission+
Mem.Values(Centroid)
-ContemptSubmission+
Mem.Values(Maxima)
1 0 0 Negligible 0
2 1 0 0.673 1
3 0 1 0.673 1
4 1 1 0.673 1
5 -1 0 -0.673 -1
6 0 -1 -0.673 -1
7 1 -1 Negligible 0
8 -1 1 Negligible 0
9 -1 -1 -0.673 -1
10 0.5 0 0.124 0.25
11 0 0.5 0.124 0.25
12 -0.5 0 -0.124 -0.25
13 0 -0.5 -0.124 -0.25
14 0.5 0.5 0.124 0.25
15 -0.5 -0.5 -0.124 -0.25
16 0.5 -0.5 Negligible 0
17 -0.5 0.5 Negligible 0
18 1 0.5 0.616 0.75
19 0.5 1 0.616 0.75
20 -0.5 -1 -0.616 -0.75
21 -0.5 1 0.124 0.25
22 0.5 -1 -0.124 -0.25
23 -1 -0.5 -0.616 -0.75
24 -1 0.5 -0.124 -0.25
29
25 1 -0.5 0.124 0.25
26
27
Random
NumbersTest
Random
Numbers
Test
01 0.5 0.28 0.124 0.25
02 0.19 -0.41 -0.0616 0
03 -0.22 0.9 0.32 0.89
04 -0.87 -0.43 -0.374 -0.79
05 0.56 0.76 0.255 0.78
06 -0.9 0.95 0.00407 -0.01
07 -0.17 -0.71 -0.264 -0.86
08 0.5 -0.91 -0.118 -0.25
09 -0.35 0.89 -0.427 0.83
10 0.27 0.56 -0.11 0.78
Fig. 20 Contempt to Submission Fuzzy System
Test
No.
-FearAnger+
Input Values
-AnticipationSurprise+
Input Values
-AggresionAwe+
Mem.Values(Centroid)
-AggresionAwe+
Mem.Values
(Maxima)
Random
Numbers
Test
RandomNumbersTest
01 0.28 -0.83 -0.247 -0.86
02 -0.41 0.83 0.154 0.8
03 0.9 0.99 0.647 0.95
04 -0.43 -0.98 -0.577 -0.79
05 0.76 0.06 0.311 0.88
06 0.95 -0.63 0.0662 0
07 -0.71 0.06 -0.26 -0.86
08 -0.91 0.86 -0.00589 -0.01
09 0.89 -0.36 0.199 0.82
10 0.56 0.96 0.528 0.78
Fig 21. Aggression to Awe Fuzzy System
30
Test
No.
-AnticipationSurprise+
Input Values
-SadnessJoy+
Input Values
-DisapprovalOptimism+
Mem.Values(Centroid)
- DisapprovalOptimism+
Mem.Values(Maxima)
RandomNumbersTest Random
NumbersTest
01 -0.83 0.25 -0.274 -0.88
02 0.83 -0.06 0.383 0.92
03 0.99 0.73 0.629 0.87
04 -0.98 0.57 0.577 0
05 0.06 0.54 0.145 0.77
06 -0.63 -0.01 -0.202 -0.82
07 0.06 0.29 0.0426 0
08 0.86 -0.38 0.179 0.81
09 -0.36 0.84 0.189 0.82
10 0.96 0.24 0.569 0.88
Fig 22. Disapproval to Optimism Fuzzy System
Test No. -HateLove+ -ContemptSubmission+ -AggressionAwe+ -DisapprovalOptimism+
01 0.0.124 0.124 -0.247 -0.274
02 0.0167 -0.0616 0.154 0.383
03 -0.24 0.32 0.647 0.629
04 -0.0804 -0.374 -0.577 0.577
05 0.15 0.255 0.311 0.145
06 -0.484 0.00407 0.0662 -0.202
07 -0.0262 -0.264 -0.26 0.0426
08 0.0443 -0.118 -0.00589 0.179
09 0.196 -0.427 0.199 0.189
10 0.0372 -0.11 0.528 0.569
Fig 23. Fuzzy values from use of Centroid
31
Test No. -HateLove+ -ContemptSubmission+ -AggressionAwe+ -DisapprovalOptimism+
01 0.25 0.25 -0.86 -0.88
02 0 0 0.8 0.92
03 0.87 0.89 0.95 0.87
04 0 -0.79 -0.79 0
05 0.77 0.78 0.88 0.77
06 -0.95 -0.01 0 -0.82
07 0 -0.86 -0.86 0
08 0.25 -0.25 -0.01 0.81
09 0.83 0.83 0.82 0.82
10 0 0.78 0.78 0.88
Fig 24. Fuzzy values from use of Maxima
The table fromfigure 23 isa summaryof the valuesobtainedfromthe randomvaluesinputtedinto
the fuzzyenginesandtheiroutputvalues,inwhichwill be usedinconjunctionwiththe fuzzyinput
valuestoobtainthe variablesforeachof the 22 emotional states.
Test No -> 1 2 3 4 5 6 7 8 9 10
Joy 0.25 0 0.73 0.57 0.54 0 0.29 0 0.84 0.24
Distress 0 0.06 0 0 0 0.01 0 0.38 0 0
Happy-For 0.187 0 0.525 0.196 0.3975 0.002 0.026 0 0.207 0.065
Pity 0.062 0 0.16 0 0.112 0.007 0 0.19 0 0
Gloating 0.125 0 0.031 0.472 0.27 0.002 0.277 0.059 0.634 0.175
Resentment 0 0.608 0 0.187 0 0.005 0.132 0.249 0.214 0.055
Hope 0.54 0 0.365 0.775 0.27 0.315 0.145 0 0.6 0.12
Fear 0.415 0.03 0 0.49 0 0.32 0.3 0.19 0.18 0
Satisfaction 0 0.154 0.647 0 0.311 0.067 0 0 0.199 0.528
Fears-
Confirmed
0.247 0 0 0.577 0 0 0.26 0.006 0 0
Relief 0.125 0.415 0.86 0.285 0.3 0 0.175 0.43 0.42 0.6
Disappointment 0 0.445 0.495 0 0.03 0.005 0.03 0.62 0 0.48
Pride 0.125 0.192 0.679 0.574 0.343 0 0.166 0.089 0.515 0.405
Shame 0.137 0.03 0 0 0 0.106 0 0.19 0 0
Admiration 0.125 0.191 0.679 0.574 0.343 0 0.166 0.089 0.514 0.404
Reproach 0.168 0 0 0.187 0 0.101 0.132 0.059 0.213 0.055
Gratification 0.062 0.192 0.475 0.288 0.2 0.002 0.022 0.089 0.094 0.285
Remorse 0.274 0 0 0 0 0.202 0 0 0 0
Gratitude 0 0.383 0.629 0.577 0.145 0 0.043 0.179 0.189 0.569
Anger 0.28 0 0.9 0 0.76 0.95 0 0 0.89 0.56
Love 0.012 0.017 0 0 0.15 0 0 0.044 0.196 0.037
Hate 0 0 0.24 0.08 0 0.484 0.026 0 0 0
Fig 25. Table of Fuzzy outputs to emotional assignment (Centroid)
32
Test No -> 1 2 3 4 5 6 7 8 9 10
Relief 0.125 0.415 0.86 0.285 0.3 0 0.175 0.43 0.42 0.6
Gratitude 0 0.92 0.87 0 0.77 0 0 0.81 0.82 0.88
Anger 0 0.41 0 0.43 0 0 0.71 0.91 0 0
Satisfaction 0 0.8 0.95 0 0.88 0 0 0 0.82 0.78
Disappointment 0 0.445 0.495 0 0.03 0.005 0.03 0.62 0 0.48
Pride 0.125 0.46 0.8 0.285 0.655 0 0.145 0.405 0.83 0.56
Admiration 0.125 0.46 0.8 0.285 0.655 0 0.145 0.405 0.83 0.56
Gratification 0.125 0.46 0.88 0 0.775 0 0 0.405 0.825 0.83
Joy 0.25 0 0.73 0.57 0.54 0 0.29 0 0.84 0.24
Gloating 0.125 0 0.81 0.285 0.66 0 0.145 0 0.835 0.51
Hope 0.54 0 0.365 0.775 0.27 0.315 0.145 0 0.6 0.12
Happy-For 0.25 0 0.73 0.57 0.54 0 0.29 0 0.84 0.24
Resentment 0 0.03 0 0.395 0 0.01 0.43 0.315 0 0
Reproach 0.44 0 0 0.395 0 0.415 0.43 0.125 0 0
Love 0.25 0 0.87 0 0.77 0 0 0.25 0.83 0
Fear 0.415 0.03 0 0.49 0 0.32 0.3 0.19 0.18 0
Distress 0 0.06 0 0 0 0.01 0 0.38 0 0
Shame 0.44 0.03 0 0 0 0.415 0 0.19 0 0
Pity 0.125 0.03 0.445 0 0.39 0.005 0 0.19 0.415 0.39
Fears-
Confirmed
0.86 0 0 0.79 0 0 0.86 0.01 0 0
Hate 0 0 0 0 0 0.95 0 0 0 0
Remorse 0.88 0 0 0 0 0.82 0 0 0 0
Fig 26. Table of Fuzzy outputs to emotional assignment (Maxima)
Test Number Emotional HighestWeight
1 Happy For
2 Resentment
3 Happy For
4 Gloating
5 Happy For
6 Resentment
7 Gloating
8 Resentment
9 Gloating
10 Gloating
Fig 27. Consequences for other (Centroid)
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
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
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
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
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
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.
39
7. Appendices
Lance,B. and Marsella,S.C.,2008. The relationbetweengaze behaviorandthe attributionof
emotion:Anempirical study. IntelligentVirtualAgents.pp.1-14.
Delgado-Mata, C.Ibáñez-Martínez, J.Gómez-Caballero, F.Miguel Guillén-Hernández,O.2008.
Behavioural ReactiveAgentstoDefinePersonalityTraitsinthe Videogame Überpong.Transactions
on EdutainmentI.[online].Available from:doi: 10.1007/978-3-540-69744-2_12 [Accessed21
November2015].
Destiny.2014. [computergame].SonyPlayStation3,SonyPlayStation4,MicrosoftXbox 360,
MicrosoftXbox One.Bungie.
Grand TheftAutoIII.2001. [computergame].SonyPlayStation2.DMA Design.
Gonzalez,E.2010. [online]Avaliable from:http://code.tutsplus.com/tutorials/artificial-intelligence-
series-part-1-path-finding--active-4439[ Accessed18th March 2016]
Kingsford,C.andSalzberg,S.L.,2008. What are decisiontrees?Nature biotechnology,26(9),pp.
1011-3.
Liquisearch.2016. [online].Avaliable from:
http://www.liquisearch.com/emotion_classification/dimensional_models_of_emotion/pad_emotion
al_state_model
Millington,I.andFunge,J.,2009. Artificial intelligence forgames.CRCPress. pp.3
Millington,I.andFunge,J.,2009. Artificial intelligence forgames.CRCPress. pp.10
Millington,I.andFunge,J.,2009. Artificial intelligence forgames.CRCPress. pp.11
Maimon,O. and Rokach,L. 2005. Data miningandknowledge discoveryhandbook (2).Pp.165-192.
MathWorks. 2015. [online].Avaliablefrom:http://uk.mathworks.com/help/fuzzy/what-is-fuzzy-
logic.html [Accessed17thNovember2015].
MathWorksa. 2016. [online].Availablefrom:
http://uk.mathworks.com/help/fuzzy/examples/defuzzification-methods.html [Accessed 23rdMarch
2016]
MathWorksb.2016. [online].Avaliable from: http://uk.mathworks.com/help/fuzzy/an-introductory-
example-fuzzy-versus-nonfuzzy-logic.html[Accessed05/05/2016]
Quinlan,J.R.1986. Inductionof DecisionTrees.Machine Learning.1(1):pp.81-106.
Robertson,G.2013. RealisticAI PerceptionusingTakagi SugenoFuzzyInference.AbertayUniversity.
Scikit-Learn.2014. [online]Available from: http://scikit-learn.org/stable/modules/tree.html
[Accessed2ndMarch 2016].
Steunebrink,B.R.,2010. The Logical structureof emotions.
40
Steunebrink,B.R.,Dastani,M.and Meyer,J.J.C.,2009. The OCC model revisited.InProc.of the 4th
Workshopon EmotionandComputing.
TutorialsPoint.2016. Avaliable from:
http://www.tutorialspoint.com/artificial_intelligence/artificial_intelligence_fuzzy_logic_systems.ht
m [Accessed 25thFeburary2016]
WhatIs.2006. [online].Avaliable from:http://whatis.techtarget.com/definition/fuzzy-logic
[Accessed23rd Feburary2016].
WhatIs.2012 [online].Avaliable from: http://whatis.techtarget.com/definition/Plutchiks-Wheel-of-
Emotions [Accessed23rd
November2015]

Más contenido relacionado

Destacado

Car Game's Power Point
Car Game's Power PointCar Game's Power Point
Car Game's Power PointJake_Ward
 
Xinoe college profile
Xinoe college profileXinoe college profile
Xinoe college profilexinoe
 
Seminar vlsi @ a glance
Seminar vlsi @ a glanceSeminar vlsi @ a glance
Seminar vlsi @ a glancexinoe
 
Tattoo Middle East Company Presentation
Tattoo Middle East Company Presentation Tattoo Middle East Company Presentation
Tattoo Middle East Company Presentation Tattoo Middle East
 
World food day
World food dayWorld food day
World food dayJake_Ward
 
IOT introduction
IOT introductionIOT introduction
IOT introductionxinoe
 

Destacado (6)

Car Game's Power Point
Car Game's Power PointCar Game's Power Point
Car Game's Power Point
 
Xinoe college profile
Xinoe college profileXinoe college profile
Xinoe college profile
 
Seminar vlsi @ a glance
Seminar vlsi @ a glanceSeminar vlsi @ a glance
Seminar vlsi @ a glance
 
Tattoo Middle East Company Presentation
Tattoo Middle East Company Presentation Tattoo Middle East Company Presentation
Tattoo Middle East Company Presentation
 
World food day
World food dayWorld food day
World food day
 
IOT introduction
IOT introductionIOT introduction
IOT introduction
 

Similar a McLachlan_Mark_Dissertation

Game engineering(jiit 2013 14-cs&it)
Game engineering(jiit 2013 14-cs&it)Game engineering(jiit 2013 14-cs&it)
Game engineering(jiit 2013 14-cs&it)Rajat Bhatia
 
PSFK Future of Gaming Report
PSFK Future of Gaming Report PSFK Future of Gaming Report
PSFK Future of Gaming Report PSFK
 
Artificial Intelligence in Gaming
Artificial Intelligence in GamingArtificial Intelligence in Gaming
Artificial Intelligence in GamingAnmol Sawhney
 
Research Overview Mirjam P Eladhari August 2019
Research Overview Mirjam P Eladhari August 2019Research Overview Mirjam P Eladhari August 2019
Research Overview Mirjam P Eladhari August 2019Mirjam Eladhari
 
The role of ai in social games eladhari2011 uppsalauni
The role of ai in social games eladhari2011 uppsalauniThe role of ai in social games eladhari2011 uppsalauni
The role of ai in social games eladhari2011 uppsalauniMirjam Eladhari
 
imaginary: serious games and gamification
imaginary: serious games and gamificationimaginary: serious games and gamification
imaginary: serious games and gamificationimaginary srl
 
Imaginary October 2014
Imaginary October 2014Imaginary October 2014
Imaginary October 2014Lucia Pannese
 
Mary O'Brien's MA Capstone Project
Mary O'Brien's MA Capstone ProjectMary O'Brien's MA Capstone Project
Mary O'Brien's MA Capstone ProjectMary O'Brien
 
MarsAshton_DefiningNarrativeDevices_MAThesis
MarsAshton_DefiningNarrativeDevices_MAThesisMarsAshton_DefiningNarrativeDevices_MAThesis
MarsAshton_DefiningNarrativeDevices_MAThesisMars Ashton
 
STORYTELLING IN VIDEO GAME – Creating a narrative for management game. Hurme ...
STORYTELLING IN VIDEO GAME – Creating a narrative for management game. Hurme ...STORYTELLING IN VIDEO GAME – Creating a narrative for management game. Hurme ...
STORYTELLING IN VIDEO GAME – Creating a narrative for management game. Hurme ...eraser Juan José Calderón
 
COMPUTER GAMES VS SMARTPHONE GAMES
COMPUTER GAMES VS SMARTPHONE GAMES COMPUTER GAMES VS SMARTPHONE GAMES
COMPUTER GAMES VS SMARTPHONE GAMES ramal699
 
Emma's Games and Storytelling public lecture
Emma's Games and Storytelling public lectureEmma's Games and Storytelling public lecture
Emma's Games and Storytelling public lectureEmma Westecott
 
Situated Research Games
Situated Research GamesSituated Research Games
Situated Research Gamessharritt
 

Similar a McLachlan_Mark_Dissertation (20)

SituatedResearch-Games
SituatedResearch-GamesSituatedResearch-Games
SituatedResearch-Games
 
Thesis Documentation
Thesis DocumentationThesis Documentation
Thesis Documentation
 
Game engineering
Game engineeringGame engineering
Game engineering
 
Game engineering(jiit 2013 14-cs&it)
Game engineering(jiit 2013 14-cs&it)Game engineering(jiit 2013 14-cs&it)
Game engineering(jiit 2013 14-cs&it)
 
PSFK Future of Gaming Report
PSFK Future of Gaming Report PSFK Future of Gaming Report
PSFK Future of Gaming Report
 
Artificial Intelligence in Gaming
Artificial Intelligence in GamingArtificial Intelligence in Gaming
Artificial Intelligence in Gaming
 
R.A.W - THE GAME
R.A.W - THE GAMER.A.W - THE GAME
R.A.W - THE GAME
 
Research Overview Mirjam P Eladhari August 2019
Research Overview Mirjam P Eladhari August 2019Research Overview Mirjam P Eladhari August 2019
Research Overview Mirjam P Eladhari August 2019
 
The role of ai in social games eladhari2011 uppsalauni
The role of ai in social games eladhari2011 uppsalauniThe role of ai in social games eladhari2011 uppsalauni
The role of ai in social games eladhari2011 uppsalauni
 
imaginary: serious games and gamification
imaginary: serious games and gamificationimaginary: serious games and gamification
imaginary: serious games and gamification
 
Imaginary October 2014
Imaginary October 2014Imaginary October 2014
Imaginary October 2014
 
Mary O'Brien's MA Capstone Project
Mary O'Brien's MA Capstone ProjectMary O'Brien's MA Capstone Project
Mary O'Brien's MA Capstone Project
 
MarsAshton_DefiningNarrativeDevices_MAThesis
MarsAshton_DefiningNarrativeDevices_MAThesisMarsAshton_DefiningNarrativeDevices_MAThesis
MarsAshton_DefiningNarrativeDevices_MAThesis
 
STORYTELLING IN VIDEO GAME – Creating a narrative for management game. Hurme ...
STORYTELLING IN VIDEO GAME – Creating a narrative for management game. Hurme ...STORYTELLING IN VIDEO GAME – Creating a narrative for management game. Hurme ...
STORYTELLING IN VIDEO GAME – Creating a narrative for management game. Hurme ...
 
COMPUTER GAMES VS SMARTPHONE GAMES
COMPUTER GAMES VS SMARTPHONE GAMES COMPUTER GAMES VS SMARTPHONE GAMES
COMPUTER GAMES VS SMARTPHONE GAMES
 
10 leading gaming solution provider companies 2018
10 leading gaming solution provider companies 201810 leading gaming solution provider companies 2018
10 leading gaming solution provider companies 2018
 
Emma's Games and Storytelling public lecture
Emma's Games and Storytelling public lectureEmma's Games and Storytelling public lecture
Emma's Games and Storytelling public lecture
 
Proposal final
Proposal finalProposal final
Proposal final
 
Puzzle Game Development
Puzzle Game DevelopmentPuzzle Game Development
Puzzle Game Development
 
Situated Research Games
Situated Research GamesSituated Research Games
Situated Research Games
 

McLachlan_Mark_Dissertation

  • 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:
  • 25. 25 EventBasedEmotions Joy Joy+ Distress -Sadness Happy-For Submission+&Joy+ Pity Submission+&-Sadness Gloating -Contempt&Joy+ Resentment -Contempt&-Sadness Hope -Anticipation&Joy+ Fear -Anticipation&-Sadness Satisfaction Awe+ Fears-Confirmed -Aggresion Relief Surprise+& Joy+ Disappointment Surprise+& -Sadness ReactionBasedEmotions Pride Optimism+&Joy+ Shame -Disapproval & -Sadness Admiration Optimism+&Joy+ Reproach -Contempt&-Disapproval Gratification Submission+&Optimism+ Remorse -Disapproval Gratitude Optimism+ Anger Anger+ Object-basedEmotions Love Love+ Hate -Hate
  • 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.
  • 27. 27 4. Results The followingresultsstartwith firstlyshowingtestvariablesforshowingthe fuzzysystemsare handlingthe valuesandgettingthe rightoutput.Inwhichitfollowstoshow all fuzzyinference systemsoutputswithrandomvariablesforall 4of the inputs.Fromthere,the 22 emotional states gettheirweightedvalues.Finallyatesttoshow whathighestweightedemotionisforeachendof the decisiontree paths. The firsttwotablesforthe emotional fuzzyengines(Figures19and 20) has a listof basic teststo showthe rulesat workand theiroutput,while the lasttentestsare random values.The followingtwofigures(Figure 21and 22) are the testingusingrandomvaluestoallow for a more diverse testingpool. Test No. -SadneesJoy+ Input Values -DisgustTrust+ Input Values -HateLove+ Mem.Values (Centroid) -HateLove+ Mem.Values (Maxima) 1 0 0 Negligible 0 2 1 0 0.673 1 3 0 1 0.673 1 4 1 1 0.673 1 5 -1 0 -0.673 -1 6 0 -1 -0.673 -1 7 1 -1 Negligible 0 8 -1 1 Negligible 0 9 -1 -1 -0.673 -1 10 0.5 0 0.124 0.25 11 0 0.5 0.124 0.25 12 -0.5 0 -0.124 -0.25 13 0 -0.5 -0.124 -0.25 14 0.5 0.5 0.124 0.25 15 -0.5 -0.5 -0.124 -0.25 16 0.5 -0.5 Negligible 0 17 -0.5 0.5 Negligible 0 18 1 0.5 0.616 0.75 19 0.5 1 0.616 0.75 20 -0.5 -1 -0.616 -0.75 21 -0.5 1 0.124 0.25 22 0.5 -1 -0.124 -0.25 23 -1 -0.5 -0.616 -0.75 24 -1 0.5 -0.124 -0.25 25 1 -0.5 0.124 0.25
  • 28. 28 26 27 Random NumbersTest Random NumbersTest 01 0.25 0.5 0.0124 0.25 02 -0.06 0.19 0.0167 0 03 0.73 -0.22 -0.24 0.87 04 0.57 -0.87 -0.0804 0 05 0.54 0.56 0.15 0.77 06 -0.01 -0.9 -0.484 -0.95 07 0.29 -0.17 -0.0262 0 08 -0.38 0.5 0.0443 0.25 09 0.84 -0.35 0.196 0.83 10 0.24 0.27 0.0372 0 Fig 19. Hate to Love Fuzzy System Test No. -DisgustTrust+ Input Values -FearAnger+ Input Values -ContemptSubmission+ Mem.Values(Centroid) -ContemptSubmission+ Mem.Values(Maxima) 1 0 0 Negligible 0 2 1 0 0.673 1 3 0 1 0.673 1 4 1 1 0.673 1 5 -1 0 -0.673 -1 6 0 -1 -0.673 -1 7 1 -1 Negligible 0 8 -1 1 Negligible 0 9 -1 -1 -0.673 -1 10 0.5 0 0.124 0.25 11 0 0.5 0.124 0.25 12 -0.5 0 -0.124 -0.25 13 0 -0.5 -0.124 -0.25 14 0.5 0.5 0.124 0.25 15 -0.5 -0.5 -0.124 -0.25 16 0.5 -0.5 Negligible 0 17 -0.5 0.5 Negligible 0 18 1 0.5 0.616 0.75 19 0.5 1 0.616 0.75 20 -0.5 -1 -0.616 -0.75 21 -0.5 1 0.124 0.25 22 0.5 -1 -0.124 -0.25 23 -1 -0.5 -0.616 -0.75 24 -1 0.5 -0.124 -0.25
  • 29. 29 25 1 -0.5 0.124 0.25 26 27 Random NumbersTest Random Numbers Test 01 0.5 0.28 0.124 0.25 02 0.19 -0.41 -0.0616 0 03 -0.22 0.9 0.32 0.89 04 -0.87 -0.43 -0.374 -0.79 05 0.56 0.76 0.255 0.78 06 -0.9 0.95 0.00407 -0.01 07 -0.17 -0.71 -0.264 -0.86 08 0.5 -0.91 -0.118 -0.25 09 -0.35 0.89 -0.427 0.83 10 0.27 0.56 -0.11 0.78 Fig. 20 Contempt to Submission Fuzzy System Test No. -FearAnger+ Input Values -AnticipationSurprise+ Input Values -AggresionAwe+ Mem.Values(Centroid) -AggresionAwe+ Mem.Values (Maxima) Random Numbers Test RandomNumbersTest 01 0.28 -0.83 -0.247 -0.86 02 -0.41 0.83 0.154 0.8 03 0.9 0.99 0.647 0.95 04 -0.43 -0.98 -0.577 -0.79 05 0.76 0.06 0.311 0.88 06 0.95 -0.63 0.0662 0 07 -0.71 0.06 -0.26 -0.86 08 -0.91 0.86 -0.00589 -0.01 09 0.89 -0.36 0.199 0.82 10 0.56 0.96 0.528 0.78 Fig 21. Aggression to Awe Fuzzy System
  • 30. 30 Test No. -AnticipationSurprise+ Input Values -SadnessJoy+ Input Values -DisapprovalOptimism+ Mem.Values(Centroid) - DisapprovalOptimism+ Mem.Values(Maxima) RandomNumbersTest Random NumbersTest 01 -0.83 0.25 -0.274 -0.88 02 0.83 -0.06 0.383 0.92 03 0.99 0.73 0.629 0.87 04 -0.98 0.57 0.577 0 05 0.06 0.54 0.145 0.77 06 -0.63 -0.01 -0.202 -0.82 07 0.06 0.29 0.0426 0 08 0.86 -0.38 0.179 0.81 09 -0.36 0.84 0.189 0.82 10 0.96 0.24 0.569 0.88 Fig 22. Disapproval to Optimism Fuzzy System Test No. -HateLove+ -ContemptSubmission+ -AggressionAwe+ -DisapprovalOptimism+ 01 0.0.124 0.124 -0.247 -0.274 02 0.0167 -0.0616 0.154 0.383 03 -0.24 0.32 0.647 0.629 04 -0.0804 -0.374 -0.577 0.577 05 0.15 0.255 0.311 0.145 06 -0.484 0.00407 0.0662 -0.202 07 -0.0262 -0.264 -0.26 0.0426 08 0.0443 -0.118 -0.00589 0.179 09 0.196 -0.427 0.199 0.189 10 0.0372 -0.11 0.528 0.569 Fig 23. Fuzzy values from use of Centroid
  • 31. 31 Test No. -HateLove+ -ContemptSubmission+ -AggressionAwe+ -DisapprovalOptimism+ 01 0.25 0.25 -0.86 -0.88 02 0 0 0.8 0.92 03 0.87 0.89 0.95 0.87 04 0 -0.79 -0.79 0 05 0.77 0.78 0.88 0.77 06 -0.95 -0.01 0 -0.82 07 0 -0.86 -0.86 0 08 0.25 -0.25 -0.01 0.81 09 0.83 0.83 0.82 0.82 10 0 0.78 0.78 0.88 Fig 24. Fuzzy values from use of Maxima The table fromfigure 23 isa summaryof the valuesobtainedfromthe randomvaluesinputtedinto the fuzzyenginesandtheiroutputvalues,inwhichwill be usedinconjunctionwiththe fuzzyinput valuestoobtainthe variablesforeachof the 22 emotional states. Test No -> 1 2 3 4 5 6 7 8 9 10 Joy 0.25 0 0.73 0.57 0.54 0 0.29 0 0.84 0.24 Distress 0 0.06 0 0 0 0.01 0 0.38 0 0 Happy-For 0.187 0 0.525 0.196 0.3975 0.002 0.026 0 0.207 0.065 Pity 0.062 0 0.16 0 0.112 0.007 0 0.19 0 0 Gloating 0.125 0 0.031 0.472 0.27 0.002 0.277 0.059 0.634 0.175 Resentment 0 0.608 0 0.187 0 0.005 0.132 0.249 0.214 0.055 Hope 0.54 0 0.365 0.775 0.27 0.315 0.145 0 0.6 0.12 Fear 0.415 0.03 0 0.49 0 0.32 0.3 0.19 0.18 0 Satisfaction 0 0.154 0.647 0 0.311 0.067 0 0 0.199 0.528 Fears- Confirmed 0.247 0 0 0.577 0 0 0.26 0.006 0 0 Relief 0.125 0.415 0.86 0.285 0.3 0 0.175 0.43 0.42 0.6 Disappointment 0 0.445 0.495 0 0.03 0.005 0.03 0.62 0 0.48 Pride 0.125 0.192 0.679 0.574 0.343 0 0.166 0.089 0.515 0.405 Shame 0.137 0.03 0 0 0 0.106 0 0.19 0 0 Admiration 0.125 0.191 0.679 0.574 0.343 0 0.166 0.089 0.514 0.404 Reproach 0.168 0 0 0.187 0 0.101 0.132 0.059 0.213 0.055 Gratification 0.062 0.192 0.475 0.288 0.2 0.002 0.022 0.089 0.094 0.285 Remorse 0.274 0 0 0 0 0.202 0 0 0 0 Gratitude 0 0.383 0.629 0.577 0.145 0 0.043 0.179 0.189 0.569 Anger 0.28 0 0.9 0 0.76 0.95 0 0 0.89 0.56 Love 0.012 0.017 0 0 0.15 0 0 0.044 0.196 0.037 Hate 0 0 0.24 0.08 0 0.484 0.026 0 0 0 Fig 25. Table of Fuzzy outputs to emotional assignment (Centroid)
  • 32. 32 Test No -> 1 2 3 4 5 6 7 8 9 10 Relief 0.125 0.415 0.86 0.285 0.3 0 0.175 0.43 0.42 0.6 Gratitude 0 0.92 0.87 0 0.77 0 0 0.81 0.82 0.88 Anger 0 0.41 0 0.43 0 0 0.71 0.91 0 0 Satisfaction 0 0.8 0.95 0 0.88 0 0 0 0.82 0.78 Disappointment 0 0.445 0.495 0 0.03 0.005 0.03 0.62 0 0.48 Pride 0.125 0.46 0.8 0.285 0.655 0 0.145 0.405 0.83 0.56 Admiration 0.125 0.46 0.8 0.285 0.655 0 0.145 0.405 0.83 0.56 Gratification 0.125 0.46 0.88 0 0.775 0 0 0.405 0.825 0.83 Joy 0.25 0 0.73 0.57 0.54 0 0.29 0 0.84 0.24 Gloating 0.125 0 0.81 0.285 0.66 0 0.145 0 0.835 0.51 Hope 0.54 0 0.365 0.775 0.27 0.315 0.145 0 0.6 0.12 Happy-For 0.25 0 0.73 0.57 0.54 0 0.29 0 0.84 0.24 Resentment 0 0.03 0 0.395 0 0.01 0.43 0.315 0 0 Reproach 0.44 0 0 0.395 0 0.415 0.43 0.125 0 0 Love 0.25 0 0.87 0 0.77 0 0 0.25 0.83 0 Fear 0.415 0.03 0 0.49 0 0.32 0.3 0.19 0.18 0 Distress 0 0.06 0 0 0 0.01 0 0.38 0 0 Shame 0.44 0.03 0 0 0 0.415 0 0.19 0 0 Pity 0.125 0.03 0.445 0 0.39 0.005 0 0.19 0.415 0.39 Fears- Confirmed 0.86 0 0 0.79 0 0 0.86 0.01 0 0 Hate 0 0 0 0 0 0.95 0 0 0 0 Remorse 0.88 0 0 0 0 0.82 0 0 0 0 Fig 26. Table of Fuzzy outputs to emotional assignment (Maxima) Test Number Emotional HighestWeight 1 Happy For 2 Resentment 3 Happy For 4 Gloating 5 Happy For 6 Resentment 7 Gloating 8 Resentment 9 Gloating 10 Gloating Fig 27. Consequences for other (Centroid)
  • 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.
  • 39. 39 7. Appendices Lance,B. and Marsella,S.C.,2008. The relationbetweengaze behaviorandthe attributionof emotion:Anempirical study. IntelligentVirtualAgents.pp.1-14. Delgado-Mata, C.Ibáñez-Martínez, J.Gómez-Caballero, F.Miguel Guillén-Hernández,O.2008. Behavioural ReactiveAgentstoDefinePersonalityTraitsinthe Videogame Überpong.Transactions on EdutainmentI.[online].Available from:doi: 10.1007/978-3-540-69744-2_12 [Accessed21 November2015]. Destiny.2014. [computergame].SonyPlayStation3,SonyPlayStation4,MicrosoftXbox 360, MicrosoftXbox One.Bungie. Grand TheftAutoIII.2001. [computergame].SonyPlayStation2.DMA Design. Gonzalez,E.2010. [online]Avaliable from:http://code.tutsplus.com/tutorials/artificial-intelligence- series-part-1-path-finding--active-4439[ Accessed18th March 2016] Kingsford,C.andSalzberg,S.L.,2008. What are decisiontrees?Nature biotechnology,26(9),pp. 1011-3. Liquisearch.2016. [online].Avaliable from: http://www.liquisearch.com/emotion_classification/dimensional_models_of_emotion/pad_emotion al_state_model Millington,I.andFunge,J.,2009. Artificial intelligence forgames.CRCPress. pp.3 Millington,I.andFunge,J.,2009. Artificial intelligence forgames.CRCPress. pp.10 Millington,I.andFunge,J.,2009. Artificial intelligence forgames.CRCPress. pp.11 Maimon,O. and Rokach,L. 2005. Data miningandknowledge discoveryhandbook (2).Pp.165-192. MathWorks. 2015. [online].Avaliablefrom:http://uk.mathworks.com/help/fuzzy/what-is-fuzzy- logic.html [Accessed17thNovember2015]. MathWorksa. 2016. [online].Availablefrom: http://uk.mathworks.com/help/fuzzy/examples/defuzzification-methods.html [Accessed 23rdMarch 2016] MathWorksb.2016. [online].Avaliable from: http://uk.mathworks.com/help/fuzzy/an-introductory- example-fuzzy-versus-nonfuzzy-logic.html[Accessed05/05/2016] Quinlan,J.R.1986. Inductionof DecisionTrees.Machine Learning.1(1):pp.81-106. Robertson,G.2013. RealisticAI PerceptionusingTakagi SugenoFuzzyInference.AbertayUniversity. Scikit-Learn.2014. [online]Available from: http://scikit-learn.org/stable/modules/tree.html [Accessed2ndMarch 2016]. Steunebrink,B.R.,2010. The Logical structureof emotions.
  • 40. 40 Steunebrink,B.R.,Dastani,M.and Meyer,J.J.C.,2009. The OCC model revisited.InProc.of the 4th Workshopon EmotionandComputing. TutorialsPoint.2016. Avaliable from: http://www.tutorialspoint.com/artificial_intelligence/artificial_intelligence_fuzzy_logic_systems.ht m [Accessed 25thFeburary2016] WhatIs.2006. [online].Avaliable from:http://whatis.techtarget.com/definition/fuzzy-logic [Accessed23rd Feburary2016]. WhatIs.2012 [online].Avaliable from: http://whatis.techtarget.com/definition/Plutchiks-Wheel-of- Emotions [Accessed23rd November2015]