Você está na página 1de 15

Making the Play: Team Cooperation in Microsoft Baseball 3D

Computer Game Developers Conference 1998 Class #4106 Steve Rabin


steve@aiwis om!com Introduction "ere#s t$e situation% &ou $ave a 'reat 'ame! &ou $ave intelli'ent () c$aracters! &our () c$aracters mi'$t be fi'$tin' a war* battlin' a $or e of monsters* or even pla+in' a baseball 'ame! ,ut t$ere#s a problem! &our () c$aracters some$ow nee to cooperate wit$ eac$ ot$er in or er to reac$ a common 'oal! -$e+ act 'reat in epen entl+* but put t$em in close pro.imit+ of eac$ ot$er an +ou $ave a mess on +our $an s! -$e+ on#t see eac$ ot$er* t$e+ run into one anot$er* t$e+ uplicate tas/s* t$e+ leave tas/s unfinis$e * an ultimatel+ t$e+ act as if no one else e.ists aroun t$em! So w$at#s missin'0 &our c$aracters nee to cooperate! -$e+ nee to wor/ to'et$er* not in epen entl+! -$e+ nee to ivv+ up tas/s an fin t$e most efficient wa+ to reac$ t$eir combine 'oal! -$e onl+ wa+ to 'et t$is /in of comple. be$avior out of +our () c$aracters is to esi'n cooperation into t$eir be$avior from t$e start! 1$en +ou#re tal/in' about 2 or 3 c$aracters* t$e cooperation is eas+ an can almost be an aftert$ou'$t! ,ut if +ou#re ealin' wit$ 4 or more c$aracters* +ou will soon reali5e t$at +ou nee a cooperation strate'+ ri'$t awa+! 1$at /in s of 'ames $ave 4 or more () c$aracters t$at nee to cooperate0 (ctuall+ t$ere are more t$an +ou woul t$in/! -$e list inclu es most sports 'ames suc$ as ,as/etball* ,aseball* 6ootball* "oc/e+* an Soccer! )t also inclu es ever+ Real -ime Strate'+ 'ame out on t$e mar/et! 7uic/l+ +ou can see $ow man+ 'ames woul benefit from a 'oo cooperation sc$eme! "opefull+ t$is paper can $elp out man+ of t$e pro'rammers an esi'ners w$o eal wit$ t$ese tou'$ () problems! When Things et !gly 8a+be +ou nee some motivation for ma/in' cooperation a $i'$ priorit+ from t$e start! ) wis$ we $a because w$en cooperation brea/s own* all $ell brea/s loose! Durin' earl+ evelopment on 8icrosoft ,aseball 3D* t$e followin' t$in's actuall+ $appene % 1! -$ree fiel ers were all stan in' w$ere a fl+ ball was 'oin' to lan waitin' to catc$ it! (n t$e+ all i 9 2! -wo fiel ers coverin' first base! 3! :o fiel ers coverin' first base! 4! ;utfiel ers ban'in' into t$e outfiel wall tr+in' to follow a $ome run t$at went over t$e fence! 4! -wo fiel ers pursuin' a ball an bot$ 'ivin' up t$in/in' t$e ot$er woul 'et it! 6! ( fiel er is stan in' rea + to catc$ a fl+ ball* an t$en $e runs awa+ at t$e last secon <ust as t$e ball bounces = no one else 'oes after it! )t <ust lies on t$e fiel !

>! ( fiel er t$rows t$e ball to secon base an t$e baseman oesn#t /now $e s$oul catc$ t$e ball! (fter fl+in' t$rou'$ t$e baseman* t$e ball rolls towar t$e catc$er w$o simpl+ i'nores it! :o one 'oes after it! 8! ( fiel er catc$es t$e ball but anot$er fiel er* not /nowin' it was cau'$t* /eeps c$asin' $im tr+in' to steal it awa+! 9! ;nl+ t$e s$ort stop is c$asin' t$e ball an misses it = an none of t$e outfiel ers were pa+in' attention or bac/in' up! -$e s$ort stop t$en runs all t$e wa+ to t$e outfiel wall past t$e outfiel ers an pic/s up t$e ball! 8a+ +ou never $ave to witness suc$ c$aos! 1$ile most of t$ese e.amples seem sill+ enou'$* eac$ one is a ver+ obvious problem t$at ma/es t$e 'ame loo/ li/e a 'iant piece of crap! ?ven people w$o /now not$in' about baseball start as/in' w$+ t$e fiel ers are stan in' on top of eac$ ot$er or w$+ no one is 'oin' after t$e ball! -$us t$ere is a nee for a 'oo cooperation al'orit$m = an fast! Durin' t$e evelopment of 8icrosoft ,aseball 3D we went t$rou'$ 4 ifferent cooperation al'orit$ms* eac$ of w$ic$ faile to live up to e.pectations! 6rom t$ese e.periences we learne enou'$ to mol one perfect al'orit$m usin' t$e best parts of eac$! ,elow is a iscussion of all 4 al'orit$ms inclu in' t$eir pros an cons! )t#s important to note t$at an+ of t$ese al'orit$ms coul an o wor/ in man+ vi eo 'ames! )t#s <ust a matter of fin in' t$e best tool for t$e <ob! )f a simpler al'orit$m will o a more t$an a e@uate <ob* t$en b+ all means use it Are'ar less of w$at $orrible t$in's ) mi'$t sa+ about itB! "tatic Cooperation 1ell* t$e name s$oul be a tip off t$at t$is al'orit$m isn#t 'oin' to win an+ awar s for a vance ()! )t probabl+ won#t be able to o esirable t$in's li/e Ca apt to t$e current situationD ver+ well* but w$en +ou nee to s$ow pro'ress fast Ama+be to +our publis$erB* t$is is a favorite al'orit$m of man+ evelopers! -$e static part of t$e cooperation comes from t$e e.pectation t$at t$e same pla+ers will alwa+s $ave t$e same <obs! ?ver+bo + will Ccover $is own baseD an t$e $ope is t$at ever+t$in' will wor/ out ;E! )n baseball* ima'ine if t$e first baseman was t$e onl+ one w$o ever covere first base! "e will catc$ t$e ball if it comes to $im* but coverin' first base is $is sole responsibilit+ an no one else will o it! :ow if t$e t$ir baseman cau'$t t$e ball an wante to t$row it to first base* t$e first baseman woul be t$ere an it woul loo/ li/e a 'reat pla+! (ma5in'l+* about >0F of t$e $its in baseball can result in an a e@uate pla+ usin' t$is al'orit$m! 1it$ some wor/ usin' e.ceptions* per$aps 80GF of t$e $its woul loo/ all ri'$t! 6or us it was 'reat for an earl+ emo but not complete enou'$ for a final pro uct! -$is al'orit$m seems $opeless* but t$ere is a wa+ to re eem it! ,+ usin' a watc$ o' or mana'er to oversee +our () c$aracters* +ou can stop t$em from oin' stupi uncooperative t$in's! Het#s sa+ t$at none of t$e baseball pla+ers eci e to 'o after a $it ball! -$e watc$ o' entit+ woul t$en notice t$is an @uic/l+ assi'n someone to 'o after it! ?ver+ time +our mana'er saw somet$in' stupi $appenin'* $e woul interfere an set t$e () pla+ers strai'$t!

Some mi'$t call t$is a fault tolerant s+stem* but it <ust seems li/e poor planin'! )f t$e pla+ers nee someone to watc$ t$em all of t$e time an secon 'uess t$em* t$e+ <ust on#t $ave a ver+ 'oo al'orit$m for eci in' w$at to o in t$e first place! )n t$e en we foun t$at Static Cooperation <ust i n#t $ave t$e robustness we nee e for ,aseball 3D! 1e nee e our baseball pla+ers to s$ow rat$er elaborate cooperation at times in or er to 'et t$e out! (lt$ou'$ it coul $ave wor/e for us* ever+ time we patc$e a bu' +ou coul easil+ s$oot anot$er $ole in it! (fter a s$ort amount of time we reali5e t$at t$ere $a to be a better wa+! Pros: Simple an eas+ to implement! 8i'$t be more t$an a e@uate for some 'ames! Cons: Cooperation $as no ept$ an can#t a apt to man+ ifficult situations! 8i'$t nee a mana'er entit+ to /eep () pla+ers in line! 1ill often loo/ ba w$en scrutini5e ! 1ill most li/el+ loo/ ver+ ba to e.pert pla+ers! Playbook Cooperation Ila+boo/ Cooperation is t$e i ea t$at ever+ situation in +our 'ame can be loo/e up in a manual an eac$ pla+er#s <ob woul be liste ! ?ac$ pla+er woul simpl+ consult t$e pla+boo/ an fin out w$at t$e+ s$oul be oin'! -$e cooperation is in$erent in t$e list an s$oul alwa+s be perfect! &ou mi'$t t$in/ t$at t$is woul be li/e usin' a mana'er* but it isn#t because t$ere are no real Cmana'in'D ecisions to be ma e! ;nce +ou /now w$ic$ pla+ situation +ou $ave* all of t$e $ar wor/ is alrea + one! )n ,aseball 3D* t$is seeme li/e a 'oo i ea at first because t$e ori'inal spec $a pa'es an pa'es of pictures of pla+s copie from a baseball pla+boo/! (ll we woul nee to o was cop+ t$ese pla+s into co e an /now w$en to use eac$ one! ,ut w$en we loo/e at t$ese pictures* all t$e+ $a were va'ue arrows of ifferin' len't$s pointin' towar arbitrar+ locations! )t was not a 'oo si'n! 1$at was completel+ missin' from t$ese pictures was an+ $int of intentionalit+! (lt$ou'$ +ou coul probabl+ 'uess w$at eac$ pla+er was tr+in' to o b+ movin' J feet in a & irection* it seeme li/e a lous+ an re un ant wa+ to encapsulate /nowle 'e about $ow to pla+ a particular sport! 1$ile t$is ma+ $ave been enou'$ reason not to use Ila+boo/ Cooperation* t$ere was an even bi''er problem!

H6

C6 SS 2, Ii 1, R6

H6

C6 SS 2, Ii 1, R6

3,

3,

Ca Bases #mpty $ Bunt %eft

Ca Bases #mpty $ &ly Center

&igure ': #(amples of Plays from a Baseball Playbook

-$e main problem wit$ Ila+boo/ Cooperation was t$at t$ere were too man+ situations to enumerate! )f we $a up to 4 runners loose at a time in var+in' locations an a ball t$at coul be $it an+w$ere* $ow man+ situations or pla+s o we $ave000 1ell* t$ere are 16 combinations of runners between bases an 4 t+pes of $its Abunt* 'roun er* line rive* fl+ ballB wit$ conservativel+ 9 5ones in t$e fiel t$at a ball coul lan ! -$is woul result in 16.4.9K4>6 pla+s! Since t$ere are 9 fiel ers in t$e fiel * t$e complete loo/Lup table* or pla+boo/* woul $ave 4>6.9K4184 entries! 1ell* ) wasn#t 'oin' to t+pe in 4000G entries* not to mention t$e problem of fi'urin' t$em out in t$e first place! ?ven if ) coul t+pe all of t$e ata in* ) woul n#t want to be aroun w$en t$e bu's starte rollin' in! (lt$ou'$ it loo/s blea/ for Ila+boo/ Cooperation* t$ere is a prece ent t$at proves it can wor/ successfull+! (t last +ear#s CGDC t$ere was a won erful tal/ entitle C)nsi e :"H Iowerpla+ 96% 1$at are t$e+ -$in/in'0D )n t$is tal/ Davi Roberts s$are $ow $is () $oc/e+ pla+ers fi'ure out w$at to o an w$en to o it! )n fact it was $is tal/ t$at inspire me to s$are m+ own e.periences at t$is +ear#s CGDC! (fter t$in/in' about $is presentation for a w$ile* ) reali5e t$at $is () pla+ers were usin' Ila+boo/ Cooperation! "is pla+ers $a man+ ifferent scripts to c$oose from an pic/e w$ic$ one to use epen in' on t$e pla+! Mnfortunatel+* $is $oc/e+ pla+ers nee e 84 separate scripts because of all of t$e ifferent pla+s possible! "is situations were% 1$o $as t$e puc/ A4 situationsB* t+pe of pla+ A3 situationsB* $ow man+ pla+ers on t$e ice A3 situationsB* an w$ic$ position t$e () $oc/e+ pla+er is coverin' A4 situationsB! -$e total number of pla+s woul be 4.3.3.4K144* but since certain combinations on#t e.ist in $oc/e+* t$e final number was 84! (lt$ou'$ $avin' 84 scripts was a lot* t$e benefit was t$at $is () $oc/e+ pla+ers i n#t nee to irectl+ communicate wit$ eac$ ot$er in or er to cooperate! 1$en t$ere were conflicts* suc$ as too man+ or too few people 'oin' after t$e puc/* $e instea use a mana'er entit+ to prune or a pla+ers c$asin' t$e puc/! Ier$aps +ou coul sa+ t$at $e use a combination of Static an Ila+boo/ cooperation! (ctuall+* Davi Roberts eserves a lot of cre it because NHL Powerplay 96 was ver+ $i'$l+ re'ar e b+ reviewers for its ()! -$is e.ample clearl+ s$ows t$at Ila+boo/ Cooperation can be a wor/able solution wit$ 'oo results! Pros: )f +ou can list t$e situations* t$e cooperation coul be flawless! -$is al'orit$m is ver+ simple! Cons: "u'e loo/Lup tables are time consumin' for creatin' an enterin'! (lso testin' for mista/es or t+pos can ta/e a lon' time! )f +our situations or pla+s are not fine 'raine enou'$* +ou won#t 'et t$e level of cooperation +ou#re loo/in' for! )esponsibility Cooperation (fter 'ivin' up on t$e i ea of a 'iant pla+boo/* it#s time t$at our () pla+ers too/ some responsibilit+ for t$eir actions! )n t$is al'orit$m* t$e tric/ is to ma/e ever+ pla+er responsible for a certain area or <ob! )f t$e pla+er can#t fulfil t$e <ob because somet$in' more important nee s to be one* $e woul still be responsible for $is <ob* but it woul be $is responsibilit+ to ma/e sure t$at someone else too/ care of it! -$is al'orit$m woul $ave all of t$e 'oo t$in's of t$e static cooperation al'orit$m* but also $ave aban one <obs ta/en care of b+ someone else!

-$e motivation for t$is al'orit$m came from t$e followin' scenario! )n t$e baseball 'ame we sometimes wante t$e first baseman to be able to fiel t$e ball an $ave someone else cover first base! )t i n#t matter w$o woul cover t$e base* we <ust nee e someone to be t$ere in case we $a a close pla+ at first! -$is new al'orit$m starts b+ ma/in' t$e first baseman responsible for coverin' first base on ever+ pla+! )f $e eci es t$at $e nee s to fiel t$e ball* $e will pass t$e responsibilit+ of coverin' first base to someone else! Het#s sa+ t$at $e eci es to 'ive t$e responsibilit+ of coverin' first to t$e pitc$er! -o ma/e t$is interestin'* let#s $ave t$e pitc$er also bus+ 'oin' after t$e ball! Since t$e pitc$er can#t ta/e t$e <ob of coverin' first base* $e nee s to s$ift t$e responsibilit+ to +et someone else! -$e ne.t most lo'ical person to ta/e t$e <ob is t$e secon baseman! So t$e pitc$er now notifies t$e secon baseman t$at $e#s now responsible for coverin' first base! -$e secon baseman* bein' t$e 'reat pla+er t$at $e is* reco'ni5es t$at coverin' first is more important t$an $is ori'inal responsibilit+ of coverin' secon ! "e ta/es on t$e <ob of coverin' first an passes on t$e responsibilit+ of coverin' secon to t$e s$ort stop! -$e s$ort stop* $avin' not$in' better to o* ta/es t$e <ob an t$e buc/ stops t$ere! (not$er 'oo name for t$is al'orit$m mi'$t be CIass -$e ,uc/!D -$is al'orit$m seems to $ave some ama5in' @ualities! -$e above e.ample s$ows off some stunnin' teamwor/ an cooperation! So w$at are t$e flaws0 Irobabl+ t$e worst flaw is t$at t$e al'orit$m is sprea out amon' multiple pla+ers an oesn#t lie in an+ one place! Mnli/e Ila+boo/ Cooperation* +ou can#t <ust point to one spot an see w$+ it wor/s t$e wa+ it oes! Since t$e cooperation is t$e result of a series of interactions between pla+ers* t$e al'orit$m is $ar to visuali5e* $ar to ebu'* $ar to control* or er epen ant* an ver+ ifficult for an+one but t$e ori'inal pro'rammer w$o wrote it to un erstan ! )f +our pro uct $as se@uel possibilities usin' t$e same co e base* +ou mi'$t want to seriousl+ avoi t$is al'orit$m! )t#s not t$at t$is al'orit$m is so ba * but rat$er t$at an+ istribute al'orit$m becomes ver+ unstable an time consumin' to maintain! &ou#ll $ave it un er control for a wee/ or a mont$* but it will soon become too muc$ to $an le w$en +our 'ame evolves an it re'ularl+ brea/s or nee s en$ancement! Pros: Can result in e.cellent cooperation an teamwor/! Doesn#t re@uire lar'e loo/Lup tables! )s ver+ +namic an a apts to t$e current situation! Cons: "ar to visuali5e* $ar to ebu'* $ar to control* an $ar to maintain! *utonomous Cooperation ) $ave to a mit t$at we never trie to implement t$is cooperation al'orit$m* but it came up several times w$en brainstormin' about $ow to solve certain problems! -$e strate'+ of t$is al'orit$m is for eac$ () pla+er to in epen entl+ come to a conclusion about w$at $e nee s to o b+ observin' t$e worl aroun $im! -$e motivation for t$is comes from tr+in' to simulate t$e unspo/en cooperation t$at actuall+ $appens between real people! )n a baseball 'ame* t$e fiel ers /now t$eir responsibilities an t$e+ are able to constantl+ watc$ $ow events unfol an a <ust accor in'l+! )f t$e first baseman s$oul attempt to fiel t$e ball* t$e pitc$er will notice t$is an reco'ni5e t$at $e s$oul 'o cover first base because t$e first baseman won#t be able to! -$is woul be (utonomous Cooperation!

1$ile t$e intentions of t$is al'orit$m are $onorable* t$e conse@uence of simulatin' $ow $umans ma/e ecisions base on observation is an overw$elmin'l+ comple. tas/! ?ac$ () pla+er woul nee /nowle 'e about w$at $e s$oul normall+ be oin' an ever+ etail about t$e worl $e s$oul monitor in or er to switc$ tas/s! -$e () pla+er also nee s to constantl+ secon L'uess $imself in or er not to step on an+one#s toes an to alwa+s be oin' t$e most important <ob $e can o! &et $e also s$oul n#t loo/ sc$i5op$renic b+ to''lin' too man+ times between ifferent <obs! &ou coul also $ave a problem wit$ s+nc$roni5ation if two pla+ers tr+ to o t$e same <ob at once! -$eoreticall+ t$e+ coul to''le forever w$en t$e+ woul eac$ reali5e t$at someone else is oin' t$e <ob an t$en bot$ 'ive up* but t$en bot$ tr+ to cover it a'ain* but t$en bot$ 'ive up an so on! (lt$ou'$ t$is al'orit$m woul be of interest to researc$ers in t$e fiel of ()* ) believe it <ust isn#t wort$ t$e effort for most vi eo 'ames! )t#s a serious un erta/in' t$at coul result in mont$s wort$ of effort in or er to ma/e it robust! 1$at we reall+ care about is t$e resultin' be$avior an not t$e means b+ w$ic$ t$e be$avior was eci e ! )f usin' t$is al'orit$m results in muc$ better cooperation* t$en it mi'$t be wort$ it* but common sense sa+s t$at we coul probabl+ esi'n a more t$an a e@uate cooperation sc$eme usin' a fraction of t$e time an effort! Pros: Simulates real $uman ecision ma/in' an unspo/en cooperation! Coul result in 'oo cooperation if enou'$ etail was inclu e ! Cons: Ner+ time intensive to esi'n an co e! Irobabl+ not wort$ t$e time w$en t$ere are so man+ alternatives! 1ill nee constant en$ancements to become smarter an smarter! In "earch of the Perfect Cooperation *lgorithm -$e previous 4 al'orit$ms $ave been @uite iverse an covere a wi e ran'e of possible solutions to cooperation! 1e#ve 'one from a simple al'orit$m* Static Cooperation* to a ver+ comple. one* (utonomous Cooperation! 1e#ve 'one from intense communication between pla+ers* Responsibilit+ Cooperation* to no communication at all between pla+ers* Ila+boo/ or (utonomous Cooperation! 1it$ suc$ e.tremes* $opefull+ we can fin an al'orit$m somew$ere in t$e mi le t$at uses t$e best @ualities of eac$! Het#s review some of t$e lessons learne ! Static Cooperation s$owe us t$at simplicit+ is fast an eas+ to co e an 'ives us 'oo results a ma<orit+ of t$e time! "owever* it seeme to nee a mana'er entit+ in or er to /eep t$e pla+ers in line because of c$an'in' or uni@ue situations! Ila+boo/ Cooperation s$owe us t$at if we coul enumerate ever+ situation* we coul e.$austivel+ fi'ure out t$e cooperation a$ea of time in loo/ up tables! Mnfortunatel+ for Ila+boo/ Cooperation* t$e loo/ up tables were a auntin' tas/ an ver+ time intensive! Responsibilit+ Cooperation $a t$e ri'$t feel because of its +namic responsibilit+ swappin'* but it was too sprea out* ma/in' it $ar to un erstan an ebu'! (utonomous Cooperation reall+ $a t$e spirit of tra itional ()* but it was wa+ too error prone an time intensive to pro'ram! -$is al'orit$m woul ma/e a 'reat researc$ paper but a lous+ esi'n for a pro uct t$at $a a ea line! 1it$ t$ese lessons learne * ) $ave come up wit$ some re@uirements for t$e Ierfect Cooperation al'orit$m!

Perfect Cooperation *lgorithm )e+uirements: 1! -$e best person for t$e <ob alwa+s 'ets it! 2! -$ere is no uplication of <obs onl+ one person s$oul $ave! 3! "i'$er priorit+ <obs are alwa+s ta/en care of! 4! Hower prior <obs are sometimes sacrifice ! 4! -$ere is a minimal amount of loo/Lup ata! Re uces ata entr+ an t$e c$ance of errors or t+pos! 6! )t#s simple! )f it#s not simple* +ou won#t be able to fi. it w$en it brea/s! The Perfect Cooperation *lgorithm $ by "te,e )abin -$is al'orit$m was partl+ t$e result of tr+in' to fi'ure out t$e pla+er cooperation m+self! ) sat own wit$ a piece of noteboo/ paper one a+ an wrote out w$at ) woul li/e eac$ pla+er to o in a certain situation! ) t$ou'$t about a situation wit$ a runner runnin' to first base an t$e ball $it $ar between t$e first an secon basemen! 1ell* ) eci e t$at ) woul li/e t$e secon baseman an t$e ri'$t fiel er to 'o after t$e ball wit$ t$e center fiel er bac/in' t$em up! ) want t$e first baseman to cover first base* t$e s$ort stop to cover secon base an t$e t$ir baseman to cover t$ir base! -$e pitc$er s$oul bac/up first base* t$e left fiel er s$oul bac/ up secon base* an t$e catc$er s$oul cover $ome! ) ma e t$e list in t$at or er!

1! Secon ,aseman K )ntercept ,all 2! Ri'$t 6iel er K )ntercept ,all 3! Center 6iel er K ,ac/ Mp 6iel er 4! 6irst ,aseman K Cover 6irst ,ase 4! S$ort Stop K Cover Secon ,ase 6! -$ir ,aseman K Cover -$ir ,ase >! Iitc$er K ,ac/ Mp 6irst ,ase 8! Heft 6iel er K ,ac/ Mp Secon ,ase 9! Catc$er K Cover "ome Ilate

,oom9 ) $a cooperation = an it was simple! )t wor/e because ) first eci e w$at was important to o A6iel in' t$e ball* t$en coverin' bases* t$en bac/in' up basesB! ) t$en starte committin' pla+ers to o t$ose <obs! (s ) use up t$e fiel ers* t$e w$ole t$in' <ust fell into place! -$e /e+ is to not start wit$ t$e pla+ers but rat$er to start wit$ t$e <obs t$at nee to 'et one! )n effect ) was li/e a mana'er t$at or'ani5e t$e cooperation in a wa+ t$at was ver+ ifficult for t$e pla+ers to o b+ t$emselves!

-$e c$oice to use a mana'er to enforce cooperation was an obvious conclusion t$at was initiall+ $ar for me to accept! ) wante to believe t$at m+ () c$aracters woul be able to wor/ out t$eir problems amon'st t$emselves* but t$en ) woul be usin' Responsibilit+ or (utonomous Cooperation! Msin' a mana'er becomes even more obvious w$en +ou loo/ at a connectivit+ c$art of $ow +our pla+ers woul communicate! -$e mana'er option pops out as t$e most reasonable c$oice!

Indi,idual Communication

Manager Communication

-o Communication

&igure .: Connecti,ity Chart of Player Communication

Remember t$ose pla+boo/ ia'rams0 ?ac$ one of t$ose pla+ers wit$ a irection arrow were tr+in' to accomplis$ somet$in'! -$e+ were eit$er fiel in' t$e ball* bac/in' up a catc$* coverin' a base* bac/in' up a base* or 'ettin' in a rela+ position! -$e Ierfect Cooperation al'orit$m ta/es all of t$ose pla+s an boils t$em own into w$at#s actuall+ important! -$e tric/ is to i entif+ w$at are t$e important <obs in a certain situation an ma/e sure t$ere are people oin' t$em! ;nce +ou un erstan t$e motivation of +our pla+ers* +ou can encapsulate t$at /nowle 'e ver+ easil+! Making it Work :ow t$at +ou un erstan t$e i ea be$in t$e Ierfect Cooperation al'orit$m* we <ust nee a wa+ to appl+ it! -$e first step is to create a mana'er entit+ in +our 'ame! &our mana'er will be in c$ar'e of eci in' w$o 'ets w$ic$ <ob an at w$at point to reassi'n <obs! Remember m+ sample situation of a runner 'oin' to first base an t$e ball $it $ar between first an secon 0 -$at was a particular situation! 1$en +ou $ave t$at situation certain <obs are more important t$an ot$ers are! 6or e.ample* Cover 6irst ,ase is wa+ more important t$an Cover -$ir ,ase because t$e runner is 'oin' to first base an is reall+ far awa+ from t$ir base! (lso* )nterceptin' t$e ,all is wa+ more important t$an coverin' an+ base* because wit$out t$e ball* +ou can#t 'et an+one out! -$ere are two t$in's to note from t$is e.ample! -$e first is t$at ever+ situation $as <obs t$at can be liste in a priorit+ from most important to least important! -$e secon t$in' to note is t$at t$is is one of man+ ifferent situations! Since +our 'ame will $ave man+ ifferent situations* +ou will nee a wa+ to classif+ w$ic$ situation +ou $ave at an+ 'iven time! &ou nee to i entif+ some con ition or 'roup of con itions t$at +ou can use as a /e+! -$e con itions or variables t$at +ou pic/ are crucial to +our cooperation* so 'ive a lot of t$ou'$t to t$is up front! -$e wa+ to classif+ +our situations is to t$in/ about w$at#s important to +our () pla+ers! )n t$e case of baseball* t$e location of t$e runners is t$e most important con ition! -$e t+pe of $it is also ver+ important* but onl+ for two

of t$e <obs* )ntercept ,all an ,ac/up 6iel er! -$ese two <obs are alwa+s of $i'$est importance* so t$ere is no nee to ma/e t$e situations account for t$em! 1e <ust care about <obs t$at continuall+ c$an'e importance! -$e <obs t$at continuall+ c$an'e importance are t$e coverin' of bases an bac/in' up of bases = t$ese epen on t$e runner situation! )n 8icrosoft ,aseball 3D we $a 16 situations! -$e 16 comes from $avin' combinations of up to four runners loose wit$in four ifferent basepat$s A"omeL6irst* 6irstLSecon * Secon L-$ir * an -$ir L"omeB! -$e situations are liste below% "ituation 1 2 3 4 4 6 O 16 /ome0&irst no runner RM::?R no runner RM::?R no runner RM::?R RM::?R &irst0"econd no runner no runner RM::?R RM::?R no runner no runner RM::?R "econd0Third no runner no runner no runner no runner RM::?R RM::?R RM::?R Third0/ome no runner no runner no runner no runner no runner no runner RM::?R

;ne more important t$in' to note is t$at +ou s$oul tr+ to limit +our number of situations to un er 20! Msin' less t$an 20 situations is an arbitrar+ rule* but if +ou let +our number of situations 'et too lar'e +ou will start to efeat t$e purpose of /eepin' it simple! (lso* if +ou $ave more t$an 20 situations* +ou probabl+ $aven#t narrowe own w$at is reall+ important to +our () pla+ers! &our number of situations will also be /e+ in $ow lar'e +our loo/Lup ata is* so it#s in +our best interest to /eep it un er control! :ow t$at +ou $ave +our situations* write own ever+ possible <ob t$at +ou want +our c$aracters to be able to o! &ou will still $ave to co e t$e routines t$at t$e+ will e.ecute* but t$is is <ust to eci e w$ic$ ones t$e+ $ave to pic/ from! )n baseball* t$ese routines or <obs woul be t$in's li/e CCover 1st ,aseD* C;utfiel CutoffD* or C)ntercept ,allD! ,elow is a list of ever+ <ob t$at () c$aracters can $ave in ,aseball 3D! :otice t$at <obs li/e Cta''in' t$e runnerD are not liste ! Remember t$at +ou nee to list <obs t$at t$e mana'er $as to assi'n an not micro <obs t$at can be ta/en care of wit$out t$e $elp or concern of a mana'er! %ist of 1obs in Baseball 3D )ntercept ,all* ,ac/up6iel er* Cover1st,ase* Cover2n ,ase* Cover3r ,ase* Cover"omeIlate* ;utfiel Cutoff* )nfiel Cutoff* ,ac/up1st,ase* ,ac/up2n ,ase* ,ac/up3r ,ase* ,ac/up"omeIlate ;nce +ou $ave +our list of <obs* ta/e eac$ one an list out w$ic$ of +our () c$aracters can perform t$at <ob! 6or e.ample* ever+ baseball pla+er can $ave t$e <ob C)ntercept ,allD* but onl+ a $an ful of baseball pla+ers s$oul be allowe to $ave t$e <ob CCover 3 r ,aseD! &ou woul n#t want +our Ri'$t 6iel er coverin' 3r base* so $e woul n#t be a can i ate for t$at <ob! ,elow is an abbreviate e.ample of w$at +our list mi'$t loo/ li/e at t$is point! )f +ou on#t un erstan t$e baseball abbreviations* loo/ at (ppen i. 1 for t$e /e+!

1obs 1! )ntercept ,all 2! Cover 1st ,ase 3! ,ac/up 1st ,ase

*I players that should be allo2ed to ha,e this 3ob 1,* 2,* SS* 3,* Ii* Ca* H6* C6* R6 1,* 2,* Ii 1,* 2,* Ii* Ca* R6

:ow t$at +ou $ave +our situations an <obs fi'ure out* for eac$ situation +ou nee to ran/ all <obs from most important to least important! -$is will be t$e loo/Lup ata t$at etermines w$ic$ <obs are t$e most important an must 'et one in an+ 'iven situation! -$e amount of loo/Lup ata will be +our number of situations times +our number of <obs! Het#s ta/e t$e e.ample of situation 2 up above! )n t$at situation t$ere is onl+ one runner w$o is between $ome an first base! Iuttin' on our baseball cap* let#s tr+ to t$in/ of w$at important <obs s$oul be ta/en care of! 1ell* ) t$in/ fiel in' t$e ball is t$e top priorit+! 1e $ave to 'et t$e ball in or er to ma/e a pla+! (n <ust in case* bac/in' up t$at catc$ s$oul be t$e ne.t priorit+ because $e coul miss! -$e t$ir most important <ob is coverin' first base! 1e reall+ nee someone at first base so t$at once we 'et t$e ball we can t$row it to $im! :ow if t$e ball is $ar to 'et* t$e pla+ mi'$t be at secon base* so t$at s$oul be t$e ne.t priorit+! (s +ou can see* t$e 'oal is to ta/e all of +our <obs an arran'e t$em in t$e best or er for eac$ situation! )n our e.ample* our runner will probabl+ not 'et to $ome plate* so coverin' $ome s$oul be lower on t$e list! )n fact* bac/in' up $ome s$oul be reall+ low on t$e list! ,elow is t$e finis$e prioriti5e list for situation 2! :ote t$at t$e list or er is from $i'$est priorit+ to lowest priorit+! "ituation 4. Prioriti5ed %ist of 1obs: )ntercept,all* ,ac/up6iel er* Cover1st,ase* Cover2n ,ase* Cover3r ,ase* ;utfiel Cutoff* ,ac/up1st,ase* ,ac/up2n ,ase* )nfiel Cutoff* ,ac/up3r ,ase* Cover"omeIlate* ,ac/up"omeIlate (t t$is point we#ve now boile own all of t$e cooperation into a $an ful of loo/Lup tables! ,ut t$ere is an important step t$at still nee s to be fi'ure out! -$e step is to esi'n an al'orit$m t$at can c$oose w$o s$oul 'et t$e <ob from +our prune list of can i ates! 6or e.ample* t$e <ob Cover1st,ase $as t$ree can i ates% 1,* 2, an Ii! 1e nee to pic/ t$e best one usin' some /in of $euristic! ;ne option is to use a static list t$at is prioriti5e ! 1e coul sa+ t$at t$e 1, is alwa+s t$e best person* t$e pitc$er t$e ne.t best* an t$e 2, t$e last! (lt$ou'$ t$is coul wor/* t$ere are better met$o s! (not$er option in t$is case is to test at runLtime w$ic$ fiel er is closest to t$e <ob t$at $as to be one! )n t$is case it woul be t$e one t$at is closest to first base! 8ost of t$e time it will be t$e 1,* but it coul be someone else! ( runLtime al'orit$m will 'ive +ou better results because it a apts to t$e current situation! (lso it pa+s to evelop an al'orit$m t$at favors t$e person w$o is currentl+ assi'ne to t$at <ob! -$at wa+ pla+ers will not swap <obs unreasonabl+! -$e al'orit$m of usin' t$e pla+er t$at is closest to t$e <ob location favors pla+ers alrea + oin' t$at <ob! Mn oubte l+* +ou will nee to $one an al'orit$m for +our particular situation! )t is also ver+ unli/el+ t$at one al'orit$m will wor/ for all <ob t+pes! 6or e.ample* t$e <ob )ntercept ,all re@uires a ver+* ver+ 'oo al'orit$m for c$oosin' w$o is t$e best pla+er to 'et t$e ball! Some <obs <ust re@uire special customi5e al'orit$ms!

/ere is a Consolidated %ist of the "teps so far: 1! 8a/e a list of situations t$at +our pla+ers will encounter! Apreferabl+ un er 20B 2! 8a/e a list of <obs t$at +our pla+ers will nee to o! 3! 6or eac$ <ob* ma/e a list of pla+ers t$at +ou want performin' it! 4! 6or eac$ situation* ma/e a prioriti5e list of w$at <obs nee to be one! 4! 6or eac$ <ob* esi'n an al'orit$m t$at can effectivel+ c$oose t$e best pla+er to perform t$at <ob! )unning the Manager &unction :ow t$at +ou $ave all +our loo/Lup tables in place an +our selection al'orit$ms esi'ne * +ou nee to write t$e runLtime portion of t$e Ierfect Cooperation al'orit$m! -$is part is t$e mana'er t$at will ictate w$o oes w$at! )t#s $is <ob to ivv+ up t$e tas/s to all available () pla+ers! Het#s recap w$at we $ave in t$e wa+ of loo/ up tables an suc$! 1e $ave t$e worl bro/en up into rou'$l+ 20 situations! -$ese situations are easil+ reco'ni5able usin' state information about t$e worl ! 1e $ave a prioriti5e list of important <obs in eac$ situation! 1e $ave a list of pla+ers t$at can 'et eac$ t+pe of <ob! 1e $ave one or more al'orit$ms for selectin' t$e best pla+er for eac$ <ob! Msin' t$ese loo/Lup tables* we $ave a ver+ powerful an concise escription of $ow our pla+ers s$oul cooperate! (t t$is point* t$e cooperation e.ists implicitl+ wit$in t$e loo/Lup tables! 1e <ust $ave to unleas$ it onto our pla+ers! Het#s start b+ creatin' a mana'er function an namin' it RecalculatePobResponsibilities! )t will e.ecute t$e followin' al'orit$m% 1! (ssess t$e situation! A1$ic$ of t$e 20 or so situations e.ists at t$is moment in timeB 2! )nitiali5e ever+bo +#s current <ob to :MHH! 3! Hoo/ up t$e $i'$est priorit+ <ob for t$at situation! 4! Secon 'uess t$e list an eci e w$et$er t$is <ob is relevant at t$is moment in time an s$oul be fille ! -$is is necessar+ because t$e list is static an some <obs ma+ not be a 'oo i ea at t$is point in time! 4! Hoo/ up t$e can i ates for t$is <ob an e.clu e t$e ones t$at alrea + $ave <obs! 6! Msin' t$e remainin' can i ates* use t$e selection al'orit$m to etermine w$o s$oul 'et t$e <ob! >! )f someone is foun * assi'n t$e <ob to $im! ;t$erwise let t$e <ob 'o unfille ! 8! Repeat steps 4 t$rou'$ > wit$ t$e ne.t $i'$est priorit+ <ob! 9! (t t$is point* +ou#ve loope t$rou'$ all <obs an t$e best people are assi'ne to t$e $i'$est priorit+ <obs! Some pla+ers ma+ not $ave a <ob* w$ic$ is perfectl+ natural! "owever $ave a efault <ob t$at t$e+ can o so t$e+ loo/ bus+ until t$e ne.t roun of assi'nments! 10! :otif+ +our pla+ers of t$eir new <ob assi'nments! 11! 1$en t$e situation c$an'es* reassess an assi'n new <obs!

)n t$e baseball e.ample of situation #2 At$ere is one runner between $ome an firstB* below is t$e prioriti5e list of <obs an t$e result of runnin' t$e mana'er function! -$is moment of time is imme iatel+ after a $ar 'roun er was $it between t$e first an secon basemen% "ituation . Prioriti5ed list of 1obs: )ntercept,all* ,ac/up6iel er* Cover1st,ase* Cover2n ,ase* Cover3r ,ase* ;utfiel Cutoff* ,ac/up1st,ase* ,ac/up2n ,ase* )nfiel Cutoff* ,ac/up3r ,ase* Cover"omeIlate* ,ac/up"omeIlate &ielder 1, 2, SS 3, Ii Ca H6 C6 R6 *ssigned 1ob Cover1st,ase )ntercept,all Cover2n ,ase Cover3r ,ase ,ac/up1st,ase Cover"omeIlate ,ac/up2n ,ase ,ac/up6iel er )ntercept,all

6rom t$e above e.ample +ou will notice several inconsistencies t$at nee to be e.plaine ! 6irst of all* two fiel ers $ave t$e <ob )ntercept,all! -$is particular <ob is an e.ception because we nee e more t$an one fiel er to activel+ pursue t$e ball! -$is e.ception will allow as man+ pla+ers to 'et t$is <ob as t$e selection al'orit$m eems necessar+! (not$er e.ception is t$at t$e ;utfiel Cutoff an )nfiel Cutoff <obs were not assi'ne even t$ou'$ t$e+ are $i'$er on t$e priorit+ list! -$ese <obs onl+ nee to be one if t$e ball reac$es t$e outfiel * so t$e+ are not assi'ne w$en t$e ball is initiall+ $it! -$e+ were e.clu e b+ step #4 in t$e runLtime al'orit$m! 6rom t$ese two e.ceptions +ou can see t$at some <obs ma+ nee multiple people assi'ne to t$em an some <obs s$oul $ave none! &ou will nee to eci e in +our own specific cases w$ic$ <obs nee t$is /in of special casin'!

6uestions about the Perfect Cooperation *lgorithm What about all of the other things that baseball players ha,e to do like tagging runners7 thro2ing the ball7 or getting to their neutral positions8 /o2 come they aren9t 3obs in the algorithm8 ;nl+ ma<or <obs t$at re@uire t$e cooperation of t$e w$ole team are assi'ne in t$e al'orit$m! 8icro <obs li/e ta''in' a runner or t$rowin' to a base can be $an le in ivi uall+ b+ t$e fiel er wit$out t$e intervention of t$e mana'er al'orit$m! -$e purpose of t$e al'orit$m is to ma/e sure t$at t$e pla+ers are cooperatin' an not to usurp all ecisions from t$em! -$e+ still act autonomousl+ even t$ou'$ t$e+ 'et 'eneral comman s to cover a base or intercept a ball! Where do you dra2 the line bet2een 2hat 3obs the manager should assign and 2hat 3obs should be done 2ithout the kno2ledge or consent of the manager8 -$e mana'er assi'ne <obs nee to be tas/s t$at +ou on#t want two or more pla+ers to be confuse about w$o s$oul o it! )n baseball* coverin' first base can be confusin' to arbitrate w$o will 'et t$e <ob* but t$rowin' t$e ball to a base is strai'$tforwar because onl+ one pla+er can $ave t$e ball at an+ one time! )f more t$an one person can o t$e <ob at t$e same time* +ou probabl+ want t$e mana'er to be involve an assi'n it! I9,e noticed that there are more 3obs than people to fill them: Why so many 3obs if no one 2ill get them8 Ieople mi'$t 'et t$em! ,ecause of t$e process of fillin' <obs from $i'$est to lowest priorit+* some $i'$ priorit+ <obs on#t 'et fille because no one is @ualifie to $ave t$em! )n t$at case* t$ere coul still be people w$o nee <obs w$en +ou 'et towar t$e ver+ en of t$e <ob list! When do I run the algorithm8 &ou run it ever+ time t$e situation c$an'es an +ou want +our pla+ers to c$an'e <obs! )f t$e situation $asn#t c$an'e * t$ere is no nee to reassess ever+bo +#s <ob! "owever* +ou s$oul refrain from callin' t$e al'orit$m too often since it ma+ lea to too muc$ <ob swappin'! ) woul issua e +ou from runnin' t$e al'orit$m more t$an ever+ 3 secon s! )f +ou nee to run it more t$an t$at* +ou aren#t assi'nin' t$e pla+ers ver+ 'oo <obs in t$e first place an +ou s$oul anticipate furt$er in t$e future! /o2 do I determine 2hat are good situations to use8 Iut +ourself in t$e s$oes of +our () pla+ers an as/ +ourself* C1$at o ) nee to /now about m+ worl in or er to ac$ieve m+ 'oal0D )n baseball* t$e ma<or concerns are t$e runners an t$e ball! )n a war strate'+ 'ame* t$e ma<or concerns are t$e locations of +our enemies* t$eir resources* t$e location of +our own people an +our own resources* an t$e 'eo'rap$+ of t$e battlefiel ! )n a war strate'+ 'ame +ou coul $ave two levels of cooperation! ;ne level coul eci e $ow eac$ unit will cooperate to ac$ieve a 'lobal common 'oal* an t$e secon level woul eci e $ow eac$ unit cooperates internall+ in or er to ac$ieve a micro 'oal suc$ as ta/e an $ol a position! )n or er to fin 'oo situations* concentrate on t$e variables t$at influence ecisions! -$en some$ow 'roup t$ose variables into less t$an 20 uni@ue situations!

/o2 about not using fi(ed situations and compiling a priority list of 3obs on the fly8 Great i ea9 -$is ma/es t$e al'orit$m even more +namic! "owever* +ou ma+ be as/in' for trouble since +ou on#t $ave as 'oo of control at pre ictin' w$ic$ <obs an in w$at or er t$e+ 'et compile ! -$is a s some comple.it+ an uncertaint+ t$at ma+ not be wort$ t$e effort! (not$er approac$ is to still use t$e static list of priorit+ <obs* but $ave special cases for some <obs t$at loo/ at ot$er variables! (lso* if +ou can#t i entif+ <ust a $an ful of situations in t$e first place* ma+be +ou on#t un erstan +our problem ver+ well! ) woul su''est first efinin' +our situations usin' t$e met$o s of t$e al'orit$m an t$en eterminin' w$ere it brea/s own an w$+ it oesn#t @uite 'ive +ou w$at +ou want! -$en +ou can probabl+ write a 'oo al'orit$m for compilin' priorit+ <obs on t$e fl+ or <ust usin' a $an ful of e.ceptions! *ll of the other algorithms listed had pros and cons7 2hat are the cons of the Perfect Cooperation algorithm8 -$e al'orit$m is perfect in ever+ wa+! Pust /i in'! (ctuall+ t$e most anno+in' t$in' about t$e al'orit$m is t$at t$e mana'er nee s to reassi'n ever+bo + in or er for an+ of t$e pla+ers to switc$ <obs or 'et a new one! ,ut t$at is also w$at 'ives t$e al'orit$m its power b+ consi erin' ever+one at once in or er to ma/e intelli'ent c$oices! )n t$e case of baseball* man+ () pla+ers initiall+ tr+ to intercept t$e ball but as it passes t$em t$e+ sometimes reali5e t$e+ on#t $ave a c$ance at 'ettin' it! -$e+ nee e to 'o after it initiall+* but sometimes t$e+ nee to 'ive up! ;nce t$e+ reali5e t$is* t$e+ woul li/e to 'o o anot$er <ob! "owever* t$e onl+ wa+ to 'et a new <ob is for t$e mana'er to reassess t$e situation an 'ive ever+bo + new <obs! )f +ou esi'n +our selection al'orit$m correctl+* it won#t swap pla+ers out of t$eir <obs unnecessaril+* so t$eoreticall+ +ou coul run t$e mana'er function continuousl+! -$e ot$er ba part of t$is al'orit$m is t$at t$e boun ar+ between autonomous be$avior an mana'er riven be$avior ten s to be a little fu55+! &ou will probabl+ 'o bac/ an fort$ as to w$en +our pla+ers s$oul listen to t$e mana'er an w$en t$e+ s$oul act on t$eir own! Since it#s not a blac/ an w$ite ivision* +ou will nee to consi er eac$ situation carefull+ in or er to avoi conflicts! Conclusion 1it$ all of t$e 'reat cooperation al'orit$ms at +our isposal* t$ere is no e.cuse for not esi'nin' cooperation into +our () c$aracters from t$e start! )f +ou nee motivation* <ust remember t$e e.amples of w$at lous+ cooperation loo/s li/e! -$e Ierfect Cooperation al'orit$m is eas+ to implement an is @uite efficient at 'ivin' 'reat results fast! ( in' t$e Ierfect Cooperation al'orit$m to 8icrosoft ,aseball 3D too/ less t$an one wee/! 1$at too/ a lot lon'er was e.perimentin' wit$ ot$er alternatives until we came up wit$ t$is fairl+ robust tec$ni@ue! :ow t$at ) $ave one all of t$e $ar researc$ wor/ for +ou* 'ive it a s$ot an see if it wor/s in +our own 'ame! )f +ou o mana'e to use t$e Ierfect Cooperation al'orit$m in +our ne.t 'ame or an+ of t$e ot$er al'orit$ms* please rop me an eLmail Asteve@aiwis om!comB tellin' me about +our situation an w$at +ou i to ma/e it wor/! ) wrote t$is paper in or er to $elp out ot$er people in similar situations an it woul mean a lot to me to $ear from +ou!

*ppendi( ': Baseball Terminology used in this Paper and Microsoft Baseball 3D Baseball Position 6irst ,aseman Secon ,aseman S$ort Stop -$ir ,aseman Iitc$er Catc$er Heft 6iel er Center 6iel er Ri'$t 6iel er *bbre,iation 1, 2, SS 3, Ii Ca H6 C6 R6

)nfiel ers% 1,* 2,* SS* 3,* Ii* Ca ;utfiel ers% H6* C6* R6 Common oal of &ielders in Baseball: Get t$ree outs to retire t$e innin'! Do t$is b+ catc$in' t$e ball an possibl+ ta''in' a runner or base wit$ it! 1obs in Baseball )ntercept ,all ,ac/up 6iel er Cover 1st ,ase Cover 2n ,ase Cover 3r ,ase Cover "ome Ilate ,ac/up 1st ,ase ,ac/up 2n ,ase ,ac/up 3r ,ase ,ac/up "ome Ilate ;utfiel Cutoff )nfiel Cutoff Description Catc$ t$e ball after a $it! Get in a position to catc$ t$e ball s$oul anot$er fiel er miss a catc$! Stan on 1st base an prepare to catc$ a ball t$rown to +ou! Stan on 2n base an prepare to catc$ a ball t$rown to +ou! Stan on 3r base an prepare to catc$ a ball t$rown to +ou! Stan on $ome plate an prepare to catc$ a ball t$rown to +ou! Stan near 1st base in a position to catc$ an overt$rown ball to 1st base! Stan near 2n base in a position to catc$ an overt$rown ball to 2 n base! Stan near 3r base in a position to catc$ an overt$rown ball to 3r base! Stan near $ome in a position to catc$ an overt$rown ball to $ome plate! Stan between t$e infiel an outfiel in a 'oo position to rela+ t$e ball! Stan in t$e infiel in a position to intercept a t$rown ball to $ome s$oul anot$er runner be a vancin' an t$e pla+ at $ome not viable!

Você também pode gostar