Screeps - A fun and exciting way to improve programming skills

文章推薦指數: 80 %
投票人數:10人

Screeps is a strategic MMO where you write your own AI. The language used is NodeJS-like Javascript with the lodash library included, however ... Softwaredevelopmentisatoughjob.Everyyearthereseemtobemoreandmore"Javakillers","Javakiller-killers"andrevolutionaryparadigmshifts(UsuallyfromObject-orientedtofunctionalandbackagain).Inordertostayrelevantweneedtoputinthetimeoutsideofworktotryoutthesenewlanguages.Itcanbeverydifficulttokeepthisupwhenmostoftheselanguagessinkbackintoobscurityseveralmonthslater.IusuallymanagetoforcemyselftodoanaverageofthreeorfourhoursaweekofselfdevelopmentwhichIfeltwasprettygoodconsideringhowlongI'vebeeninthejob. TowardstheendoftheholidaysIfoundScreeps(www.screeps.com)intheSteamsale.InthelastweekIhaveputin25hoursofselfdevelopmentandI'mstilllookingforwardtodoingmore.Screepsisagame,butitalsotricksyouintospendinghoursoncomputerscienceproblemswithoutrealizingitshouldbeconsideredwork. SowhatisScreeps? ScreepsisastrategicMMOwhereyouwriteyourownAI.ThelanguageusedisNodeJS-likeJavascriptwiththelodashlibraryincluded,howeveryoucanuseanylanguagewhichcompilestoJavascriptinordertowriteyourcode.Alistoftheselanguagescanbefoundathttps://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js(notmypage).Thismeansthatyoucanswitchlanguagesatwill,givingyoufullfreedomtopracticethatnewlanguageyou'relearningonrealproblems. Manyofthenecessitieslikepath-findingareavailableintheAPIsoitdoesn'ttakeyouweeksofworktogetgoing.Youcancompletethe(free)onlinetutorialandthendivestraightintothegamewiththeAIyouhavedevelopeduptothatpoint.Theonlinetutorialisavailableathttps://screeps.com/a/#!/sim/tutorial IfyouhaveneverdevelopedsoftwarebeforeyouwillwanttodoadayortwoofJavascriptpracticebeforestartingtoworkonthegame,thereisatutorialathttps://www.codecademy.com/learn/javascriptwhichisrecommendedontheScreepspagetogetyoustarted Oksoit'sascriptinggame?Newlanguagesaside,howdoesitmakemeabettersoftwaredeveloperifthedifficultfunctionslikepath-findingandsearchingarealreadyimplemented? ThebeautyofScreepsisthatyourCPUandmemoryarelimited.YoucanmakedowithveryinefficientcodetobeginwithbutasyourAIempiregrowsyoucanfindyourCPUusageincreasingexponentially.Highlevelplayersgosofarastowritetheirownpathingandsearchfunctionsbuttostartwiththere'ssomuchtodothatyou'lljustwanttogetthebasicsinplaceandimproveonitlater. TogiveanexampleIstartedwithmyAIplacingstructuresinarandomfreesquarewithin10squaresofmycreep(minion)spawningpoint.TodayIintendtocreateabasicalgorithmtocreateefficientbuildingplacementtominimizetraveltime. SoIneedtostartatthespawnandworkoutwardsinacircleuntilIfindafreesquarethatismorethan1squareaway.ThenIplacethestructureandcallthatmynewstartpoint.ThenIneedtoplaceanotherstructureclosetothatstructure.Buthowdoyouoptimizesothatyoudon'thavealineofstructuresmarchingawayintothedistance?Howdoyoumakesureyou'renotblockinganimportantpath?Whatifapreviouslyplacedstructureisdestroyed? Youcanseehowcomplexevensimple(ish)problemscangetandthebottomlineisI'mexcitedtoworkonagraphproblemthatwouldhavehadmegroaningifitwereacomputerscienceassignmentbackincollege What'sthecatch? ThereareafewthingswhicharelessthanidealinScreepsduetothenatureofthegame  1)Nosourcemaps-Youcanminifyyourcodebutitmakesdebuggingintheconsoleverydifficult,onesolutionistoloadminifiedcodeandthenwhensomethinggoeswrongloadtheunminifiedcodeandhopethatit'snotaminificationbug 2)Nobreakpointdebugging-Not100%true,ifyouareworkingwiththesimulatorinthebrowseryoucanusedebugstatementsinyourcodebutyoucan'tdothisinthemainclientorinthemaingame.Ifyou'vebecomeaccustomedtochromeorfirefoxbreakpointdebuggingI'mafraidit'sbacktothelandofconsole.logforthemostpart. 3)Nologfilegeneration-I'msuresomepeopleseethisasabonus.Youcangenerateemailstoyourselfwhichcanbeusedforimportantthingsbutyoureallydon’twantanemailevery4seconds. 4)Themaingamerunsatabout1tickper4seconds-Thisisn'tanissueformebutsomepeoplemaywantafasterpace.Youcansetupastand-aloneserverandalterthetickrateifyouwish,thesimulatorwillletyourunquitefasttoo. CanIuse? Yes.YoudropyourJavascriptfilesintoadirectorywhichisuploadedtotheserverifithaschangedsowhateverdevelopmentenvironmentyouliketousewillbefine.PersonallyI'maJetbrainsfanandthere'sanautocompletelibrarydefinitionavailablefortheScreepsAPIlibrarywhichworksinWebstormathttps://github.com/Garethp/ScreepsAutocomplete(notmypage) Howmuchisthisgoingtocostme?  Thebasegameissomewherearound€15onsteam.Forthisyougetthestandaloneserverand30daysofCPUsubscription.Afterthatasubscriptioncosts€6.99–€8.99permonth,dependingonhowmanymonthsyoubuyatonce.ConsideringwhatIpayannuallyforanegghead.iosubscriptionandtheJetbrainsIDEpackagethisseemsveryreasonable. Wait,subscription? Youcancontinuetoplayinthemainonlineserverafterthesubscriptionexpires.WithasubscriptionyourCPUislimitedto30+10perroomuptoamaximumof300(CPUismeasuredinmillisecondsofruntime).Withoutasubscriptionyou'relimitedtoaflat10CPUlimit.That'sstillenoughtocontrolafewroomswithhighlyoptimizedcodeandifyourAIisgoodenoughandgathersenoughresourcesyoucantradein-gameresourcesforsubscriptiontokens. Thesubscriptiondoesnotaffectyouraccesstoprivateserversorstand-aloneservers,it'sreallyjusttopaythecostsofhostingsomuchprocessingpower24/7/365. Wrapup I'dliketomakeitclearthatI'mnotaffiliatedwithScreepsinanyway.Ifenoughpeopleareinterestedandit'sconsideredLinkedinappropriateIwillwriteafollow-uparticleonsettingupWebstormandagitlabaccountandgettingstartedinScreeps 17 1Comment Like Comment Share LinkedInUser Allhailskynet Like Signintolikethiscomment Reply Signintoreplytothiscomment 5y Reportthiscomment Tovieworaddacomment,signin Tovieworaddacomment,signin



請為這篇文章評分?