Pattern-based AI Scripting using ScriptEase


2023年12月26日发(作者:好嗨哟直播)

Pattern-basedAIScriptingusingScriptEaseMatthewMcNaughton,JamesRedford,JonathanSchaefferandDuaneSzafronDepartmentofComputingScience,UniversityofAlberta,Edmonton,Alberta,CanadaT6G2E8{mcnaught,redford,jonathan,duane}@ngrealisticartificially-intelligentcharacically,characterbe-haviorhasbeenspecifiedusingsimplefinitestatemachinesand,morerecently,anguagesarerelatively“simple”,inpartbe-causethelanguagehastoservethreeusercommunities:gamedesigners,gameprogrammers,andconsumers–iptingoftenbecomesunwieldy,giventhatpotentiallyhundreds(thousands)ofcharactersneedtobedefined,thecharactersneednon-trivialbe-haviors,pa-per,elispattern-templatebased,allowingdesigneperdescribesScriptEase’demonstratedbygeneratingcodeforBioWare’tiontobehaviors,themodelisbeingextendedtoincludeencounter,dialog,andplotpatterns.1IntroductionThecommercialgamesindustryiscurrentlyworth$ast,bettercosterprocessors,largermemories,andbettergraphicscards,ceivedneedforbettergrapmajorcomputergamescompaniesaremak-ingbigcommitmentstoartificialintelligence(AI).Thisactivityhasbeenacceleraically,theartificialintr,mberofyears,JohnLairdhasbeenadvocatingcommercialgamesasafruitfulvenueforAIresearch(AI’s“killerapplication”)[10].Computergamesaretheidealapplicationfordevelopingcharactersthatappeartohaverealistic,artifisalreadyaneedforit,sincehu-mangameplayersaredissatisfiractersareshallow,tooeasytopredict,and,alltoooften,exhibitartifisledtrentstateoftheartindevelopingartifikofsophisticationisduetothelackofresearcheffort[1](Laird’sgroupAI'2003 - The Sixteenth Canadian Conference on Artificial Intelligence,Halifax, June 2003.

beinganotableexception).Thisischanging,asmoreresearchersrecognificialintelligenceallowsustocreatesimulatedenvironmentnimmediateapplicationofthistechnologyisgames,thetechnologyhaswiderapplications(forexample,training[8]).Asafirststep,teofthearthaseachcharacterscripted,usuallyusingarule-basedsystemorafinitestatemachine[11].Inbothcases,behaviorpatternsarelimited,repetitive,rast,human-levelbehaviorshouldnotbeprescribed,shouldavoidrepetition,gningamoreambitious,morerobustsystemfordefiningbehaviors,manyissuesmustbeconsidered:–anbehundreds–eventhousands–ofcharac-tersinagame,eachwitha(possiblycomplex)sinformationhastobeorganizedtosimplifymaintenanceissues.–temmustsimplifythetaskofdefiningcharactersandtheirbehavior(especiallyimportantforgamedesigners).–-icallyonewantstoquicklycreatethedesiredfunctionality,andthenincrementallytuneittoimprovethequalityofplay.–criptingfacilitywillbeusedprincipallybythreeusercom-munities:gamedesigners(who,typically,havelittleprogrammingexperience),consumers(whowanttocreatetheirowncharacters,buthavevariableprogram-mingexperience),andgamedevelopers(usuallyprogrammingexperts).Thepro-grammingmodelhastobesimpleenoughtoaccommodatenon-experts,butrichenoughtoallowdeveloperstodoanythingthattheywanttodo.–finitionofAIbehaviormustbeeasytoverifyforcorrectness.–temmustsupport“intelligent”(pseudo-random)behav-iorselectionstoavoidpredictability(whileatthesametimenothurtingthetesta-bilityofthesystem).–guagemustsupportlearning–mercialgamesdomorethannon-trivialtypesoflearning.–mdemandsthatanyAIbehaviorspecificationsystemmustsupportalargeandvariedselectionofbehaviors.–temmustsupportthecreationofcomplexbehaviors,eitherindividualbehaviorsoracombinationofsimplerbehaviors.–ctAIscriptingforanon-trivialgamehasalltheproblemsofmaintainingalargeevolvingsoftwarerepository,whileincurringthechallengesofAIknowledgeacquisi-tion,maintenance,eriencewithAIscriptinglanguagescomesfromworkingwithBioWareproductsBaldur’anguagesallowthegamede-signertodefinecharacters,criptinghaslimitedcapabilities,andrequiresalotofprogrammingexpertisetounderstandwhat2

ddsmore“intelligence”tothesystem,perintroducesScriptEase,atoolfordefiec-orsaredefinedusingbehavioralpatterns–takingananalogyfromsoftwareengineering,thesearethe“designpatterns”[7]ofartifirkbuildsonourexperiencewithdesignpatternsforparallelprogramming[5].Forexample,onebehaviorpatterncouldbe“toguard”.Thedefaultwouldhaveacharacterstandguardoversomethingandnotallowanyaccesstoitwithoutafihaviorcouldbeparameterizedto,forexample,allowthegamedesignertodefinehowtoguard(standstationary;patrolaround)teaguardinvolvescreatingacharacter,assigningtheguardbehaviortoit,ionfo,aswithourparallelprogrammingtoolCO2P3S[5],thereistoolsupportfordefiningandrefirprisingtoseethatourresearchintoparal-lelcomputingtoolscanbeappliedtosomethingasseeminglyremoteasdefipisnotallthatsurprisinggiventhatthefundamentalnatureofbothapplications–definingandusingpatterns–attherearemultipleaudiencesforascriptinglanguage,rangingfromnon-programmerstoexperts(thiscanbeaseriousissueinlanguagedesign[4]).Theformerneedsa-deed,mostusersarenotprogrammers,,avisualrepresentation–onethatabstractsawaytextualprogramming–,aCO2P3S-likeapproachseemstoworkhere–parameterizedbehaviorscanbedefiperdescribesthebehavioralpatternsinScriptEase,onalpatterns,includingthoseforencounters,dialogsandplot,areonlybrieflEaseisusedtogeneratecodeforBioWare’unately,erwinterNightsscriptinglanguagedoesnotsupportfacilitiesforlearning–eisthatourworkwillinfln4discussesongoingwork,whileSection5presentstheconclusions.2UsingDesignPatternstoDesignComputerGamesConsiderthesituationwhereagamedesignerofafantasyrole-playinggamewantstoincludefouricons(objects,orinthiscase,specificallyshards),ardisguarded,butthegamedesignerwantstheguardingdonedifferentlyineachcase:3

r,ifany“enemy”creaturegetsnearthechest,thegua“enemy”movesawayfromthechestwithoutopeningit,atifa“friendly”creatureapproachesthechest,,ifafriendlycreatureremovesShard-1andtakesitaway,theguardwillcontinuetoguardthechest(nottheshard).,theguardisguardingthedoor(nottheshard)andtheguardwillcontinuetoguardthedoor,rdwillprotectthecreature(nottheshard)emycomesnear,theguardwillshoutandiftheenemytriestostealfromthecreaturebeingguardedorattacksthecreature,-atShard-4maybemovedtoanylocationbyafriendlytion,wewanttheguardsineachofthesescenariostoexhibit“natural”mple,thedesignerwantsthe“chest”guardtohaveafir,thispathshouldnotbeexactlyidenticaleachtimearound,r,r,astimegoesonwithoutanythinghappening,r,ifanycreatureisspotted,theguardshouldimmediatelyreturntotheshardandnotwanderfarforawhile(untiltheguardbecomesboredagain).Itwouldtakeconsiderableefforttoprogramthebehaviorsoftmple,wehaveman-uallyprogrammedthesefourbehaviorsintheNeverwinterNightsscriptinglanguageandthereare500linesofcode(over1,000ifyouincludewhitespaceandcomments).However,ldbeabletoabstractthiscommonalityanduseservationhasalreadybnpatternisamechanismforencapsfinition,adesignpatternisadesghdesignpatternshavebeenusedinarchitecture[2],theyhavealsobecomeanimportanttoolinsoftwaredevelopment[7].Themostcommonformofadesignpatternisadocument,rmpreservestheinstructionalnatureofpatterns,nsprovideacommondesign4

lexicon,andcommuontextofrole-playingfantasygames,mple,thenotionof“wizard”or“shop-keeper”eryrecently,designpattereseveralreasonswhydesitfundamentalreasonisthatdesignpatternsdescribeasetofsolutionstoafamilyofrelateddesignproblemsanditisdifficulttogeneuatemechanismexistsforadevelopertounderstandthevariationsincodedimportantreasonisthatitisdiffimitsthenumberofdesignpatternsthatcanbeithasmallselectionofrigidgenerativedesignpatterns,end-userscreatedanewapproachtogenerativedesignpatternsthatsolvesthesedifficultproblemsandhaveembodiedourapproachintoolscalledCO2P3S(CorrectObject-OrientedPattern-basedParallelProgrammingSystem)andMetaCO2P3S(andtheirnewersequentialcounterparts).Thefirsttoolgeneratescodeforawidevarietyofpatternsthatexistinthedomainoondtoolroachsolvestheadaptationproblembyparam-eterizingeachdesignpatternwithafigrammerprovidesapplicationdomain-specifiontextofcomputergamedesign,theuseofgenerativedesignpatternshassixpositiveeffects:rncanbeidentified,designedandimplementedonceandthencanbeinstantiatedmanydifferenttimesepatterncanprovsignerscandiscussanddesigngamecomponentsatahigherlevelofabstractionbydiscussingthedesignofnewpattesedesignerhasanideaforanovelnewgameconstruct,dofhavingaprogrammercodethenewconstructfromscratch,anexistingpatterncanbeadaptedtogeneratecodethatimplementsaconstructthatissimilartothenewidea,andthiscodecanbemodifiatternhasbeentested,thepatterninstancesthataregeneratedfromitwillneedlessqualityassurancetimeduringgametesting.5

Inthespecializeddomainofrole-playingcomputergames,wehaveidentifiedsev-eralkindsofgenerativedesignpatternsthatcanbeusedbygamedesignerswithlittleornoprogrammingexperience:behavior,encounter,dialog,paper,wewillfocusonbehaviorpatterns,ecifimple,theguardbehaviorpatterndefinestworoles:mple,wewillusefourdifferentinstantiationsoftheantiateapattern,eachroleisfilledbyanindividualgameobject,whoissaidtoplaytherole(inthemoviesense,nottheprogramminglanguagessense).Forexample,inthefirstscenario,aparticularOrc(amonster)hirdscenario,aparticularfightememapaper,wewilluseasimpleontologyconsistingofactors(animategameobjectsthatcanperformactions)andprops(inanimategameobjectsthatcanbema-nipulatedbutcannotperformactions).Propscanbefurthersub-classifiedascontainers(thatcanholdotherprops)andsimpleprops(thatcannotholdotherprops).mple,intheGuardPattern,theguardrolemustbeplayedbyanactor,herolesofeachbehavioralpar(notaprop)mustalwaysplaytheprincipalroleofaorthatiscthegoalofabehhattheprincipalisboundtoabehavioralpatternsincionsofabehavioralpattern’sprnbedonely,complexschemesforallowinganactortochooseaprincipalroleamongstseveralbehavioralpatternshavebeenproposedintheliterature[6].However,itisnotclearthattheywillbeeasytouseincaseswheretheactiontakenbythecharacterissignifighanactormaybecastinonlyoneprincipalroleatanygiventime,mple,iftheprincipal(guardrole)ofaGuardPatternthatisguardingsomething(chest,door,indi-vidual,shard,etc.)isitselfbeingguardedbythreeothercreatures,ther,ehavioralpatternhasasituationlistparameterthatdescribesallofthepossiblebasicsituationsthatcomprisethebehavioral6

mple,inscenario1,onesituationis:ifanenemycomesnearthechestandtheguardiscur-rentlypatrolling,dsituationis:ral,ercommonparametertypesarelabelsthatrefertospecificgample,theGuardPatternhasalistofpatrols,whereeacanti-ationtime,se,castingtherolesofapatterntospecificobjectsisaspecialcasextsection,weprovideanexampleofpatterns,patternparameters,andtheinstantiationofpattternsareusedasparametersinotherpatternsthereissometimesaneedtmple,theguardintheGuardPatternandthepatrollerinthePatrolPatternthatisattachedtoit,implestcase,theprincipalroleoftwopattheonlysilowedsincetheattachedbehaviorsareconsideredascomponentsofthebehaviortheyareattachedto.3DesigningCharacters:AScriptEaseWalkThroughConsideranexampleoftheGuardPattern,describedasscenario1(Shard-1)aultbehavior,enemyapproachesthechest,theguardyellsawarning,runsovertothechest,eenemymovesawayfromthechest,nemyignorestheguard’swarningandopensthechest,1describesdevelopedatoolcalledScriptEasethatallowsthisinstanceandmanyrinputismenudriven,rneverdoesprogrammingintheconventionalsensesand,indeed,uationspanelontheleftsideofFigure2containsalistofallthesituationsthathavebeendefinewsituationhasbeencreated,itappearsonditionisadded,tionre2,thefirst7

PatternTypeInstanceNameGuardTagGuardedObjectTagFriendIdentifier:::::GuardPatternChestGuardchest_guardchestguard1_friendAttachedPatrolPatterns:ceName:ceName:ChestPostSituationList:NameConditionsActionsNameConditions:SpawnSituation:Theguardiscreated:Settheguard’spatrolto"RoomPatrol":WarningSituation:rdiscurrentlyusingpatrol"RoomPatrol".:Theguardyells"Hey!Getawayfromthere."Settheguard’spatrolto"ChestPost".:ContinuePatrolSituation:rdiscurrentlyusingpatrol"ChestPost".:Settheguard’spatrolto"RoomPatrol":AttackSituation:Anenemycreatureopenstheguardedchest:Theguardsays"Iwarnedyou!".stGuardinstanceoftheGuardPattern8

ganinstanceoftheGuardametersarhepatrolsthatareattachedtoaGua“RoomPatrol”fromFigure2isaninstanceofaWay-pointPatrolPattern,whichmeansthepatrolisdefi“ChestPost”isaninstanceofaPostPatrolPattern,berofpatrolscanbeattachedtoaguard,saconditiontotestwhichpatrolaguardiscurrentlyusing,lofthepatrolsandsituationshavebeenspecified,codecanbegeneratedbyclickingthe“Generate”rmayfurthercus-9

ioneditingusingScriptEasePatternTypeInstanceNamerorolinstancesattachedtotheGuardPatterntomizethesituationsusingtheSituationEditortoolofScriptEase,y,theNeverwinterNightsscthatthecodeisselfdocumenting,enablingtheusertoeasilyfindwhichportionsofcodecorrespondwiththesituationsspecifiveryusefuliftheuserdesirestofialsoidentifidofdescribingthebehav-iorsofaprincipleactor,anencounterpatterndefitance,inBaldur’sGateII,thereisaninterestingencounterintheShadeLord’sapedestalwithanicon,calledtheSunStone,articulartypeofmonster,calledaShadow,enterstheringoflights,itiskilledinaspectacularflunStoneisremovedfromthepedestal,theringoflightsdisadefitternhas3roles:anicon,acontainer,nisapropthatcanbeplacedintothecontainer’imeter10

interNightsguardingscenario(usingtheIcon-PerimeterPattern)Easecodegeneration11

PatternTypeIconContainerPerimeter::::Icon-ContainerSunStonePedestalRingofLightsSituationList:ImplicitCondition:TheSunStoneisaddedtothePedestalOtherConditions:NoneActions:ActivatetheringoflightsImplicitCondition:TheSunStoneisremovedthePedestalOtherConditions:NoneActions:DeactivatetheringoflightsImplicitCondition:onditions:TheenteringcreatureisaShadowActions:itCondition:onditions:NoneActions:anceofthetterninvolvesfoursituations:addingtheicontothecontainer,removingtheiconfromthecontainer,anactorenterstheperimeterwhiletheiconisinthecontainer,ofthesesituations,rcanaddmoreconditionstothelist,anddefineactionstoexecutewhentheconditionsaresatisfiidentifiedmultipleinstancesofthispatternintheShadeLordtemplealone,demonstratingthatthispatternisusefulintermsofabstraction,adaptation,notyetcreatedaninterfacespecifictothisparticularpattern,however,allofthesituationsdefiEaslisespeciallyappreciatedbythegamedesigners,whoprefertoworkintermsofthestoryandcharacters,lisevolving,,theprojectisexpandingatapacethatisdiffiediategoalistogiveScriptEasethefunctioisrequires12

addingafewmorepatterns(research)andalotmorescenarios(datainput).ustryneedsatoolthatproperlyde-finesacompletegamescript,scriptmustincludeinformationoneachscene,includingthephysicalarrangementofthescene,thecharactersthatarepresent,howthecharactersinteract,thedialogs,finingthesecomponentsinisolationofeachother(asiscurrentlydoneincommercialgames)(butnotall)rthegamutofissuesingamedesign,aScriptEase-liketoolneedsothercomponents,ideasforhowtointegratethesepatternsintoScriptEase,cedingdescriptionofScriptEasedescribedscriptedbehavior,whereeachcharacter’sbehaviorwaspredictable,-alityistunately,compatibilitywithexistingscriptinglanguages(suchasthatinNeverwinterNights)makethisdiffictourworktoeven-tuallyleadustothedesignofanewscriptinglanguage,onethatsupportscoreAIfunctionality(suchaslearning)tly,machinelearningplaysalimitedroleinthecommercialgamesindustry.”[Learning]takesplaceaspartofthegamedevelopmentcycle,neverafterthegameships”[9].Thereasonforthisisthattheprogramdevelopershavenocontroloverhowalearninggameevolves;r,cessofgameslikeTheSimsandBlackandWhitehavedemonstratedthepower(andcommercialappeal)ueoftestabilityofalearningalgorithmbeforetheproductshipsisofparamountimportancetothegamesindustry[3].Therearenoguaranteeswithanylearningalgo-rithm,sincetheuser(gameplayer)candnscanbetestedindividuallyandverifingontopofverifiedpatternsallowsonetocreatecompositepatternsthatcanhaveguaranteesofcorrectness.5ConclusionsThispaperdiscussedoneaspectofScriptEase–earchanddevelopmenteffortsconcentratedonthisaspectofourvisionforthesimheenormouseffortthatgoesintodefiningbehaviorsinacomplexgamelikeNeverwinterNights,any13

tool(suchasScriptEase)thatcancanreducethiseffortmercialgandforrealism,high-performance,ldarguethatthisindustryisoneofthebiggestreceptorsforAItechnology,rewonderfulopportunitieshereforground-breakinginnovativeresearch.6AcknowledgmentsFinancialsupportwasprovidedbytheInstituteforRoboticsandIntelligentSystems(IRIS),theNaturalSciencesandEngineeringResearchCouncilofCanada(NSERC),andAlberta’sInformaticsCircleofResearchExcellence(iCORE).veloper,pages55–56,der,wa,UniversityPress,NewYork,gofundefi,editor,AIGameProgrammingWisdom,pages615–sRiver,,editor,AIGameProgrammingWisdom,pages548–sRiver,ng,n,fer,ald,elComputing,activities:Implementingwittgenstein,:///features/20020424/evans_,,n,nWesley,,,tionalConference,pages886–893,2001AIroundtablemoderator’sreport,://-levelAI’skillerapplication:tionalConference,pages1171–1178,,editor,AIGameProgrammingWisdom,pages3–sRiver,2002.14


本文发布于:2024-09-22 19:40:28,感谢您对本站的认可!

本文链接:https://www.17tex.com/fanyi/34834.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:直播   作者
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议