raspberry pi gaming second edition - tentacle.netprophet/raspberrypi/raspberry pi/1784399337... ·...
TRANSCRIPT
![Page 1: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/1.jpg)
![Page 2: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/2.jpg)
![Page 3: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/3.jpg)
RaspberryPiGamingSecondEdition
![Page 4: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/4.jpg)
TableofContents
RaspberryPiGamingSecondEdition
Credits
AbouttheAuthor
AbouttheReviewers
www.PacktPub.com
Supportfiles,eBooks,discountoffers,andmore
Whysubscribe?
FreeaccessforPacktaccountholders
Preface
Whatthisbookcovers
Whatyouneedforthisbook
Whothisbookisfor
Conventions
Readerfeedback
Customersupport
Downloadingthecolorimagesofthisbook
Errata
Piracy
Questions
1.GettingStartedwiththeRaspberryPi
ThedifferentflavorsofaRaspberryPi
SettingupanSDcard
CreatingtheSDcardinWindows
CreatingtheSDcardinMacintoshOSX
CreatingtheSDcardinLinux
UsingNOOBS
HookingupyourRaspberryPi
ConnectingtoaWi-Fiaccesspoint
Summary
![Page 5: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/5.jpg)
2.Scratch
WhatisScratch?
UnderstandingtheScratchinterface
MakingScratchymove
Somepointersandterminology
Let’sbuildaFlappyBirdclone!
Creatinganewproject
Makingthevariables
Settingthestage
Makingthefloor
Creatingthepipes
Workingwiththemaincharacter
Enhancingthegame
PingPong
Makingthepaddles
Followingthebouncingball
Summary
3.RaspberryPiGamingOperatingSystems
PiPlay
RetroPie
ChameleonPi
Summary
4.Emulators
RaspberryPiAppStore
UsingtheAppStore
Emulators
Mednafen
FCEUX(NES)
PiSNES(SNES)
MAME4ALL
FinalBurnAlpha
![Page 6: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/6.jpg)
PCSX_ReARMed
PicoDrive(Genesis/MegaDrive)
Stella(Atari2600)
Controls
Summary
5.PortedGames
CaveStory
Installingandrunning
Controls
Doom
Installingandrunning
Controls
OpenArena
Installation
Singleplayermatch
Multiplayermatch
Runningaserver
Joiningaserver
Controls
Minecraft:PiEdition
Installingandrunning
CreatinganewMinecraftworld
UsingtheMinecraft:PiEditionApplicationProgrammingInterface
MultiplayerMinecraft
Controls
Summary
6.LinuxGames
FreeCiv
Installingandrunning
HostingaFreeCivserver
Learningthecontrols
![Page 7: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/7.jpg)
SuperTux
Installingandrunning
Learningthecontrols
Njam
Installingandrunning
Learningthecontrols
Galaga:Hyperspace
Installingandrunning
Learningthecontrols
Findinggamesviatherepositories
Summary
7.Controllers
ControllersontheRaspberryPi
Gamepads
Arcadesticks
Xbox360controllers
SonyDualShock3controllers
USBencoders
GPIOpins
Installingandbuilding
Troubleshootingcontrollers
Summary
8.Troubleshooting
Usingraspi-config
Commontroubleshooting
EmulationStationreturnsanerrorwhenItrytolaunchit
NothinghappenswhenIapplypower
Someofthegamesseemslow
ConnectingviaHDMIdoesn’twork
TheDualShock3controllerdoesnotconnect
IgetanerrorwhencompilingRetrogame
![Page 8: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/8.jpg)
Summary
A.GamesList
GamesavailableviaApt-Get
RaspberryPi2
Index
![Page 9: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/9.jpg)
![Page 10: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/10.jpg)
RaspberryPiGamingSecondEdition
![Page 11: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/11.jpg)
![Page 12: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/12.jpg)
RaspberryPiGamingSecondEditionCopyright©2015PacktPublishing
Allrightsreserved.Nopartofthisbookmaybereproduced,storedinaretrievalsystem,ortransmittedinanyformorbyanymeans,withoutthepriorwrittenpermissionofthepublisher,exceptinthecaseofbriefquotationsembeddedincriticalarticlesorreviews.
Everyefforthasbeenmadeinthepreparationofthisbooktoensuretheaccuracyoftheinformationpresented.However,theinformationcontainedinthisbookissoldwithoutwarranty,eitherexpressorimplied.Neithertheauthor,norPacktPublishing,anditsdealersanddistributorswillbeheldliableforanydamagescausedorallegedtobecauseddirectlyorindirectlybythisbook.
PacktPublishinghasendeavoredtoprovidetrademarkinformationaboutallofthecompaniesandproductsmentionedinthisbookbytheappropriateuseofcapitals.However,PacktPublishingcannotguaranteetheaccuracyofthisinformation.
Firstpublished:September2013
Secondedition:February2015
Productionreference:1170215
PublishedbyPacktPublishingLtd.
LiveryPlace
35LiveryStreet
BirminghamB32PB,UK.
ISBN978-1-78439-933-7
www.packtpub.com
![Page 13: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/13.jpg)
![Page 14: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/14.jpg)
CreditsAuthor
SheaSilverman
Reviewers
DustinLarmeir
MattMurray
HarishPillay
DanPurdy
CommissioningEditor
PramilaBalan
AcquisitionEditor
OwenRoberts
ContentDevelopmentEditor
SamanthaGonsalves
TechnicalEditor
PrajaktaMhatre
CopyEditors
PranjaliChury
MerilynPereira
AdithiShetty
ProjectCoordinator
SanchitaMandal
Proofreaders
SimranBhogal
LindaMorris
Indexer
MariammalChettiyar
ProductionCoordinators
ManuJoseph
NileshR.Mohite
CoverWork
![Page 15: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/15.jpg)
ManuJoseph
![Page 16: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/16.jpg)
![Page 17: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/17.jpg)
AbouttheAuthorSheaSilvermanhasbeenusingcomputerssincehewastwoyearsold.Hehasalwaysbeendrawntotechnology,videogames,education,andthepublicsector.HeisanemployeeattheCenterforDistributedLearningatUCF,wherehespendshistimeresearchinganddevelopingnewwaystoenhanceonlinelearning.HeisamemberoftheOrlandomakerspaceFamiLABandanalumnioftheUniversityofCentralFlorida.HisarticleentitledHacking,Learning,andtheRaspberryPiwaspublishedin2600:TheHackerQuarterly,hewasatechnicalreviewerforRaspberryPiNetworkingCookbook,PacktPublishing,andistheauthorofRaspberryPiGaming,PacktPublishing.
Youcanfindmoreinformationabouthimathttp://www.sheasilverman.com.
Iwouldliketothankmywonderfulwife,Kristene,whoprovidesunendingencouragementandsupporttomyprojects.Iwouldliketothankmyfriendsandfamilyfortheirongoingsupport,especiallymygrandmaforalwaysbelievinginme.Finally,IwouldliketothankLiz,Eben,andtheRaspberryPiFoundationforthecreationoftheRaspberryPi,aswellasthethewonderfulcommunitythathasflourishedsinceitsrelease.
![Page 18: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/18.jpg)
![Page 19: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/19.jpg)
AbouttheReviewersDustinLarmeirhasworkedinthewebhostingandcloudindustryfornearly10years,supportingLinuxsystemsandthevirtualizationinfrastructure.Heisanavidtechnologyenthusiastandloveslearningnewconceptsaswellasteachingothers.
I’dliketothankmywifeforallofhersupportthroughtheyearsinmypursuitofacareerintechnology.
MattMurrayisacreativetechnologistwholovesallthingstech,art,andeducation-related.Heholdsabachelor’sdegreeincomputeranimationandisaself-taughtprogrammer,whostartedattheageof14.Inmorerecentyears,Matthasbeentinkeringwithmoreandmorehardware-relatedprojectswithahopetohelpbridgevirtualworldswithourown.
Iwouldliketothankmypatientwifeandkids.
HarishPillayhasbeenintheICTindustryforover30years.HeiscurrentlywithRedHat,workingoncommunity-relatedengagementsatthegovernment,corporate,andenddeveloperlevels.HarishholdsanMSEEandaBSCS,bothfromOregonStateUniversity.HarishfoundedtheSingaporeLinuxUsersGroupin1993.In2005,hewasinductedintotheCouncilofOutstandingEarlyCareerEngineersbytheCollegeofEngineering,OregonStateUniversity.In2009,hewaselevatedtoFellowoftheSingaporeComputerSociety.In2013,hewasnamedDistinguishedPartnerbySPRINGSingapore,thenationalstandardsandqualityagencyinSingaporeforhisworkandcontributionstoITstandardsinSingaporeandattheInternationalStandardsOrganization(ISO).
Eternalgratitudetomysoulmate,Usha,andourtwosons,AjayandAmrish,fortheirunconditionalloveandsupportforallthecrazythingsthatIdo.
DanPurdyisaLondon-basedfrontenddeveloper.HegraduatedfromtheUniversityofHuddersfieldwithadegreeinmusictechnologyandaudiosystemsandthenworkedasatechnicalengineeratatopLondonrecordingstudio,wherehehelpedmaintaintheirvastarrayofequipmentandprovidedtechnicalassistanceonavarietyofprojects.Duringthistime,hedevelopedandbuiltseveralwebapplicationstocentralizeanddigitizemanyofthestudios’processes,whilealsoexperimentingwithRaspberryPi.Hedevelopedseveralstandaloneapplicationsandgames,rangingfromkiosk-styledisplaysandtakecounterstoaidassistantsandclientstoabarcodereadingmicrophoneloggingsystem.Projectsaredocumented,alongwithtutorials,onhisblogathttps://www.danpurdy.co.uk.
Danhassincemovedontoworkasafull-timedeveloperatadigitalagencyinLondon,workingonenterprise-levelwebapplications,e-commercesites,andprototypeswhilecontinuingtoexperimentwithnewframeworksandtechnologies.HealsocontinuestodevelopanddocumentnewRaspberryPiprojects.
![Page 20: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/20.jpg)
![Page 21: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/21.jpg)
www.PacktPub.com
![Page 22: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/22.jpg)
Supportfiles,eBooks,discountoffers,andmoreForsupportfilesanddownloadsrelatedtoyourbook,pleasevisitwww.PacktPub.com.
DidyouknowthatPacktofferseBookversionsofeverybookpublished,withPDFandePubfilesavailable?YoucanupgradetotheeBookversionatwww.PacktPub.comandasaprintbookcustomer,youareentitledtoadiscountontheeBookcopy.Getintouchwithusat<[email protected]>formoredetails.
Atwww.PacktPub.com,youcanalsoreadacollectionoffreetechnicalarticles,signupforarangeoffreenewslettersandreceiveexclusivediscountsandoffersonPacktbooksandeBooks.
https://www2.packtpub.com/books/subscription/packtlib
DoyouneedinstantsolutionstoyourITquestions?PacktLibisPackt’sonlinedigitalbooklibrary.Here,youcansearch,access,andreadPackt’sentirelibraryofbooks.
![Page 23: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/23.jpg)
Whysubscribe?FullysearchableacrosseverybookpublishedbyPacktCopyandpaste,print,andbookmarkcontentOndemandandaccessibleviaawebbrowser
![Page 24: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/24.jpg)
FreeaccessforPacktaccountholdersIfyouhaveanaccountwithPacktatwww.PacktPub.com,youcanusethistoaccessPacktLibtodayandview9entirelyfreebooks.Simplyuseyourlogincredentialsforimmediateaccess.
![Page 25: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/25.jpg)
![Page 26: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/26.jpg)
PrefaceHi!WelcometothewonderfulworldoftheRaspberryPi.Inafewshortyears,theRaspberryPihasamassedarichdiversityofsoftware,cultivatedbyitsincrediblecommunity.
Inthisbook,wearegoingtoexploretheentertainmentcapabilitiesoftheRaspberryPi.Fromprogrammingyourownvideogames,torelivingclassicmomentswithyourfavoritegamesystems,I’mpositiveRaspberryPigamingwillhelpyouunlockthecapabilitiesofyourdevice.
![Page 27: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/27.jpg)
WhatthisbookcoversChapter1,GettingStartedwiththeRaspberryPi,willexplainthevariousdifferencesbetweentheRaspberryPimodels,showyouhowtosetupanSDcardforuseinyourdevice,andfinallyhowtohookupyourRaspberryPi.
Chapter2,Scratch,willintroducetheprogramminglanguageandprogrammingconceptsrequiredtobuildagame.Bytheendofthischapter,youwillhavemadetwogamesreminiscentofFlappyBirdandPingPong.
Chapter3,RaspberryPiGamingOperatingSystems,guidesyouthroughthedifferentoperatingsystemsthatarededicatedtovideogaming.Thesedistributionshavebeenspeciallysetuptoofferafunout-of-the-boxexperience.
Chapter4,Emulators,explainsthevariousgamingconsolesthatareavailabletobeemulatedontheRaspberryPi.YouwillalsolearnhowtoaccesstheRaspberryPiAppStoreandusethebuilt-insoftwarerepository.
Chapter5,PortedGames,showsyouhowtoinstallandusegamesthatwereoriginallyforothersystemsbuthavenowbeenreprogrammedtorunontheRaspberryPi.
Chapter6,LinuxGames,exploresthosegamesthatarenativetotheLinuxoperatingsystem.
Chapter7,Controllers,willintroduceandexplaintheworldofcontrollers,gamepads,andarcadesticks,andhowtheycaninterfacewiththeRaspberryPi.YouwillalsolearnhowtohookupyourfavoriteconsolegamepadstoyourPi.
Chapter8,Troubleshooting,willguideyouthroughthecommonissuesthatcropupwhenutilizingaRaspberryPi.
Appendix,GamesList,providesyouwithalistofthenativeLinuxgamesthatareavailableintheRaspbianrepositories.
![Page 28: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/28.jpg)
![Page 29: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/29.jpg)
WhatyouneedforthisbookYouwillneed:
ARaspberryPiAnSDcard(4GBorhigher)AcomputerrunningOSX,Windows,orLinuxAnetworkconnection
![Page 30: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/30.jpg)
![Page 31: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/31.jpg)
WhothisbookisforIfyouaresomeonewholovestoplaygamesandareinterestedinlearningmoreaboutthecapabilitiesofyourRaspberryPi,thisbookisforyou.BasicknowledgeofRaspberryPiprogrammingisexpected.
![Page 32: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/32.jpg)
![Page 33: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/33.jpg)
ConventionsInthisbook,youwillfindanumberoftextstylesthatdistinguishbetweendifferentkindsofinformation.Herearesomeexamplesofthesestylesandanexplanationoftheirmeaning.
Codewordsintext,databasetablenames,foldernames,filenames,fileextensions,pathnames,dummyURLs,userinput,andTwitterhandlesareshownasfollows:“Inthecommandprompt,typestartxtolaunchthedesktopenvironment.”
Whenwewishtodrawyourattentiontoaparticularpartofacodeblock,therelevantlinesoritemsaresetinbold:
1. Runsudochownpi/opt/retropie/configs/all/retroarch.cfg.2. Thenruncd/opt/retropie/emulators/RetroArch/installdir/bin.3. Finally,runsudo./retroarch-joyconfig-j0>>
/opt/retropie/configs/all/retroarch.cfg.
Anycommand-lineinputoroutputiswrittenasfollows:
mc.setBlock(player.x+1,player.y,player.z,block.GOLD_BLOCK)
Newtermsandimportantwordsareshowninbold.Wordsthatyouseeonthescreen,forexample,inmenusordialogboxes,appearinthetextlikethis:“AfterclickingonConnect,youwillbeaskedtologinasRegisteredUserorasGuest.ChooseGuest.”
NoteWarningsorimportantnotesappearinaboxlikethis.
TipTipsandtricksappearlikethis.
![Page 34: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/34.jpg)
![Page 35: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/35.jpg)
ReaderfeedbackFeedbackfromourreadersisalwayswelcome.Letusknowwhatyouthinkaboutthisbook—whatyoulikedordisliked.Readerfeedbackisimportantforusasithelpsusdeveloptitlesthatyouwillreallygetthemostoutof.
Tosendusgeneralfeedback,simplye-mail<[email protected]>,andmentionthebook’stitleinthesubjectofyourmessage.
Ifthereisatopicthatyouhaveexpertiseinandyouareinterestedineitherwritingorcontributingtoabook,seeourauthorguideatwww.packtpub.com/authors.
![Page 36: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/36.jpg)
![Page 37: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/37.jpg)
CustomersupportNowthatyouaretheproudownerofaPacktbook,wehaveanumberofthingstohelpyoutogetthemostfromyourpurchase.
![Page 38: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/38.jpg)
DownloadingthecolorimagesofthisbookWealsoprovideyouwithaPDFfilethathascolorimagesofthescreenshots/diagramsusedinthisbook.Thecolorimageswillhelpyoubetterunderstandthechangesintheoutput.Youcandownloadthisfilefrom:https://www.packtpub.com/sites/default/files/downloads/9337OS_ColoredImages.pdf.
![Page 39: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/39.jpg)
ErrataAlthoughwehavetakeneverycaretoensuretheaccuracyofourcontent,mistakesdohappen.Ifyoufindamistakeinoneofourbooks—maybeamistakeinthetextorthecode—wewouldbegratefulifyoucouldreportthistous.Bydoingso,youcansaveotherreadersfromfrustrationandhelpusimprovesubsequentversionsofthisbook.Ifyoufindanyerrata,pleasereportthembyvisitinghttp://www.packtpub.com/submit-errata,selectingyourbook,clickingontheErrataSubmissionFormlink,andenteringthedetailsofyourerrata.Onceyourerrataareverified,yoursubmissionwillbeacceptedandtheerratawillbeuploadedtoourwebsiteoraddedtoanylistofexistingerrataundertheErratasectionofthattitle.
Toviewthepreviouslysubmittederrata,gotohttps://www.packtpub.com/books/content/supportandenterthenameofthebookinthesearchfield.TherequiredinformationwillappearundertheErratasection.
![Page 40: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/40.jpg)
PiracyPiracyofcopyrightedmaterialontheInternetisanongoingproblemacrossallmedia.AtPackt,wetaketheprotectionofourcopyrightandlicensesveryseriously.IfyoucomeacrossanyillegalcopiesofourworksinanyformontheInternet,pleaseprovideuswiththelocationaddressorwebsitenameimmediatelysothatwecanpursuearemedy.
Pleasecontactusat<[email protected]>withalinktothesuspectedpiratedmaterial.
Weappreciateyourhelpinprotectingourauthorsandourabilitytobringyouvaluablecontent.
![Page 41: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/41.jpg)
QuestionsIfyouhaveaproblemwithanyaspectofthisbook,youcancontactusat<[email protected]>,andwewilldoourbesttoaddresstheproblem.
![Page 42: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/42.jpg)
![Page 43: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/43.jpg)
Chapter1.GettingStartedwiththeRaspberryPiTheRaspberryPiisaninexpensive,feature-richmoderncomputercreatedbytheRaspberryPiFoundation.SincethereleaseoftheModelBin2012,thecommunitysurroundingthecomputerhasgrown,allowingforanincredibleamountofprojectsandsoftwaretobecreatedforthedevice.Theserangefromprogramminglanguages,educationalapplications,hardwareprototypes,andofcourse,videogames.
Inthischapter,youwilllearnthefollowingtopics:
ThedifferentflavorsofaRaspberryPiSettingupanSDcardHookingupyourRaspberryPi
![Page 44: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/44.jpg)
ThedifferentflavorsofaRaspberryPiTheRaspberryPiFoundationhasreleasedfourmajormodelsoftheRaspberryPicomputer.TheytheareModelA,ModelB,ModelB+,andModelA+.TheRaspberryPi’sCPUistheBroadcomBCM2835chip.ItcontainsanARMprocessorrunningat700MHzandapowerfulgraphicschip.TheboardfeaturesHDMIandComposite(RCA)videooutputs,USBports,twoexpansionslots,aMicroUSBportforpower,andanarrayofGPIO(General-purposeinput/output)pinstointeractwiththeoutsideworld.
Sinceallmodelssharethesamebasichardwareplatform,alltheexamplesinthisbookareapplicabletoalltheversions.
ModelA ModelA+ ModelB ModelB+
USB 1 1 2 4
Ethernet 0 0 1 1
Videooutputs HDMI/Composite HDMI/Compositevia
3.5mmjack HDMI/Composite HDMI/Compositevia3.5mmjack
Memory 256MB 256MB 512MB 512MB
Storage SDcard MicroSDcard SDcard MicroSDcard
Powerusage 300mA 300mA 700mA 600mA
Price $25 $20 $35 $35
DifferencesLowcostsolution.DoesnothavebuiltinEthernetandithasonlyone1USBport.
Newestboard.Lowpower,lowcost,andmuchsmallerformfactor.
Originalboard.Balancesfeaturesandprice.
NewrevisiontotheBboard.Hasanewlayout,4USBports,andmoreGPIOpins.
![Page 45: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/45.jpg)
![Page 46: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/46.jpg)
SettingupanSDcardTheRaspberryPiusesSDcardstocontainitsoperatingsystemandmainstoragespace.ARaspberryPiSDcardcontainstwopartitions,whichareexplainedasfollows:
Thefirstone,isthebootpartition.ThisspacecontainstheLinuxkernel,requiredbootupfiles,andmostimportantly,theconfig.txtfile.ThisfileallowsyoutochangetheboottimeparametersandcustomizesomeofthefunctionsoftheRaspberryPi.Theseoptionsincludeover-clockingthedevice,changingmonitorsettings,andthememorysplitbetweenCPUandGPU,amongnumerousotheroptions.ThesecondpartitioncontainsaLinuxpartition,whichholdsallofyourapplications,configurations,andoperatingsystemfiles.
PreloadedSDcardimagesareavailable,whichmakeitquickandeasytogetyourRaspberryPiupandrunning.
ChoosinganSDcardisanimportantstep.Therearemanydifferentcombinationsofcardsizesandcardspeeds.4GBistheminimumsizerequiredformanyoftheoperatingsystems(OS).Irecommendthatyoustartoutwithan8GBcard.YouwillalsoseecardsmarkedwithClass4,Class6,andClass10.Thisisthespeedatwhichthecardcanbereadandwrittento.IhavefoundthatthebestbangforthebuckisaClass6card,butdon’tworrytoomuchaboutwhichoneyouchoose.
Beforewebegin,youwillneedtodownloadasuitableRaspberryPiOS.WewillbeusingtheofficialoperatingsystemcalledRaspbian.Youcandownloaditfrom
http://www.raspberrypi.org/downloads.
NoteWarning!ddandWin32DiskImagercanbeusedtooverwriteyourcomputer’sownharddriveorotherdrivesconnectedtoyourcomputer.DoubleandtriplecheckthatthedriveyouselectisyourSDcard.
![Page 47: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/47.jpg)
CreatingtheSDcardinWindowsTocreatetheSDcardinWindows,youwillneedtodownloadtheprogramcalledWin32DiskImagerbyvisitinghttp://sourceforge.net/projects/win32diskimager/.
Onceyouaredonewiththedownloading,performthefollowingsteps:
1. UnziptheRaspbianimagebydouble-clickingontheRaspbian.zipfile.2. Selectaplaceonyourharddrivetosavetheextractedfile.3. ClickonExtractfiles….4. InserttheSDcardintoyourcomputer’sSDcardreader.5. RunWin32DiskImager.
6. SelecttheRaspberryPiimageonyourharddrive.7. SelectthedriveletterunderthedevicethatcorrespondstotheSDcard.8. ClickonWrite.
![Page 48: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/48.jpg)
CreatingtheSDcardinMacintoshOSXOSXincludeseverythingyouneedtocreatetheSDcardoutofthebox.Wewilluseautilitycalleddd:
1. Double-clicktheRaspbianimageZIPfile.ItwillautomaticallyextractintothesameplaceastheZIPfile.
2. InserttheSDcardintoyourcomputer’sSDcardreader.3. Opentheterminalapplication(locatedintheApplications|Utilitiesfolder).4. FindthenameofyourSDcardbytypingdiskutillist.
5. UnmountyourSDcardbytypingdisktuilumountdisk<disk>,thatis,/dev/disk2.
6. CopytheOSimagefromyourharddrivetotheSDcardbytypingddif=/path/to/os/image.imgof=<disk>where<disk>is/dev/disk2,andpath/to/os/image.imgistheplacetowhichyousavedtheimage.
7. Itcantakeanywherefrom15minutestooveranhourfortheimagetobewrittentotheSDcard.Itwilllooklikenothingishappeninguntilitfinishescopying.Whenitisdone,youwillseeamessageshowinghowlongittooktotransferinseconds.
TipYoucanpressCtrl+Tatanytimetoseethecurrentstatus.
![Page 49: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/49.jpg)
![Page 50: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/50.jpg)
CreatingtheSDcardinLinuxLikeOSX,Linuxincludeseverythingyouneedoutofthebox:
1. InserttheSDcardintoyourcomputer’sSDcardreader.2. Usingtheterminalofyoursystem,findthenameofyourSDcardbytypingsudo
fdisk–l.3. Ifrequired,youcanunmountyourSDcardbytypingumount<disk>(whichwillbe
listedfromtheearliercommand,IE/dev/disk2).4. CopytheOSimageonyourharddrivetotheSDcardbytypingdd
if=/path/to/os/image.imgof=<disk>.
NowthatyouhavecreatedyourRaspberryPiSDcard,it’stimetosetupourdevice!
![Page 51: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/51.jpg)
UsingNOOBSTheRaspberryPiFoundationhascreatedapieceofsoftwarecalledNewOutOftheBoxSoftware,oftenabbreviatedasNOOBS.Thisisasmalloperatingsystem,whichisusedtoinstallotherOSsontoyourRaspberryPi.
InstallingNOOBSismucheasierthanotherinstalls:
1. DownloadNOOBSfromhttp://www.raspberrypi.org/downloadsandunzipthefile.2. InserttheSDcardintoyourcomputer’sSDcardreader.3. DraganddroptheNOOBSfilesontotheSDcardandyouaredone!
Atthefirstboot,youwillbepresentedwithalistofOSsavailabletobeinstalled.ChooseRaspbianandpressEnter.
![Page 52: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/52.jpg)
![Page 53: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/53.jpg)
HookingupyourRaspberryPiIt’sveryeasytoproperlysetupaRaspberryPi.IfyoucanbuildaLegoset,youcanbuildyourRaspberryPicomputer.Thefollowingstepswillhelpyouinthis:
1. PlaceyourSDcardintotheSDcardslotontheundersideoftheRaspberryPi.2. ConnecttheHDMIorRCAcabletotherespectiveconnectorontheRaspberryPi,
andplugtheotherendintoyourmonitor.3. PlugtheEthernetcableintotheEthernetjack(notapplicabletoModelAandA+)on
theRaspberryPiandtheotherendintoyourrouterorswitch.4. ConnecttheUSBmouseandkeyboardtothetwoUSBportsavailableonthe
RaspberryPi.IfyouareusingModelA,connectaUSBhubtoyourRaspberryPiandthemouseandkeyboardtothehub.
5. Plugthepowersupply’sMicroUSBconnectorintotheMicroUSBportontheRaspberryPitoturniton.
6. AredLED,bytheUSBports,willlightuptoindicatethatthepoweristurnedon.7. Onyourscreen,asquarerainbowimagewillappearforabriefmoment,followedby
somequickmovingtextoragraphicloadingscreen.
Congratulations!YouhavesuccessfullybootedupyourRaspberryPi!
![Page 54: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/54.jpg)
ConnectingtoaWi-FiaccesspointTheRaspberryPiandRaspbiancaneasilyconnecttotheInternetviaEthernet,butwhenusingaUSBwirelessdevice,youcanalsoconnecttoaWi-Finetwork.RaspbianincludesagraphicalutilitytomakeconnectingtoaWi-Fiaccesspointeasy.Gothroughthefollowingsteps:
1. BootupyourRaspberryPi.2. Attheloginscreen,enteryourusernameandpassword(defaultispiandraspberry,
respectively).3. Inthecommandprompt,typestartxtolaunchthedesktopenvironment.4. Usingyourmouse,double-clickontheWiFiConfigiconthatisonthedesktop.5. TheWi-Ficonfigurationtoolwillappearshortly.
6. ClickonScantoscanforavailablewirelessnetworksaroundyou.7. Double-clickontheoneyouwishtoconnectto.
![Page 55: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/55.jpg)
8. Ifitisasecurednetwork,youwillbeaskedforapassword.9. EnterthepasswordandclickonAdd.
![Page 56: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/56.jpg)
10. TheStatus:DisconnectedmessageshouldnowchangetoStatus:Completed.
11. Youarenowconnectedtoyourwirelessnetwork.
Notewpa_guisavesyourconnectioninformation.IfyoulogoutorrebootyourRaspberryPi,itwillautomaticallytrytoconnecttoapreviouslyaddedaccesspoint.
Ifyoudonotseewlan0appearinthewpa_gui,orifyourRaspberryPiisunstable,youmightneedtouseapoweredUSBhub.Youshouldconnectyourdevicetoapoweredhub,andthenconnectthehubtotheRaspberryPi.Thiswillensurethatthecorrectamountofpowerisreceived.
YoucanalsocheckwhetheryourWi-Fiadapterissupportedbyvisitinghttp://elinux.org/RPi_USB_Wi-Fi_Adapters.
![Page 57: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/57.jpg)
![Page 58: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/58.jpg)
SummaryInthischapter,youlearnedhowtocreateyourRaspberryPi’sSDcard,hookituptoyourTVandotheraccessories,andconnectittotheInternet.Now,it’stimetohavefunwiththesoftwareonyourRaspberryPi.
Inthenextchapter,youwilllearnhowtocreateyourownvideogameusingtheScratchprogramminglanguage.
![Page 59: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/59.jpg)
![Page 60: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/60.jpg)
Chapter2.ScratchThischapterwillintroduceyoutotheamazingandfunworldofprogramming.Learningtoprogramandcodewillallowyoutobringyourideastocreation.Ifyouhaveeverwantedtomakeagame,buthadnoideawheretostart,thisistheplace.
Inthischapter,youwilllearnthebasicsneededtomakeyourownvideogameontheRaspberryPi.Youwilllearnhowto:
LaunchScratchDefineyourgame’sobjectivesDrawacharacterMakeyourcharacterinteractandmoveDesignandprogramaFlappyBird-stylegameDesignandcreatea2playerPingPonggame
![Page 61: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/61.jpg)
WhatisScratch?ScratchisaprogramminglanguageandapplicationdevelopedbytheMassachusettsInstituteofTechnology(MIT)asaneasy-to-use,educational,andfunenvironmenttolearntocodeandtomakevideogamesandapplications.Itisdifferentfrommostotherprogramminglanguages.Itiscompletelyvisual;ratherthantypingoutlinesofcode,allyouhavetodoisdraganddropvisualblockstocreateyourprogram.
Gamesthatmighthavetakendaystobecreatedearliercanbecreatedinminutes,rightinfrontofyoureyes.Now,youaregoingtocreatesomegamestoo!
![Page 62: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/62.jpg)
UnderstandingtheScratchinterfaceBeforewebeginwritingourfirstgame,youneedtounderstandtheScratchinterface.Scratchisnotonlyapowerfulprogramminglanguage,butalsoafull-featuredapplication.TowriteScratchprogramsusethefollowingsteps:
1. OpentheScratchapplication.ThisisincludedonallcopiesoftheofficialRaspberryPioperatingsystem,Raspbian.
2. Inthecommandline,typestartxtoactivatethedesktopenvironment.3. Onceatthedesktop,double-clickontheScratchicon.4. Scratchshouldnowopenanddisplayabrandnewproject,whichisreadyforyouto
begin.
Thefirstthingsyouwillnoticeisthattherearethreecolumns.Onthefarrightside,youshouldseeawhitesquarewithahappylookingcat.HisnameisScratchy.HeisalsothemascotofScratch.Thispaneliswherealltheactiontakesplace.Thisisyourgamescreen.
Thecolumninthemiddleiswhereallyourcodewillbeplaced.Atthemomentthereisnothinginhere,butthiswillsoonchange.
TheleftcolumncontainseverysingleavailablecommandintheScratchlanguage.Touseoneofthesepiecesofcode,justclickononeanddragittothemiddlecolumn.
Forourfirstexample,wewillmakeScratchymove.
![Page 63: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/63.jpg)
MakingScratchymoveLet’sgetreadytocreateourfirstprogram:
1. ClickonScratchyinthewhitepaneltomakesureheisselected.YouwillseeSprite1highlightedinthepanelbelow.SpritesarewhatthesecharactersarecalledinScratch.
2. Now,clickontheControlbuttonfromtheleftsideinthefirstcolumn.3. ClickontheWhen<greenflag>clickeditemanddragittothemiddlecolumn.4. Next,clickonMotionanddragthemove10stepsitemtothemiddlecolumn.5. MoveitundertheWhen<greenflag>clickeduntilawhitelineappearsbetween
them,andthenletgoofthemousebutton.
6. Now,clickonthegreenflagbuttonabovethegamepanel,andyoushouldseeScratchymoveabit.
Congratulations!YouhavejustmadeyourfirstapplicationinScratch.Let’sgetreadytomakeourfirstgame!
![Page 64: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/64.jpg)
SomepointersandterminologyBeforewestartworkingonourawesome,exciting,andfungames,hereareafewpointersandtipsforworkingwithScratch:
Variable:Youcanthinkofavariableasaboxthatcanstorethings.InScratch,eachvariablecanstoreanitem,beitanumber,aname,orsomeothervalue.Stage:Thisisthebackgroundofthegamewindow.Youcansetthestagebackgroundtobeanumberofdifferentimages,andevenincludescriptsonthestage.Xposition:Thisiswhereaspriteisonthexaxisofthestage.Thexaxisgoesleftandright(horizontally).YPosition:Thisiswhereaspriteisontheyaxisofthestage.Theyaxisgoesupanddown(vertically).Sprite:Thisisanythingonthegamestage.Itcanbeacharacter,awall,anenemy,apowerup,andsoon.Spriteshavetheirowncostumesandcode.Costume:Thisreferstowhataspritelookslike.Youcanhavemultiplecostumesforasprite.Ifstatement:Thissimplyasksatrueorfalsequestion.Ifit’strue,dothenextstep.Astatementthatsays2=2whichistrue,soitcontinues.If…elsestatement:Liketheearliercommand,anif…elsestatementwillcheckwhetherthestatementistrue,andifitisnot,itwilldowhateverisintheelseblock.Foreverloops:Foreverloopsareblocksofcodethatwillcontinuouslydoasetofcommands.Onceitreachestheend,itrestartsfromthebeginningoftheblockandperformsthemoverandover.
TipIfyoudon’tknowwheretofindtherightcommandfromtheexampleinstructions,lookatthecolorofthecommand.Thecolorsmatchtheactionbuttons.
![Page 65: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/65.jpg)
![Page 66: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/66.jpg)
Let’sbuildaFlappyBirdclone!YourfirstgameisgoingtobeaFlappyBirdclone.Whilethismightseemlikeacomplicatedtask,itreallycanbebrokendowntoafeweasyscripts.
NoteFlappyBirdisagreatstartinggame.Ithasaclearobjective,usesmuchoftheScratchfunctionality,isrelativelysimpletocreate,andyoucanuseyourimaginationbydrawingyourownsprites,backgrounds,andpipes.
WhatkindofagameisFlappyBird?Itisagamewhereyourgoalistokeeponpressingabuttontomakeabirdriseasitisconstantlyfallingwhilenavigatingitswaythroughthepipesofvaryingheightsthatarecomingatit.
Itcanbebrokendownasfollows:
EverybuttonpressmakesthebirdgoupontheyaxisEverysecondthebuttonisn’tpressedthebirdgoesdowntheyaxisApipestartsattherightendofthexaxisandmoveslefttowardthebirdWhenthepipereachesthefarleftcornerwithouttouchingthebird,youearnapointandthepipedisappearsIfthebirdtouchesthegroundorthepipe,thenthegameisover
So,nowweknowweneedaminimumoftwosprites:abirdandapipe.
Whatelsewillweneed?Wewillneedabackground,afloor,somevariables,andafewcostumes.
![Page 67: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/67.jpg)
CreatinganewprojectBeforewebegin,let’screateanewprojectforourFlappyBirdclone.Todoso,clickontheFilemenuandthenclickonNew.AbrandnewScratchprojectwillappear.
![Page 68: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/68.jpg)
MakingthevariablesNowthatweknowwhatweneed,wecanstartbycreatingourvariables:
1. ClickontheVariablesbutton,andthenclickonMakeavariable.Itwillaskyouforaname,anddisplaytwooptions:ForallspritesandForthisspriteonly.EnsurethatyouclickonForallsprites.
2. Ourfirstvariablewillbenamedscore.TypethisandclickonOK.Thescorevariablewillbeusedtokeeptrackofhowmanywallsyouhavepassed.Itwillgoupbyoneeachtime.
Now,makethreemorevariableswiththefollowingnames:
scroll:Thiswillbeusedtokeeptrackofwheretheflooris,sinceitwillbemovingtime:ThiswillkeeptrackofhowmanysecondshavepassedsinceyoustartedthegamepipeX:Thiswillkeeptrackofwherethepipeisacrossthescreen
![Page 69: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/69.jpg)
SettingthestageWithourvariablescreated,itisnowtimetocreateourgame’sbackgroundsusingthefollowingsteps:
1. ClickonStageintherightcolumn,andthenclickonBackgrounds.2. ClickonEdit.YouwillnowbeinPaintEditor.3. Clickonacolor,thenthepaintcan(filltool),andclickanywhereonthewhitearea.
ThenclickonOK.Youhavenowchangedthebackgroundofyourgame.
4. ClickonCopythreetimes,andthenediteachbackgroundtobeadifferentcolor.5. Now,clickonScripts.Wewilladdthefirstscriptstoourgame.
![Page 70: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/70.jpg)
Thisstagehastwoscripts:
Whenthegreenflagisclicked,itsetsthebackgroundtothenextbackground,waitsforonesecond,andthensetsittothenext.Itwillrepeatthisforeveruntilthegameisover.Thesecondscriptalsowaitsforthegreenflagtobeclicked.Itthensetsthevariabletimeto0,andadds1toiteverysecondusingaforeverblock.Theforeverblockrepeatswhat’sinsideofituntilthegameisstopped.
Ifyouclickonthegreenflag,youshouldseethebackgroundchange.Nowwouldbeagoodtimetosaveyourgameaswell.ClickonFile,thenchooseSave.GiveyourgameanameandclickonOK.
![Page 71: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/71.jpg)
![Page 72: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/72.jpg)
MakingthefloorThefloorofthegameservestwopurposes.Thefirst,istomakeitlooklikeyouaremovingbecausethefloorscrollsacrossthestage.Thesecond,istobeanavoidableobject.Ifyoutouchthefloor,thegameisover.Ourfloorisactuallygoingtobetwosprites.
Let’sstartwiththefirstone:
1. Ontheright-handsideofthewindowisanoptiontocreateanewsprite.Youhavethreeoptions:Paintnewsprite,Choosenewspritefromfile,orGetasurprisesprite.
2. CreateanewspritebyclickingonthePaintnewspritebutton.3. Now,usethelinetool anddrawalineallthewayfromthelefttotheright.Then
fillitinwithacolorusingthebuckettool .
4. ClickonOK.NameyourspriteFloor1byclickingonthenametextboxinthemiddlecolumn.
Now,let’screatethescriptsasfollows:
![Page 73: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/73.jpg)
Thefirstfloorspritehasthreescripts:
Thefirstscriptsetsthescrollvariableto0,andthenuntilthegameisover,itdecreasesby1.Thesecondscriptputsthefloorintoposition.Aftersettingthefloortobethefront-mostitem,itsetstheypositionto-180.Thisputsitatthebottomofthestage.Itthensetsthexpositionofthefloortothecurrentvalueofthescrollvariable.Thiswillmakeitmove.
Youwillinitiallydragthesetxto0motiontothescriptscolumn.Youwillthendragthevariablescrolloverthe0tochangeit.
Thethirdscriptresetsthescrollvariableto0ifitreachestheendofthescreen.
Pressthegreenflagbuttontowatchthefloorscroll.Itseemslikethere’sasmallproblemthough:thefloorisn’tlongenough.Itscrollsoffthescreenwithnothingbehindituntilitreachestheend.Don’tworrythough.It’sasimplefix!
1. Right-clickonFloor1andthenclickonDuplicate.2. Youshouldnowhaveacompletecopyofyourfloorsprite.Youshouldrenameitto
Floor2.Now,clickonitandchooseScripts.Wehavetomakeafewadjustments.3. DeletethefirstandthirdscriptfromFloor2.Youcandothisbyclickingand
draggingthemtothefirst(leftmost)column.4. Now,edittheremainingscripttolooklikethis:
![Page 74: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/74.jpg)
Bysettingxtoscroll+480,youwillnowhaveasecondfloorthatfollowsthefirstfloorandcontinuallyrepeats.
Youcanaddsomecolorandsomegrasstothecostumetoaddtothescrollingeffect.
![Page 75: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/75.jpg)
CreatingthepipesThepipesarerelativelystraightforward.Itisonesprite,withthreecostumes,andonescripttomakeitscrollacrossthescreen.
1. ClickonCreatenewspriteanddrawapipe.Mineisjustalongblackrectanglegoingallthewayfromthebottomtothetopoftheeditor.
2. UsetherectangletooltoselectaportionofthepipeandpressDelete.Younowhavetheareatoflythrough.
3. Copythecostumetwomoretimes.Thistimerefillintheholeandcreateanewoneatadifferentspotinthepipe.
Now,let’smakethepipescripts!
![Page 76: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/76.jpg)
Thefollowingstepsexplainthemakingofpipescripts:
1. Whenthegreenflagisclicked,movethepipetothetopofthelayer,andthenbackthreelayers.Thiswillmakeitappearbehindthefloor.
2. Thesetsizeisanewcommand.Thisallowsyoutomakethespritebiggerorsmaller.Experimentwiththesizeuntilyouarehappywithhowitlooks.Youcanalsochangethistoaffectthedifficultyofthegame.Ifyoudon’tseetheholeinthemiddleofthewall,itmaybebecausethesizeissettoohigh.
3. Then,setyto0,whichputsthewallrightinthemiddleofthescreen,andxto300,whichmovesitoffthescreentotheright.
4. SetthepipeXvariableto300.Wewillusethatvariablelater.5. Inourforeverloop,subtract1frompipeX.ThencheckwhetherpipeXislessthan
-240.Thisallowsustocheckwhereitisonthescreen.Ifitislessthan-240(whichputsthepipetotheleftofthescreen),resetthepositionofthepipetothefarright,bysettingpipeXbackto300.Then,changethecostumetothenextone.
6. Finally,setthexpositionofthepipetopipeX.Wenowhaveascrollingpipe!
![Page 77: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/77.jpg)
WorkingwiththemaincharacterNow,it’stimetomakeourmaincharacter!Thisspriteisgoingtoneedtwocostumes:onewiththewingsupandonewiththewingsdown.Luckily,Scratchalreadyincludescostumes,soyoudon’thavetodrawityourself(butfeelfreetodosoifyouwant!).
1. Ifyouhaven’tremovedScratchyyet,right-clickontheScratchyspriteiconintherightcolumn,andselectdelete.
2. Underthegamestage,you’llseetheChoosenewspritefromfileoption.Clickonthatoption.
3. Apopupwillbedisplayedshowingalistoffolders;choosethefolderAnimals.4. Formyexample,Ichoosebat1-aasshowninthefollowingscreenshot:
5. Double-clickonit,andyouwillseeitappearonyourstageandinthespritepanel.Selectit,andthenclickonCostumes.
6. Next,inNewcostume,selectImportandchoosebat1-b.Yourspritenowhasthecostumesthatitneedstolooklikeit’sflying.
7. Ifyoufeellikedrawingyourowncostumeforyoursprite,selectPaintinstead.
![Page 78: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/78.jpg)
Now,let’sworkonthescriptsforourbat!
Whenthegreenflagisclicked,setthescorevariableto0,switchtothecostumewiththebatwingsup,setthesizetobe10percentoftheoriginalspritesize,gotothetopmostlayer,andthenmovetothosexandypositions.Playaroundbychangingthesizeofyourbatandexperimentingwiththexandypositions.Changingthesewillaffectthedifficulty
![Page 79: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/79.jpg)
ofyourgame.
Now,weenterourforeverloop.Eachtimethisloopoccurs,wesetthespritetobethebatwithwingsup,andmoveitdownby1onthestage.Thisnextblockintroducesustouserinput.Itsaysthatifthespacekeyispressedonyourkeyboard,thenitshouldswitchtothebatwithwingsdownandmoveupthestageby5.Youcanchangethekeytobeanythingonyourkeyboard.Youcanalsochangethe5toincreaseordecreasetheheightatwhichthebatfliesperbuttonpress.
Thenexttwoifblocksfollowthesameformula.IfyourbatspritetouchesFloor1,Floor2,orthepipes,thenGameOverwillappearnexttothespriteandthegamewillstop.
Finally,ifthexpositionofthebatisequaltothevalueofpipeX,thenyoushouldchangethescoreby1,sinceitindicatesthatyouhavepassedthroughoneofthepipessuccessfully.
Now,tryoutyourgame!
![Page 80: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/80.jpg)
EnhancingthegameNowthatyouhavecreatedyourFlappyBirdclone,youshouldtrytoenhanceandmodifyit.Herearesomeideas:
AddamultiplayeroptionCreateagameoverscreenbymakinganewbackgroundandsettingittothescreenthatappearswhenyoutouchapipeMakeascrollingbackgroundTrymakingthepipesscrollfasterorappearatrandomtimes
Whenyouareready,wecanmoveontothenextgame.
![Page 81: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/81.jpg)
![Page 82: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/82.jpg)
PingPongIt’stimetogobackintime,andrecreateagamethathelpedtolaunchthevideogameindustry.IthasgonebymanynamessuchasPong,PingPong,andTableTennis,butthebasicgameplayhasstayedthesame.Twopaddles,oneball,andanepicbattletogettheballpasttheotherplayer.
So,let’sbreakdownthisgame.Wewillrequire:
OnepaddlefortheleftplayerOnepaddlefortherightplayerOnebouncingballTwovariablestokeepscoreforeachplayer.
Let’sgetstarted!
![Page 83: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/83.jpg)
MakingthepaddlesAftercreatinganewproject,youwillbepresentedwiththewhitestageandaScratchysprite.
1. Right-clickonScratchyandclickondelete.Now,clickonPaintnewsprite.
2. DrawalongblackrectangleandclickonOK.NamethisspriteLeft.
Wearegoingtocreatethreesimplescriptsforthispaddle,asfollows:
3. Thefirstscriptensuresthattheleftpaddlepointsintheproperdirectionandthensetsitssizeto60percent.Youshouldexperimentwiththesizetodeterminewhatfeels
![Page 84: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/84.jpg)
rightforyourgame.4. Thenexttwoscriptscontroltheverticalmovementoftheleftpaddle.Again,
experimentwiththeamountofmovementthateachbuttonpressdoestochangethedifficultyofyourgame.
5. Whenyouhavesettheseup,right-clickonyourleftpaddlespriteandclickonDuplicate.
6. RenamethenewspritetoRight.Wenowhavethebeginningformakingourrightpaddle.Youwillbemakingafewadjustments,sothatasecondplayerwillcontrolthepaddle.
Wechangethedirectioninwhichthepaddleispointingtoensurethatitfacestherightdirection.Youthenneedtochangethekeysthatyouwillbeusingforthesecondplayertomovethepaddleupanddown.Inthisexample,weusetheupanddownarrowkeys.
Onthestageitself,draganddropyourpaddlesintotheproperpositions.Theleftpaddleshouldbeontheleft-handsideofthestage,butnottouchingthewall,whiletherightpaddleshouldbeontheright-handside,whilealsoleavingagapbetweenthepaddleandthewall.
Whenyouhavemadeyourchoices,clickonthegreenflagbuttonandtestyourgame.Thepaddlesshouldbeabletomoveupanddown.
![Page 85: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/85.jpg)
FollowingthebouncingballNow,it’stimetocreatetheheartoftheprogram:theball!
Togetstarted,let’screateanewsprite:
1. Startbyimportingaspritefromthelibrary.Therearenumerousroundball-likecostumestochoosefrom.Whenyouarehappywithyourcostume,double-clickonit.RenameyournewspritetoBall.
2. Now,youwillneedtomaketwovariables.NamethemLeftScoreandRightScoreandsetthemtobeusedbyallsprites.
3. Whenthegreenflagisclicked,setthesizeoftheballto20percent,andsetbothleftscoreandrightscoreto0.
4. Movetheballtothecenterofthescreen,anduseanewblocktopointtheballinarandomdirection.Randomnumbersarelikepickinganumberoutofahat.Youdon’tknowwhichoneyouwillgetaheadoftime.Usingarandomblock,wecangiveScratchtwonumbers,asmallnumberandalargenumber,anditwillpickarandomnumberinbetweenthese.Bymakingtheballpointinarandomdirection,weaddtothechallengeandskilllevelofthegame.
5. Now,ontotheforeverblock.Eachtimeitloops,wewanttomovetheball5steps.We
![Page 86: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/86.jpg)
nowhaveanothernewblock,Ifonedge,bounce.Thisblocktellstheballthatifithastouchedtheouteredgesofthescreen,itshouldbounceawayfromit.
6. Wenowhavetwoifstatements.Thesecomeintoeffectiftheballtoucheseithertheleftortherightpaddle.Ifittoucheseither,wehavetheballpointintheoppositedirection,andthenpickarandomdirectiontomovein.
7. Thelasttwoifstatementsarethemostimportantones.Thesecheckwhethertheballhasgonebehindeitherofthepaddles.Ifithas,itawardsapointtotheotherpaddle,andmovestheballbackintothemiddleofthestage.Thegamethencontinues!
YounowhavethebeginningofyourPingPonggame!Wherecanyougofromhere?Hereareafewideas:
Addabackgroundthatrepresentsatennismatch.Havethegameendwhenonesidescoresenoughpoints.Havethecomputerplayasoneofthepaddles.
Therestisuptoyou!Havefunandexperiment!
![Page 87: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/87.jpg)
![Page 88: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/88.jpg)
SummaryInthischapter,youlearnedhowtostartScratch,createcharacters,design,andprogramtwofungames.YouhaveonlyscratchedthesurfaceofwhatispossiblewiththeScratchprogramminglanguage.
Whilemakinggamesisalotoffun,sometimesyoumightneedtoplaysomeforinspiration.Luckily,theRaspberryPihassomegreatgamesandemulatorsavailable.Thenextchapterwillintroduceyoutodistributionsmadejustforgaming.
![Page 89: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/89.jpg)
![Page 90: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/90.jpg)
Chapter3.RaspberryPiGamingOperatingSystemsTheRaspberryPi,whileapowerfullittledevice,isnothingwithoutsoftwaretorunonit.Settingupemulators,games,andanoperatingsystemcanbeadauntingtaskforthosewhoarenewtousingLinux.Luckily,therearedistributions(operatingsystemimages)thathandleallofthisforus.Inthischapter,wewilldemonstratethreedistributionsthathavebeenspeciallymadeforgaming.
Inthischapter,youwilllearn:
WheretodownloadmultiplegamingoperatingsystemsfromSimilaritiesanddifferencesbetweenPiPlay,RetroPie,andChameleonPiHowtoaccessRaspberryPi’ssharedfoldersonyourcomputerCopyinganduploadinggamefilestoyourRaspberryPi
![Page 91: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/91.jpg)
PiPlayPiPlayisanopensourcepremadedistributionthatcombinesnumerousemulators,games,andacustomfrontendthatservesastheGUIfortheRaspberryPi.Createdin2012,PiPlaystartedasPiMAME.Originally,PiMAMEwasaversionofRaspbianthatincludedtheAdvanceMAMEandAdvanceMENUfrontend.ThedistributionwassettoautologinandstartupAdvanceMENUatbootup.ThisprojectwasfoundedbecauseofthenumerousissuesuserswerefacingtogetMAMEtocompileandrunontheirowndevices.Asmoreandmoreemulatorswerereleased,PiMAMEbegantoincludethemintheimage,andchangeditsnametoPiPlay,asitwasn’tjustforarcadeemulationanymore.
Currently,PiPlaycontainsthefollowingemulatorsandgames:
AdvanceMAME(Arcade)MAME4ALL(Arcade)FinalBurnAlpha(CapcomandNeoGeo)PCSX_ReARMed(PlayStation)Dgen(Genesis)SNES9x(SuperNintendo)FCEUX(NES)Gearboy(Gameboy)GPSP(GameboyAdvance)ScummVM(point-and-clickgames)Stella(Atari2600)NXEngine(CaveStory)VICE(Commodore64)Mednafen(GameGear,NeoGeoPocketColor,SegaMasterSystem,TurboGrafx16/PC-Engine)
TodownloadthelatestversionofPiPlay,gotohttp://piplay.organdclickontheDownloadoption.FollowthedirectionsfromChapter1,GettingStartedwiththeRaspberryPi,toburnthePiPlayimagetoyourSDcard.Whenthisiscompleted,inserttheSDcardintoyourRaspberryPiandturniton.
Withinafewmoments,youshouldseeanimagelikethisonyourscreen:
![Page 92: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/92.jpg)
Onceit’sfinishedbooting,youwillbepresentedwiththePiPlaymenuscreen:
Here,youwillseeallthedifferentemulatorsandtoolsyouhaveavailable.PiPlayincludesanextensivecontrollersetuptool.BypressingTabkeyorbutton3onyourcontroller,apopupwindowwillappear.SelectControllerSetupandfollowtheonscreenguidetoproperlyconfigureyourcontroller:
![Page 93: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/93.jpg)
Atthemoment,thereisn’tmuchtodobecauseyouhaven’tloadedanygamesfortheemulators.TheeasiestwaytoloadyourgamefilesintoPiPlayistousethewebfrontend.IfyouconnectyourPitoyournetwork,anIPaddressshouldappearatthetoprightofyourscreen.AnotherwaytofindoutyourIPaddressisbyrunningthecommandifconfigonthecommandline.
Navigateyourcomputer’swebbrowsertothisaddress,andthePiPlayfrontendwillappear:
Here,youcanreboot,shutdown,anduploadnumerousfilestothePiviaadraganddropinterface.Simplyselecttheemulatoryouwanttouploadfilesto,findyourgamefile,anddragitontothebox.Inafewmoments,thefilewillbeuploaded.
![Page 94: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/94.jpg)
![Page 95: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/95.jpg)
![Page 96: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/96.jpg)
RetroPieRetroPieisaprojectbasedonLibretro,RetroArch,andEmulationStation.EmulationStationisanopensourcefrontendthatmakesiteasytomanageover30videogameconsolesandapplications,andyourassociatedgamefiles.Itincludesabuilt-injoysticksetuptoolandcanautomaticallydownloadassociatedmetadataforyourfiles.Thismetadataincludesitemssuchasboxartandgameinfo,whichgivesyourcollectionapolishedfinish.
Libretroisanotheropensourceproject.Itisdesignedtobringmultipleemulatorsintoonemainpackage.Insteadofhavingaseparateapplicationforeachsystem,Libretroturnstheseemulatorsintoacore,whichhooksintothelibrary.Byhavingacommonlibraryforeachemulatortohookinto,acohesiveeasy-to-useplatformiscreatedfortheuser.RetroArchisthemainfrontendfortheLibretrolibrary.
TheRetroPieprojectcombinesthebestoftheemulation,gaming,andfrontendsystemsintoaneasy-to-useplatformfortheRaspberryPi.
RetroPieincludesallofthesesystemsandconsoles:
Amiga(UAE4All)AppleII(LinApple)AppleMacintosh(BasiliskII)ArmstradCPC(CPC4RPi)Arcade(PiFBA,Mame4All-RPi)Atari800Atari2600(RetroArch)AtariST/STE/TT/FalconC64(VICE)CaveStory(NXEngine)Doom(RetroArch)DukeNukem3DFinalBurnAlpha(RetroArch)GameBoyAdvance(gpSP)GameBoyColor(RetroArch)GameGear(Osmose)Intellivision(RetroArch)MAME(RetroArch)MAME(AdvMAME)NeoGeo(GnGeo)NeoGeo(Genesis-GX,RetroArch)SegaMasterSystem(Osmose)SegaMegadrive/Genesis(DGEN,Picodrive)SegaMega-CD(Picodrive)Sega32X(Picodrive)NintendoEntertainmentSystem(RetroArch)
![Page 97: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/97.jpg)
N64(Mupen64Plus-RPi)PCEngine/TurboGrafx16(RetroArch)Playstation1(RetroArch)ScummVMSuperNintendoEntertainmentSystem(RetroArch,PiSNES,SNES-Rpi)SinclairZXSpectrum(Fuse)PC/x86(rpix86)ZMachineemulator(Frotz)
RetroPieishostedathttp://blog.petrockblock.com/retropie/.TheRetroPieforums,blog,andadditionalinformationarealsoavailablehere.OnceyouhavedownloadedtheSDcardimage,followtheinstructionsinChapter1,GettingStartedwiththeRaspberryPi,tomoveittoyourSDcard.AfewmomentsafterbootingupyourRaspberryPi,youshouldbepresentedwithascreensimilartothefollowing:
AftertheRaspberryPihasfinishedbootingup,youwillbepresentedwiththeEmulationStationsplashscreen:
![Page 98: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/98.jpg)
RetroPiealsosupportsnumerousjoysticksandcontrollers.WhenyoufirstrunEmulationStationanditdetectsagamecontroller,itwilllaunchasetupscreen.Thiswillallowyoutoconfigureyourcontrollerforthemenu.
Afteryourcontrollerisconfigured,youwillbeatthemenuscreen,whereyoucanselectyoursystemandgametobeplayed.
Whenyoufirstgettothemenu,youwillnoticethatithasfewoptionsavailable.ThisisbecauseEmulationStationdoesnotdisplayemulatorsthatdonothaveanygamefiles
![Page 99: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/99.jpg)
available.OnceyoucopyaROMover,thesystemwillappear.
Tosetupyourcontrollerforthegamesystems,youwillneedtoexitbackouttotheterminal.Thencompletethefollowingsteps:
1. Runsudochownpi/opt/retropie/configs/all/retroarch.cfg.2. Then,runcd/opt/retropie/emulators/RetroArch/installdir/bin.3. Finally,runsudo./retroarch-joyconfig-j0>>
/opt/retropie/configs/all/retroarch.cfg.4. Youwillthenbepromptedtopressyourcontrollerbuttons.5. Whenthisiscomplete,runsudoreboottorebootyourRaspberryPi.
Yourcontrollerwillnowbeconfigured.
RetroPiehastwowaystocopygamefilesontothePi.ThefirstisusingSAMBAshares.Theseareessentiallyfolderssharedoveryournetwork.ThefollowingstepswillexplainhowtouseSAMBAsharestocopygamefilesontothePi:
1. OnWindows,youcanaccessthefoldersbygoingtothenetworktab,orbyenteringtheIPaddressofyourPiintothefoldermenustartingwithtwobackslashes,forexample,\\192.168.0.63.
![Page 100: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/100.jpg)
2. Double-clickonroms,thenonthesystemyouwishtocopygamesto.
![Page 101: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/101.jpg)
3. Tocopyyourgamefiles,draganddropyourgamefilesintothefolder.
![Page 102: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/102.jpg)
4. OnOSX,selectGo,selectConnecttoServer,andentertheserver’sIPaddress,forexample,smb://192.168.0.63.
5. AfterclickingonConnect,youwillbeaskedtologinasRegisteredUserorasGuest.ChooseGuest.
![Page 103: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/103.jpg)
6. Then,clickonConnectagainanddouble-clickontheromsmenuchoice.Theromsfolderisnowsharedtoyourcomputer.YouwillnowhaveaccesstoallthegamefilefoldersforRetroPie:
7. Now,simplydraganddropyourgamefilestotheproperfolder,andgetreadytoplay!
ThesecondwayisviaUSBdrive.RetroPiekeepsaservicerunninginthebackgroundthatdetectswhenanewUSBdriveisinserted.Theservicechecksforromsandgamefilesonthedriveviafoldersmatchingthesystemnames.TheservicewillautomaticallycreatetheblankfoldersthefirsttimeyouinsertyourUSBdrive.Justcopyyourfilestothecorrectfolder,andtheywillbemovedtoyourSDcard.
![Page 104: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/104.jpg)
![Page 105: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/105.jpg)
ChameleonPiChameleonPiisanotherready-to-useRaspberryPidistributionthatfocusesontheemulationofoldercomputers.TheChameleonPiprojectwasoriginallyconceivedtobringolderandretrostylecomputerstotheRaspberryPidevice.TodownloadChameleonPivisit:
http://chameleon.enging.com/
ChameleonPiincludesthefollowingsystems:
ZXSpectrumCommodore64Oric-1OricAtmosAppleIIseriesZX81IBMPCAtari800Atari800XLAtari2600CommodoreVic-20Commodore128AmstradCPC464AtariSTGameboyNESSNESMegadrive/Genesis
AfterbootingupyourRaspberryPiwiththeChameleonPiimage,youshouldseethefollowingsplashscreen:
![Page 106: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/106.jpg)
Afterloading,theChameleonPithemainmenuwillbedisplayed:
ChameleonPioffersasimilarwaytogetgamefilesontotheSDcardasRetroPiedoes.ThefirstisviaSAMBAshares.ThebigdifferencebetweenthetwoisthatChameleonPi’spasswordprotectsthefolders.Bydefault,theusernameiszxandthepasswordisspectrum.Onceloggedin,youwillseealistoffoldersrepresentingeachsystem.
![Page 107: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/107.jpg)
TheotherwayisviatheUSBdrive.UnlikeRetroPie,wherethefilesarecopiedfromtheUSBdrivetotheSDcard,ChameleonPiusesyourUSBdriveasexternalstorage.Ifyouinsertafreshlyformatteddrive,ChameleonPiwillcreateafolderstructureforyourgames.CopyyourfilesintothecorrespondingfolderonyourUSBdrive,andtheninsertitintotheRaspberryPi.ThenexttimeyouuseChameleonPi,yourgamefileswillappear.
![Page 108: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/108.jpg)
![Page 109: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/109.jpg)
SummaryInthischapter,youhavebeenintroducedtothreedifferentgame-basedRaspberryPidistributions.Whileallthreesharealotincommon,theygoaboutimplementinggamingintheirownuniqueways.Tryallthree,andusetheonethatfitsyourgamingstylethebest.
Inthenextchapter,youwilllearnhowtoaccesstheRaspberryPiAppStoresowecanplaywithevenmoregames.
![Page 110: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/110.jpg)
![Page 111: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/111.jpg)
Chapter4.EmulatorsInthischapter,wewilldiveintoemulationontheRaspberryPi.Butwhatisemulation?Emulationistheactofduplicatingthefunctionalityofonesystemontoanother.ThismeansthatwecanmaketheRaspberryPipretendtobesomethingelse,suchasaSuperNintendo,oraCommodore64,oraSegaGenesis.Byutilizingdifferentemulationsoftware,ourRaspberryPicanbeallthesethingsandmore.
Youwilllearn:
HowtoinstallapplicationsusingtheRaspberryPiAppStoreHowtodownloadapplicationsfromtheInternetHowtoinstallprogramsfromtheRaspbianrepositories
Let’sstartwiththeRaspberryPiAppStore.
![Page 112: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/112.jpg)
RaspberryPiAppStoreItseemsthatagrowingtrendisforeachdevicetohaveitsownlittleecosystemforapplications.TheRaspberryPiisnodifferent,andeachcopyofRaspbianhasaccesstothePiStore.ThisAppStoreisforyoutodownloadgamesandapplicationsmadespecificallyfortheRaspberryPi.
![Page 113: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/113.jpg)
UsingtheAppStoreWewillnowlaunchtheAppStore,createanaccount,anddownloadsomeapplicationsusingthefollowingsteps:
1. Atthecommandline,enterstartxtostartthedesktopenvironment.2. Onthedesktop,double-clickonthePiStoreicon.3. ClickontheLogInlinkinthetop-rightcornerofthewindow.
4. Ifyoudon’thaveanaccountyet,createonenow,andthenloginwiththeemailaddressandpasswordyouusedtoregister.
5. Youcansearchforsoftwareusingthesearchbarorclickonacategorytobringupapplicationsandgamesspecifictothatarea.
6. ClickontheFreeDownloadand/orBuyNowbuttonwhenyouhavefoundaselectionyouwouldliketoaddtoyourlibrary.
7. Theselecteditemwillbedownloadedandautomaticallyinstalled.8. IntheMyLibrarytab,clickontheitemyouwanttorun,andthenclickonthe
Launchbutton.
![Page 114: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/114.jpg)
Anydevelopercansignupanduploadtheirgamestothestore.Pricingforgamesstartsatfreeofchargeandcangoupfromthere.Oncethegamehasbeenmadeavailableinthestore,anyuserwithanaccountcanpurchaseit.Allgamesandappsarestoredunderthe/usr/local/bin/indiecityfoldertoplaythemoffline.
Don’tworryaboutformattingyourSDcardandlosingyourgames.WhenyoulogintoyourPiStoreaccountyoucanre-downloadallyourpurchases.
![Page 115: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/115.jpg)
![Page 116: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/116.jpg)
EmulatorsTherearenumerousemulatorsavailablefortheRaspberryPi.SomeoftheseareavailablethroughtheAppStore,othersyouneedtodownloadfromawebsiteandmanuallyinstall,andthentherearesomewhichcanbeinstalledviaRaspbian’spackagemanager.
Emulatorsrecreatehowagameconsoleworks,buttheydon’temulatethegamesthemselves.Thatrequiresthegamedata.Whenwerefertogamefilesinthisbook,wearereferringtotheRead-OnlyMemory(ROM)thatavideogame’sdataisstoredon.Thesecanbecartridges,CDsandDVDs,floppydisks,andothertypesofmedia.Manyareavailableasfilesyoucandownload.Pleasebeawarethatcopyrightmaystillexistonthesefilesandthatnotallarefreelyavailable.
![Page 117: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/117.jpg)
MednafenMednafenisaprogramthatconsistsofmultiplesystememulators.ItcanemulatetheAtariLynx,NeoGeoPocketColor,WonderSwan,GameBoyColor,andtheTurboGrafx-16withgreatperformance.
InstallingMednafenfromtheterminaliseasy.Wewilluseapt-get,whichisthedefaultpackagemanagerforRaspbian.Theapt-getcommandmakesiteasytoinstallandupdatecommonLinuxutilitiesandprograms.
NoteBeforeusingapt-gettoinstallanapplication,youshouldrunsudoapt-getupdate.Thiswillkeepthelistofavailableapplicationsuptodate.
Let’sseehowtousetheapt-getcommand:
1. Inthecommandprompt,typesudoapt-getinstallmednafenandpressEnter.2. Theapt-getcommandwillnowsearchtherepositoriesfortheapplication,download
thepackage,andinstallitonyoursystem.Whenitiscompleted,typemednafenandpressEnter.Youwillbegreetedwithtextthatexplainshowtousetheprogram.
3. Thisversionisbestrununderthedesktop,sotypestartxinthecommandprompt,andpressEnter.
4. Youwillwanttobringuptheterminalappbydouble-clickingonLXTerminalfromthedesktop.Youwillalsoneedtosupplyagamefiletotestwith.
5. Fromtheterminal,typemednafen/path/to/gamenameandpressEnter,forexample,mednafen/home/pi/homebrew.zip.
6. Mednafenwillreadthegamefile,selectthecorrectsystem,andbringupthegamewindow.
YouarenowreadytoplaygamesusingMednafen.
![Page 118: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/118.jpg)
FCEUX(NES)FCEUXisanemulatordesignedtorungamesfortheNintendoEntertainmentSystem(NES).TheNESisarguablythemostpopularandwellknowngamingsysteminvideogamehistory.Releasedin1984,theNESintroducedsuchpopulartitlesasSuperMarioBros,TheLegendofZelda,MegaMan,andMetroid.Hundredsofgameswereproducedforthis8-bitsystem,manyofwhichcanbeplayedontheRaspberryPi.ThefollowingstepswillshowyouhowtouseFCEUXforrunningthegame:
1. WewillstartbydownloadingFCEUX.Typewgethttp://raspberrypigaming.com/files/fceux.zipintoyourterminal.
2. Next,typeunzipfceux.zipandpressEnter.Ifyougettheerrorsayingunzipnotfound,typesudoapt-get-yinstallunziptoinstalltheunzipprogram.
3. Thefilefceuxshouldnowbeinyourdirectory.Runtheemulatorbytyping./fceux/path/to/game/rom,forexample,./fceux/home/pi/smb.nes.
![Page 119: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/119.jpg)
PiSNES(SNES)PiSNESisaportoftheSNES9xprojectandisanemulatordesignedtorungamesfortheSuperNintendoEntertainmentSystem(SNES).TheSNESwasreleasedin1991,andfeatured16-bitgraphics,whichwasincredibleforitstime.ThegamesreleasedontheSNESarestillhighlysoughtafter;collectorsandplayersallaroundtheworldstillenjoygamessuchasFinalFantasy,StarFox,MegaManX,F-Zero,SuperMarioWorld,andhundredsofothergreatgames.Whatmakesthisemulationpossible,isthefactthatPiSNEStakesadvantageoftheRaspberryPi’sgraphicschip,andoffloadsmuchoftheprocessingtothat.
PiSNESisnotavailableinthePiStoreortherepositories,sowemustdownloaditfromtheprojecthomepage.Wewillbeusingwgettodownloadtheprojectfilesasfollows:
1. First,wewillcreateafolderforPiSNES.Typemkdirpisnesinaterminal.2. Now,enterintothepisnesdirectorywithcdpisnes.3. Now,typewgethttp://raspberrypigaming.com/files/pisnes.zip.Ifthat
doesn’twork,gotohttps://code.google.com/p/pisnes/forthelatestdownload.4. Unzipthefilebyrunningunzippisnes.zip.5. Placeyourgamefilesintheromsdirectory.6. Now,runPiSNESwith./snes9x.gui.7. Amenuwillappearwithyouravailablegames.Havefun!
![Page 120: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/120.jpg)
MAME4ALLMAME4ALLisaportoftheMAMEprojectfortheRaspberryPi.MAMEstandsforMultipleArcadeMachineEmulator,andasitsnameimplies,itiscapableofrunningalargenumberofarcadegames.
MAME4ALLisnotavailableinthePiStoreortherepositories,sowemustdownloaditfromtheprojecthomepage.Wewillbeusingwgettodownloadtheprojectfilesasfollows:
1. First,wewillcreateafolderforMAME4ALL.Typemkdirmame4allinaterminal.2. Now,enterintothemame4alldirectorywithcdmame4all.3. Next,typewgethttp://raspberrypigaming.com/files/mame4all_pi.zip.Ifthat
doesn’twork,gotohttps://code.google.com/p/mame4all-pi/forthelatestdownload.4. Unzipthefilebyrunningunzipmame4all_pi.zip.5. Placeyourgamefilesintheromsdirectory.6. Now,runMAME4ALLbytyping./mame.7. Amenuwillappearwithyouravailablegames.Havefun!
![Page 121: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/121.jpg)
FinalBurnAlphaFinalBurnAlphaisaprojectdesignedtoemulatemanyarcadegames,mostnotablythosethatrunontheNeoGeo,CapcomCPS-1,andCPS-2platforms.
FinalBurnAlphaisnotavailableinthePiStoreortherepositories,sowemustdownloaditfromtheprojecthomepage.Wewillbeusingwgettodownloadtheprojectfiles.
1. First,wewillcreateafolderforFinalBurnAlpha.Typemkdirfbainaterminal.2. Now,enterintothefbadirectorywithcdfba.3. Next,typewgethttp://raspberrypigaming.com/files/fba.zip.Ifthatdoesn’t
work,gotohttps://code.google.com/p/pifba/forthelatestdownload.4. Unzipthefilebyrunningunzipfba.zip.5. Placeyourgamefilesintheromsdirectory.6. Now,runFinalBurnAlphawith./fbacapex.7. Amenuwillappearwithyouravailablegames.Havefun!
![Page 122: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/122.jpg)
PCSX_ReARMedPCSX_ReARMedisaPlayStationemulatorfortheRaspberryPi.Ascrazyasthisseems,theRaspberryPicanplayPlayStationgames!ThereasonforthisisthattheRaspberryPihasaverypowerfulgraphicschipthatrunsOpenGLEScode.PCSX_ReARMedhasbeenwrittentotakeadvantageofOpenGLES,whichgivesusagreatemulator.
PCSX_ReARMedisavailableforfreeonthePiStore.Makeuseofthefollowingstepstodownloadit:
1. OnceyouareonthedesktopandloggedintothePiStore,clickontheGamestab.YoucanalsosearchforPCSX_Rearmed.
2. ClickonPlay/Downloadtobegintheinstallationprocess.
![Page 123: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/123.jpg)
3. Wheninstructed,pressanykeytofinishtheinstallation.4. Toruntheprogram,gotoMyLibrary,clickonpcsx_reARMed,andpressLaunch
intheright-handpanel.
![Page 124: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/124.jpg)
5. ClickonExecuteandthePCSX_ReARMedgamewindowwillappear.6. Youdon’tneedtoplaceyourgamesinanyspecificdirectoryforthisemulator.When
youselectLoadCDimage,youcanbrowsetheRaspberryPi’sfilesystemforyourgamefile.
![Page 125: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/125.jpg)
PicoDrive(Genesis/MegaDrive)PicoDriveisanemulatorthatrunsgamesmadefortheSegaGenesis(alsoknownastheMegaDriveinJapanandEurope).TheGenesisisa16-bitgamingconsolethatcameoutin1989.Itwasknownforitsmanygreatarcadeports,suchasAlteredBeastandMortalKombat,aswellasaseriesthathasspannednumerousreleasesandconsoles,SonicTheHedgehog.TodownloadPicoDrivegothroughthefollowingsteps:
1. Typewgethttp://raspberrypigaming.com/files/picodrive.tgzinyourterminal.
2. Next,typetarzxfvpicrodrive.tgzandpressEnter.Alonglistoffileswillstreamacrossthescreen.
3. Youshouldnowhaveadirectorycalledpicodrive.Enterthedirectorybytypingcdpicodrive.
4. Runtheemulatorbytyping./PicoDrive.ThePicoDrivemenushouldappearonyourscreen:
5. UsethemenuoptionLoadnewROM/ISO,whichwilltraverseyourRaspberryPi’sdirectoriesandselectyourROMfiletobeplayed.
![Page 126: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/126.jpg)
Stella(Atari2600)Now,forthegranddaddyofallgamingsystems,theAtari2600.Itwasreleasedin1977andusheredinthevideogamecraze.Forthefirsttime,populararcadegamescouldbebroughthome,newpropertiescouldbecreated,andawholenewmarketopenedup.FromarcadeportssuchasPacManandDonkeyKongtotheoriginalgamessuchasPitfall,andeveninfamousgamessuchasE.T.,theAtari2600hasaveryrichhistoryofgaming.StellaisanemulatorthataimstobringthisconsoletotheRaspberryPiusingthefollowingsteps:
1. Theinstallationissupersimple;justtypesudoapt-getinstallstellatoinstallStellaontheconsoleandpressEnter.
2. Afterafewmoments,apt-getshouldfinish,andStellawillbeinstalled.3. TorunStella,justtypestellaandpressEnter.
4. UsethearrowsandtabkeystonavigateyourPiforgamefiles.Then,highlighttheSelectbuttonandpressEnter.
![Page 127: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/127.jpg)
ControlsNowthatyouhaveinstalledsomeemulators,youwillwanttoknowhowtocontrolthegames.HereisacheatsheetforthedefaultkeysinPiSNES:
PiSNEScontrols Keyboard
Up Uparrow
Down Downarrow
Left Leftarrow
Right Rightarrow
A D
B C
X S
Y X
LeftBumper A
RightBumper F
Start Enter
Select Tab
Toquit Esc
ThefollowingtableisacheatsheetforthedefaultkeysinFinalBurnAlpha:
FinalBurnAlphacontrols Keyboard
Up Uparrow
Down Downarrow
Left Leftarrow
Right Rightarrow
Button1 Ctrl
Button2 Alt
Button3 Space
Button4 Shift
![Page 128: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/128.jpg)
Button5 Z
Button6 X
Start Enter
Coin Tab
Toquit Esc
BecausePiSNESandFinalBurnAlphawereportedtotheRaspberryPibythesameperson,theysharesimilarconfigurationfiles.Withintheirrespectivedirectories,youwillfindaconfigurationfilethatallowsyoutochangethecontrolscheme.PiSNESiscalledsnes9x.cfg,andFinalBurnAlphaiscalledfba2x.cfg.Thekeyboardsectionusesnumberstorepresenteachkey.Youcanfindthembyreadingtheoutputof/usr/include/SDL/SDL_keysym.h.
ThefollowingtableisacheatsheetforthedefaultkeysinMAME4ALL:
MAME4ALLControls Keyboard
Up Uparrow
Down Downarrow
Left Leftarrow
Right Rightarrow
Button1 Ctrl
Button2 Alt
Button3 Space
Button4 Shift
Button5 Z
Button6 X
Start 1
Coin 5
Toquit Esc
TochangethecontrolsinMAME4ALL,presstheTabkeytobringuptheconfigurationmenu.Thiswillallowyoutogloballymapthecontrolstoyourgamepad,keyboard,joystick,orindividualgames.
![Page 129: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/129.jpg)
ThePCSX_ReARMedcontrolscanbeseenandeditedwithinthecontrolsonthemainscreen.
PicoDrivecontrolscanbeeditedfromwithinthemainmenu.
![Page 130: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/130.jpg)
ThefollowingtableisacheatsheetforthedefaultkeysinStella:
Stella Keyboard
Up Uparrow
Down Downarrow
Left Leftarrow
Right Rightarrow
Reset F2
Selectgametype F1
Fire/Action SpaceorCtrl
Selectgame Enter
Toquit Esc
ToeditStella’scontrols,highlightandselectOptions,andthenclickonInputSettings.
![Page 131: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/131.jpg)
![Page 132: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/132.jpg)
![Page 133: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/133.jpg)
SummaryYoulearnedhoweasyitistousetheRaspberryPi’sPiStoreapplication,whichisincludedineverycopyofRaspbian.Fromsettingupyouraccount,topurchasingnewgames,thePiStoreisagreatresource.YoualsoinstalledsomeemulatorsonyourPiusingthevariousinstallationmethodsavailableinLinux,andplayedsomeclassicvideogames.
Inthenextchapter,wewillintroducestandalonegamesthathavebeenportedovertotheRaspberryPi.
![Page 134: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/134.jpg)
![Page 135: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/135.jpg)
Chapter5.PortedGamesNowthatwehaveplayedsomegamesviaanemulator,wearereadytoplaysomegamesthatwereportedtoworkontheRaspberryPi.Aportisapieceofsoftwarethatiscodedanddevelopedforaspecificenvironmentbuthasbeentransportedandrebuiltforadifferentone.Thiscommonlyoccurswithconsolegames.AgamewillbewrittenforaMicrosoftconsole,andthenportedovertoSony’sorNintendo’sconsole.ItalsohappenswhenaconsolegameisportedovertothePC.
Thischapterwillfocusonthosegamesthathavebeenreleasedforotherplatforms,andthenportedovertotheRaspberryPi.
Youwilllearnhowto:
InstallandplayCaveStoryInstallandplayDoomInstallandplayOpenArena,andcreateamultiplayerserverforitInstall,createyourownworld,andprogramscriptsforMinecraft
![Page 136: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/136.jpg)
CaveStoryCaveStoryisafreewareMetroid/Castlevaniastyleplatformer.ItisamassiveplatformadventurealongthelinesofMetroid,Castlevania,andTerraria.Withalongengrossingstoryline,ahardbutnotfrustratingdifficultylevel,andabeautifulsetting,thegameisperfecttositbackandloseafewhourswith.ItwasoriginallyreleasedonthePCforMicrosoftWindowsin2004.Overtheyears,ithasbeenportedtotheNintendoWii,DSi,3DS,MacOSX,andLinux.
TheRaspberryPiportispossiblebecausetheoriginalCaveStoryenginewasreverseengineeredandanewopensourceenginecalledNXEnginewascreated.
![Page 137: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/137.jpg)
InstallingandrunningInstallingCaveStoryisverysimple.Itcanbedonebyperformingthefollowingsteps:
1. First,weneedtodownloadCaveStory.Atthecommandline,typewgethttp://raspberrypigaming.com/files/cavestory.zip.Youcanalsofindthesourcecodeathttp://nxengine.sourceforge.net/andhttps://github.com/ssilverm/cavestory_rpi.
2. Next,rununzipcavestory.zip.Thefileswillbeextractedtoafoldercalledcavestory_rpi-master.
3. Enterthedirectorybytypingcdcavestory_rpi-master.4. Now,let’srunCaveStorybytyping./nx.
![Page 138: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/138.jpg)
ControlsHereisalistofthedefaultkeysinCaveStory:
Action Key
Left Leftarrow
Right Rightarrow
Up Uparrow
Down Downarrow
Jump Z
Fire X
Prevweapon A
Nextweapon S
Inventory Q
Map W
Quit Esc
Options F3
![Page 139: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/139.jpg)
![Page 140: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/140.jpg)
DoomWhenyouthinkofafirst-personshooter(FPS),moderngameslikeCallofDutyorHalomightcometomind,butbeforethesewasDoom.ThegreatgrandfatherofthemodernFPS,Doom,createdbyidSoftware,tookthePCgamingworldbystorm.Foritstime,Doomhadamazinggraphics,multiplayercapabilities,user-createdlevels,andintroducedtheconceptofshareware.Itincludedthefirstchapterofthegameforfree,butifyouwantedtofinishthestoryandbeatthegame,youwereaskedtopurchasethegame.Doommadehistory.WhenidSoftwareopensourcedtheDoomengine,playersanddevelopersquicklyscouredthecode.Theymadeupdates,patchedbugs,addednewfeatures,andmostimportantly,portedthegametomultiplesystems.
Doomisstillbeingdevelopedtoday.Ifwetakeadvantageofmoderncapabilitiesandmodern3Dgraphicscards,theoriginalgamecanbemadetolookbetter.ForRaspberryPi,wewillgofortheclassicstyle.
PrBoomisaLinuxportoftheDoomenginethatincludestheFreedoomcampaign.FreedoomisatotallynewsetoflevelstoplayintheDoomuniverse.
![Page 141: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/141.jpg)
InstallingandrunningWewillinstallPrBoomusingapt-get,asfollows:
1. Atthecommandline,typesudoapt-getinstallprboom.2. PressYwhenitaskstoinstall.3. Now,let’srunPrBoombytypingprboomandpressingEnter.
4. YouaregoingtobepresentedwiththeFreedoomcampaign.PressEntertobeginandthenchooseyourdifficultylevel.
TheawesomeDoomcommunityhascreatedhundredsofcampaigns.TheyarestoredinfilescalledWADs.Ifyouwanttochangethecampaign,downloadsomeWADfilestoyourRaspberryPiandrunPrBoomwiththecommandprboom–file/path/to/game.wad.
![Page 142: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/142.jpg)
ControlsHereisalistofthedefaultkeysinDoom:
Action Key
Turnleft Leftarrow
Turnright Rightarrow
Forward Uparrow
Back Downarrow
Action Space
Fire Ctrl
Changeweapon Press2through7
Menu Esc
![Page 143: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/143.jpg)
![Page 144: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/144.jpg)
OpenArenaWhatPrBoomistoDoom,OpenArenaistoQuake3Arena.Quake3ArenaisanotherinnovatoroftheFPSgenre.Ithelpedlaunchahugelycompetitivemultiplayerenvironmentaswellasaraceforabettergraphicscardtochurnoutmoreframespersecond.TheQuake3enginehasbeenusedforastaggeringnumberofgames.SinceidSoftwareopensourcedtheengine,itiscapableofrunningontheRaspberryPi.OpenArenaisaprojecttodevelopacompletelyfreeversionofQuake3Arena.Usingentirelynewsprites,3Dmodels,textures,andlevels,anyonecandownloadOpenArenatotheircomputerandplayforfree.
![Page 145: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/145.jpg)
InstallationOpenArenaisavailableontheRaspberryPiAppStore.MakeuseofthefollowingstepstoinstallOpenArena:
1. Fromthecommandline,enterstartxtolaunchthedesktopenvironment.2. Fromthedesktop,launchthePiStoreapplicationbydouble-clickingonthePiStore
icon.3. Atthetop-rightoftheapplication,therewillbealoginlink.Clickthelinkandlogin
withyourregisteredaccount.4. NavigatetoExplore|Games|Fighting.5. ClickontheOpenArenaresult.6. Attheapplicationinfopage,clickonthePlay/Downloadbuttonontheright-hand
sideofthescreen.7. OpenArenawillautomaticallybedownloadedandawindowwillappearshowing
theinstallationprogress.8. Pressanybuttontoclosethewindowonceithasfinishedinstalling.9. WhenyouclickonLaunchtoplaythegame,yourRaspberryPiwillrebootand
automaticallylaunchOpenArenaonthecommandline.
![Page 146: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/146.jpg)
SingleplayermatchForasingleplayercampaign,performthefollowingsteps:
1. FromtheOpenArenamainmenu,clickonSINGLEPLAYER.2. Selectoneofthemapiconsfromthelist.Theopponentsinthearenawillbelistedat
thebottom.3. Clickonfighttoloadthearenaandstartthematch.
![Page 147: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/147.jpg)
MultiplayermatchFPSarefunontheirownwithbots,buttoreallyenjoythefullexperience,youneedtoplaywithotherpeople.Sadly,theRaspberryPiversionisnotcompatiblewiththePCservers,somostofthemultiplayergamesyouseeonlinewillnotwork.Thegoodnewsisthatyoucancreateyourownserver!
RunningaserverTostartyourownserver,performthefollowingactions:
1. Fromthecommandline,changeintotheOpenArenadirectorybytypingcd/usr/local/bin/indiecity/InstalledApps/openarena/Full/.
2. Executetheoadedicatedscriptbyrunning./oadedicated.sh.3. AfterOpeningIPSocketappears,pressEnter.4. Inthecommandprompt,typemapoa_dm3andpressEnter.5. TheOpenArenadedicatedserverwillnowberunningonyourlocalnetwork.6. OtherPiusingOpenArenacannowconnecttoyourRaspberryPi’sIPaddress.
JoiningaserverTojoinaservercreatedbyanotheruser,performthefollowingactions:
1. FromtheOpenArenamainmenu,clickonMULTIPLAYER.2. Edityourplayernameandcustomizeyourcharacterasrequired.3. Clickonnext.4. OpenArenawillsearchforserversonyourlocalnetwork.5. Ifyourlocalgamedoesnotappear,clickonspecifyandentertheIPaddressofthe
serveryouwishtojoin.IftheserverisrunningonthesamePiyouwishtoplayon,youcanenter127.0.0.1(Thisiscalledaloopbackaddress.Itmeansconnectingtoitself).
![Page 148: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/148.jpg)
ControlsThefollowingisalistofthedefaultkeysinOpenArena:
Action Key
Strafeleft A
Straferight D
Forward W
Back S
Jump Space
Fire Leftmouseclick
Changeweapon Press1through9oruseyourmousewheel
Menu Esc
Aim Mouseclick
![Page 149: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/149.jpg)
![Page 150: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/150.jpg)
Minecraft:PiEditionMinecraftisasandbox-stylegamemadebythegamecompanyMojang.Becauseitisasandbox,thereisnorightorwrongwaytoplayit.Theconceptbehindthegameisthatyouexploreandbuildusingdifferentkindsofblocksinarandomlycreatedworld.IthasbeencomparedtoavirtualLEGOset.Ifyoucanthinkit,youcanbuilditinMinecraft.
ItwasoriginallydevelopedfortheWindowsPC,buthassincebeenportedtoOSX,iOS,Android,andvariousgameconsoles.MojangdevelopedandreleasedaporttotheRaspberryPiasafreedownload.
![Page 151: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/151.jpg)
InstallingandrunningIfyouarerunningthelatestversionofRaspbian,Minecraftisnowincludedbydefault.IfyouarerunninganolderversionofRaspbian,youcaninstallMinecraftusingapt-get,asfollows:
1. Atthecommandline,typesudoapt-getupdate.2. Then,typesudoapt-getinstallminecraft-pi.3. Fromthedesktop,double-clickontheMinecraftPiEditionicon,orfromadesktop
terminal,typeminecraft-piandpressEnter.
![Page 152: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/152.jpg)
CreatinganewMinecraftworldTocreateanewMinecraftworld,performthefollowingactions:
1. WithMinecraftrunning,clickonStartGame.2. SelectCreatenew.3. Afterafewmoments,youwillenterintoabrandnewMinecraftworldenvironment.
![Page 153: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/153.jpg)
UsingtheMinecraft:PiEditionApplicationProgrammingInterfaceNowthatyouhavecreatedyourMinecraftworld,youcanexplore,fightcreepers,createyourowncastle,andwhateverelseyourmindcanthinkof.TheRaspberryPiEditionincludessomethingextra—aprogramminginterface.YoucanusethePythonprogramminglanguagetohookintoMinecraftandeditthegameworldwithlinesofcode.
TousetheMinecraftAPI,performthefollowingactions:
1. StartthePythoninteractiveshellbyrunningpythonontheterminal.2. Youwillsee>>>,whichiswhereyouwillenterthePythoncommands.3. Enterthefollowingcommands:
frommcpiimportminecraft
frommcpiimportblock
mc=minecraft.Minecraft.create()
mc.postToChat("IamusingtheAPI!")
4. YoushouldnowseeIamusingtheAPImessageappearinyourMinecraftwindow.
5. Enterthefollowingcommands:
player=mc.player.getPos()
player
6. AnoutputsimilartoVec3(46.0,1.0,-14.0)shouldappear.7. Enterthenextcommand:
mc.setBlock(player.x+1,player.y,player.z,block.GOLD_BLOCK)
8. Agoldenblockshouldappeardirectlyinfrontofyou:
![Page 154: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/154.jpg)
TherearemanymorethingsyoucandowithbothPythonandtheMinecraftAPI.FromcreatingfunctionsthatwillbuildafortresstousingloopstostacktonsofTNTblocks,youcanprogramtheentireworld.
FormoreAPIdocumentation,visit:
http://www.stuffaboutcode.com/p/minecraft-api-reference.html
![Page 155: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/155.jpg)
MultiplayerMinecraftMinecraft:PiEditionisamultiplayergame.IfyouhaveotherpeoplerunningRaspberryPisonyournetwork,alltheyneedtodoisclickonJoinGameinthemainmenu,andallthecurrentlyrunningMinecraftworldswillbeavailableforthemtojoin.
![Page 156: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/156.jpg)
ControlsHereisalistofthedefaultkeysinMinecraft:
Action Key
Forward W
Left A
Down S
Right D
Inventory E
Jump Space
Fly/Fall Doublespace
Menu Esc
Placeblock Leftmouseclick
Removeblock Rightmouseclick
Selectquickinventory 1–9ormousewheel
![Page 157: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/157.jpg)
![Page 158: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/158.jpg)
SummaryInthischapter,youlearnedhowtodownloadandinstallsomegames,whichwereremadefortheRaspberryPi.Youlearnedhowtoinstallgamesviaapt-getlikePrBoom,downloadgamesfromtheInternetlikeCaveStory,setupamultiplayerserverforOpenArena,andprogramyourownMinecraftworld.
Inthenextchapter,wewilldiscussgamesmadejustforLinuxandtheRaspberryPi.
![Page 159: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/159.jpg)
![Page 160: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/160.jpg)
Chapter6.LinuxGamesSofar,wehavegoneoveremulationandportedgames.Whatwehaven’ttalkedaboutyet,isgamesthatweremadewithLinuxinmind.Thesearegamesthatweredesignedfor,andnativeto,theLinuxoperatingsystem.Usuallyfreeandopensource,theyaregamesthathavecommunitiesbuiltaroundthem,andwelcomeotherstosubmitcodebackintothegame.
ThischapterwillfocusonafewofthosefreeopensourcegamesavailableintheRaspbianrepository.
Inthischapter,youwilllearn:
Howtoinstall,run,andsetupanetworkserverforFreeCivHowtoinstallandplaySuperTux,aSuperMarioBros.cloneHowtoinstallandplayNjam,aPac-MancloneHowtoinstallandplayGalaga:Hyperspace,aGalaga/Galaxianclone
![Page 161: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/161.jpg)
FreeCivFreeCivisafree,opensource,turn-basedstrategygamethatisinfluencedbythelongrunningcivilizationseriesofgames.InFreeCiv,youtakeontheroleleadingyourchosencivilizationoutoftheStoneAgeandintotheSpaceAge.Youmustexplore,buildout,andresearchnewskillsandabilities,allwhiletryingtodefeattherivalcivilizationsthataredoingthesamething.FreeCivhasbeenindevelopmentforover18yearsandboastsalargecommunitywithyearsofinformationandresources.
FreeCivfeaturesvariousdifficultiesofAI,singleplayerandmultiplayercapabilities,randomlygeneratedmaps,rulefine-tuning,andtonsofotherthingstomakeeachgameatotallydifferentexperience.
![Page 162: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/162.jpg)
InstallingandrunningInstallingFreeCivisverysimple.Followthesesteps:
1. Atthecommandline,typesudoapt-getinstall-yfreeciv-client-gtk.ThiswillinstallFreeCiv,aswellastheFreeCivserver.
2. Oncetheinstallisfinished,makesureyouareonthedesktopenvironmentbytypingstartxandpressingEnter.
3. Onceyouareonthedesktop,clickonthemenubuttonatthebottom-leftandhighlightGames.Underthesubmenu,youwillseetheFreecivoption.Clickonit.
4. FreeCivshouldnowhavelaunchedandyouwillbepresentedwithafewoptions.
![Page 163: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/163.jpg)
5. SelectStartNewGameandyouwillbepresentedwiththegamesetupscreen.Here,youwillabletosetthegameoptions,choosetheamountofplayers,andpickwhichnationyouwillbeplayingas.
6. ClickonStarttobeginthegame.
![Page 164: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/164.jpg)
![Page 165: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/165.jpg)
HostingaFreeCivserverPlayingFreeCivagainsttheAIisagreatwaytolearnandgetgoodatthegame,butthegamereallyshineswhenyouincludeyourfriends(orsoontobeenemies).
TheRaspberryPiservesasagreatplatformtohostamultiplayerFreeCivgame.Justusethefollowingsteps:
1. Fromthedesktopmenu,selectGamesandthenclickonFreecivserver.Acommandwindowwillopenandautomaticallystartanewgame.
2. Now,loadFreeCiv,andclickonConnecttoNetworkGame.Yourgameservershouldappearinthelistofavailablegames.
3. Double-clickonthedesiredgametojoinit.
![Page 166: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/166.jpg)
4. Whenyouareready,clickonStartandthegamewillbegin!GoodLuck!
![Page 167: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/167.jpg)
![Page 168: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/168.jpg)
LearningthecontrolsFreeCivisacomplicatedgame,asyoucanseefromthecontrollistbelow.Yourmouseandmenuoptionswillusuallybeenough;sodon’tgetdiscouragedbythesheeramountofoptions.Mostoftheseyouwon’tneeduntilyougetthroughafewgames.ThesecontrolswereretrievedfromtheofficialFreeCivwebsite:
http://freeciv.wikia.com/wiki/Keyboard_Reference
Reports
Cities F4
Demographics F11
Economy F5
Mapview F1
Messages F9
Nations F3
Research F6
Spaceship F12
TopFiveCities F8
Units F2
WondersoftheWorld F7
General
CloseDialog/Abort Esc
EditWorklists Ctrl+l
EditorMode Ctrl+e
FindCity Ctrl+f
Gamemenu F10
QuitGame Ctrl+q
Revolution Shift+Ctrl+r
SaveGame Ctrl+s
TaxRates Ctrl+t
![Page 169: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/169.jpg)
ToggleFogofwar(inEditorMode) Ctrl+m
TurnDone Shift+return
Unitcommands
AutoExplore x
AutoSettler a
BuildAirport e
BuildCity b
BuildFortress F
BuildIrrigation i
BuildMine m
BuildRoads/Rails r
ChangeForesttoPlains i
ChangeForesttoSwamp m
ChangeJungletoForest m
ChangeJungletoGrassland i
CleanNuclearFallout n
CleanPollution p
ConnectRail/Road R
ConnectIrrigation I
Diplomat/SpyActions d
DisbandUnit D
Done Space
ExplodeNuke N
Fortifyunit(s) f
Goto g
GotoBuildCity B
Go/AirlifttoCity t
![Page 170: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/170.jpg)
LoadTransporter l
MakeHomecity h
Patrol q
ReturntonearestCity G
SelectUnitsofthesametype v
SelectUnitsofthesametypeonthesametile V
SentryUnit(s) s
TransformTerrain o
Unload u
UnloadTransporter T
UpgradeUnit U
Wait w
Wakeupothers Shift+w
Viewcommands
CenterViewonUnit c
CityGrowth Ctrl+r
CityNames Ctrl+n
CityOutlines Ctrl+y
CityProduction Ctrl+p
CityTraderoutes Ctrl+d
CityWorkerOutput Ctrl+w
FullScreenMode Alt+Enter
MapGrid Ctrl+g
NationalBorders Ctrl+b
![Page 171: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/171.jpg)
![Page 172: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/172.jpg)
SuperTuxSuperTuxisanotherfreeandopensourceLinuxgame.BeingreminiscentoftheSuperMarioBros.series,itisaside-scrollingactiongame,wherethegoalofthegameistorescuePennybygettingfromoneendoftheleveltotheother,whilekillingoravoidingenemies,andcollectingpower-ups.SuperTuxincludes26levels,butthereisalsoaleveleditoravailable,soyoucanmakeyourownstages.
![Page 173: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/173.jpg)
InstallingandrunningSuperTuxisincludedintheRaspbiansoftwarerepositories,andcanbeplayedontheterminalordesktopenvironmentusingthefollowingsteps:
1. Atthecommandline,typesudoapt-getinstall-ysupertux.2. Torunthegame,typesupertuxandpressEnter.Thegameshouldnowfillyour
entirescreen.
3. UsetheupanddownarrowkeystoselectStartGame,thenpressEntertobeginplayingSuperTux.
![Page 174: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/174.jpg)
LearningthecontrolsHereisalistofthekeysthatyouwouldrequireinthegame:
Action Keyboard
Left Leftarrow
Right Rightarrow
Activate/Enter Uparrow
Duck Downarrow
Jump Space
Useability Leftcontrol
Menu Esc
![Page 175: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/175.jpg)
![Page 176: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/176.jpg)
NjamNjamisalsoafreeopensourcegamebasedonclassicmazegameslikePac-Man.Thegoalofthegameistoeatallthedotswhileavoidingtheobstacles.Ifyoueatoneofthepower-ups,yougaininvincibilityforashortperiodoftime.Njamincludesanarrayoflevels,leveleditors,andmultiplayercapabilities.
![Page 177: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/177.jpg)
InstallingandrunningNjamisavailableintheRaspbiansoftwarerepositories,andcanbeplayedontheterminalordesktopenvironmentusingthefollowingsteps:
1. Atthecommandline,typesudoapt-getinstall-ynjam.2. Torunthegame,typenjamandpressEnter.Thegameshouldnowfillyourentire
screen.
3. Njamoffersasingle-playergame,two-playercooperativemode,two-playerduelmode,anda4-playernetworkgame.Toplayalocalgame,justselectOneplayergameorTwoplayergame.Youwillthenselectamapandstartplaying.
4. Playinganetworkgameiseasyaswell.Ifyouarehostingthegame,justselectHostnetworkduel.TheotherplayerswillneedtoselectJoinnetworkduelfromtheircopiesofNjam,andenterinyourIPaddress.Onceeveryonehasreadiedup,pressthespacebartostartthegame.
![Page 178: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/178.jpg)
![Page 179: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/179.jpg)
LearningthecontrolsHereisalistofkeysthatyouwouldrequireinthegame:
Action Keyboard
Up Uparrow
Down Downarrow
Left Leftarrow
Right Rightarrow
Exit Esc
![Page 180: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/180.jpg)
![Page 181: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/181.jpg)
Galaga:HyperspaceGalaga:Hyperspaceisagamebasedonclassicshoot‘emupgameslikeGalagaandGalaxian.Thegoalofthegameistodestroyeachwaveofalienswhileavoidingthebulletstheyhurlyourway.Eachwavegetsmoreandmoredifficult,andyoucanonlygethitoncebeforelosingalife.
![Page 182: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/182.jpg)
InstallingandrunningGalaga:HyperspaceisavailableintheRaspbiansoftwarerepositories,andcanonlybeplayedonthedesktopenvironmentusingthefollowingsteps:
1. Atthecommandline,typesudoapt-getinstall-yxgalaga.2. Torunthegame,makesureyouareonthedesktopenvironmentbytypingstartx
andthenpressingEnter.3. Onceyouareonthedesktop,clickonthemenubuttonatthebottom-leftand
highlightGames.Underthesubmenu,Galagawillbeanoption.Clickonittostartthegame.
![Page 183: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/183.jpg)
LearningthecontrolsHereisalistofthekeysthatyouwouldrequireinthegame:
Action Keyboard
Left Leftarrow
Right Rightarrow
StartGamewithkeyboardcontrols K
StartGamewithmousecontrols M
QuitGalaga:Hyperspace Q
Quitcurrentgame q
![Page 184: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/184.jpg)
![Page 185: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/185.jpg)
FindinggamesviatherepositoriesThegamesmentionedabovearejustthetipoftheicebergwhenitcomestoLinuxgaming.TheRaspbianrepositoriesincludeatonofpackages,andthereareafewcommandsyoushouldknowinordertosearchthroughit.
Theapt-cachesearchkeywordcommandwillsearchthereposforthekeywordyouspecify,anddisplayalistofresultsinthecommandterminal.Forexample:apt-cachesearchgamewilldisplaypagesofresults.Youcanthenwhittledowntheresultsbyspecifyingmultiplekeywords.Let’ssaywewanttofindaPac-Manclone:apt-cachesearchpacmanwillreturnalistofgamesthatincludePac-Maninthedescription.Theapt-cachesearchpacmanconsolecommandwillfurtherrefinethesearchandwillreturnoneresultthatmatchesyourquery,pacman4console.
![Page 186: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/186.jpg)
![Page 187: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/187.jpg)
SummaryInthischapter,youlearnedaboutgamesthatweremadespecificallyforLinuxandthatrunonRaspberryPi.Therearedozensmoregamesavailableintherepositoriesthatyoucaninstallandtryout.Fromroguelikestoarcaderemakes,thereposholdhoursoffun.
Inthenextchapter,wewilldiscussthevariousinputmethodsavailablefortheRaspberryPi,includingarcadesticks,Bluetoothcontrollers,andgamingconsoledevices.
![Page 188: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/188.jpg)
![Page 189: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/189.jpg)
Chapter7.ControllersInthischapter,wewillgothroughmanyofthetypesofgaminginputdevicesthatwecanconnecttoourRaspberryPi.Fromfightsticks(orjoysticks),gamepads,consolecontrollers,tobuildingyourown,thereareallsortsofoptionsavailable.
Inthischapter,youwilllearnhowto:
EnableBluetoothconnectivitySetupXboxandPlayStationcontrollersUseaUSBencoderUsetheGPIOpinstobuildyourowncontrollerTroubleshootproblemcontrollers
![Page 190: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/190.jpg)
ControllersontheRaspberryPiBeforewebegin,youwillwanttoinstallthejoystickpackagetoyourdevice.Typesudoapt-get–yinstalljoystickatthecommandlineandpressEnter.Thejoystickpackageincludesanapplicationcalledjstest,whichwillhelpyouidentifyandtroubleshootyourcontrollers.
WhenacontrollerisconnectedandrecognizedbytheRaspberryPi,anewentrywillbemadeinthe/dev/input/folder.Thisfoldercontainsalistofallconnectedinputdevices.Youshouldseefileslikeevent0,mouse0,andkb0dependingonwhathasbeenconnected.Whenyourcontrollerisconnected,youshouldseeanewitemcalledjs0.The0attheendoftheitemindicatestheorderinwhichitwasconnected.Youcanhavemultipleitemsconnected,andtheywilleachgetanincreasingnumber.
![Page 191: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/191.jpg)
GamepadsGamepadsareoneofthesimplesttypesofcontrollersfortheRaspberryPi.Theycancomeindifferentshapes,sizes,andcanhavedifferentcombinationsofbuttons.Thesetypesofcontrollersareusuallymodeledafterpopularconsoles,andmadetolooklikeNES,SNES,Genesis,orPlayStationgamepads.Themajoradvantageoftheseisthattheyarecompact,handheld,andveryportable.
AslongasthegamepadisconnectedviaUSB,itwillbePlugandPlayontheRaspberryPi.
![Page 192: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/192.jpg)
ArcadesticksArcadesticks,alsoknownasfightsticks,areaverypopularchoicetoconnecttothePi.Fightstickscomeinhundredsofvariations,andcanbecustom-built,custom-configured,upgraded,andmodified.Inalllikelihood,youwon’tfindtwoprofightsticksthatare100percentthesame.
Thereasonbehindthis,isthateachpersonhastheirownpreferencewhenitcomestobuttons,joysticks,andencoders.SomepeopleprefertheAmericanstyleHappbuttons,whileothersswearbytheSanwaJapanesestylebuttons.Therearethosewhopreferballtopjoystickswhileothersusebatstylejoysticks.
Thegreatpartaboutthis,isthatthebuttonsizesandjoysticksaregenerallyinterchangeable.Buttonscanbeswappedaround,andjoystickscommonlyusetwodifferentscrewvariations.
Justlikegamepads,ArcadesticksconnecteasilytotheUSBportofaRaspberryPiandshouldbejustPlugandPlay.
![Page 193: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/193.jpg)
Xbox360controllersXbox360controllerscomeintwovarieties:wiredandwireless.WiredXbox360controllersarePlugandPlayinthelatestversionofRaspbian.
Whenyoupluginyourcontroller,theguidelightswillblinkonandoffrepeatedly.IfyouwishtohaveitfunctionlikeanactualXboxcontroller,whereonlythesingle-playerguidelightisactivated,youwillneedtouseafreeopensourceprogramcalledxboxdrv.Xboxdrvallowsyoutocustomizebuttons,activateacontroller,andusethewirelessUSBadapterforXbox360controllers.Followthegivenstepstoinstallxboxdrv:
1. Typesudoapt-get–yinstallxboxdrvonthecommandlineandpressEnter.2. Totestwhetheritworks,pluginyourXboxcontroller,typesudoxboxdrv--
kernel-detach-driverandpressEnter.3. Thelightsonthecontrollershouldstopblinkingandbereplacedwithonesolidlight.4. Pressinganybuttonwillcauseyourscreentolistthecurrentstatusofeachbutton.5. PressCtrl+Ctoclosexboxdrv.
![Page 194: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/194.jpg)
Tousexboxdrvnormally,typesudoxboxdrv--kernel-detach-driver--silent&andpressEnter.Thiswillactivatexboxdrv,suppressthescreenoutputwheneverabuttonispressed,andlaunchitinthebackground,soyoucanstilluseyourPiforotherthings.Justrunthroughthefollowingsteps:
1. Toactivatexboxdrvatlogin,typenano~/.profile.2. Usethearrowkeystogototheendofthefile.3. Typesudoxboxdrv--kernel-detach-driver--silent&.4. PressCtrl+XandthenpressYtosavethefile.5. Now,whenyoulogintoyourPi,xboxdrvwillautomaticallylaunchandsetupyour
Xboxcontroller.
IfyouwanttorunmultipleXboxcontrollersonthesamePi,youwillneedtolaunchanotherinstanceofxboxdrv.
![Page 195: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/195.jpg)
SonyDualShock3controllersSonyDualShock3controllersareveryneat.TheycanbeconnectedtotheRaspberryPiviaUSBorBluetooth,andhavemotionsensorsthatarereadasdifferentaxes.TheDualShock3isPlugandPlaycompatiblewithRaspbian,whenusingtheUSBcable.
SimplyhookupaMicroUSBcableendtothecontroller,andastandardUSBcableendtothePiandyouwillbereadytogo.ThePiwillalsochargethecontroller’sinternalbattery.Ifyouareusingmorethanonecontroller,oryouexperienceoddbehavior,switchtoapoweredUSBhub.
SettingitupforBluetoothconnectivityrequiresthatyouperformthefollowingsteps:
1. First,ensurethatyouhaveaRaspberryPicompatibleBluetoothdongle.Mostinexpensivedongleswillwork,butalistofworkingproductsisavailableathttp://elinux.org/RPi_USB_Bluetooth_adapters.
2. Typesudoapt-get-yinstallbluez-utilsbluez-compatbluez-hcidumplibusb-devlibbluetooth-dev.Thisinstallwilltakeafewminutes.
3. Aftertheinstallisfinished,typehciconfigandmakesureyourBluetoothdongleislisted.
![Page 196: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/196.jpg)
4. Now,youwillneedtodownload,compile,andinstallsixad.Downloadsixadbytypingwgethttp://sourceforge.net/projects/qtsixa/files/QtSixA%201.5.1/QtSixA-
1.5.1-src.tar.gz.Ifthepageisunavailablehere,itisalsolocatedathttp://raspberrypigaming.com/files/QtSixA-1.5.1-src.tar.gz.
5. Now,typetarzxfvQtSixA-1.5.1-src.tar.gzandpressEnter.Thiswillextractthecontents.
6. ChangetothenewlycreateddirectorybytypingcdQtSixA-1.5.1-src/sixad.7. Now,typemakeandpressEnter.Thiswillturnthesourcecodeintoacomputer
program(compiling)andwilltakeafewminutes.8. Next,typesudomakeinstallandpressEnter.Thisinstallssixadintotheproper
locations,andallowsyoutoruntheprogrambytypingsixadwithoutbeinginacertainfolder.
9. Now,typesixad--startandpressEnter.10. WhenpromptedtopressthePSkeyonyourcontroller,pressit.Youshouldseea
messageindicatingaconnectiontoyourDualShock.
11. PressCtrl+Ctoexit.Yourcontrollerwillstillbepaired.
Topaircontrollersatbootup,youwillneedtoaddthesixadprogramtoyourprofile.Makeuseofthefollowingsteps:
1. Typenano~/.profileatthecommandline.2. Usethearrowkeystogototheendofthefile.3. Typesixad--start&.4. PressCtrl+X,thenpressYtosavethefile.5. Now,whenyoulogintoyourPi,sixadwillautomaticallylaunchandasktopairwith
yourcontroller.
![Page 197: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/197.jpg)
USBencodersAttheheartofeveryArcadestickisaUSBencoder.IttakestheactionofhittingabuttonandturnsitintoaninputforyourRaspberryPi.Someencodersemulateakeyboard,whileothersactasanactualjoystick.Usinganencoder,youcanveryeasilybuildyourowncustomizedcontroller.
Therearehundredsofdifferentencodersoutthere,butthemostcommononesarecalledtheNoDelay,ZeroDelay,andXinMoboard.Alloftheseboardsactasajoystick,andareverysimpletowireup.
![Page 198: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/198.jpg)
ThisisanexampleofaNoDelayUSBjoystickencoderboard.The8buttonsarewireduptothebuttonpinsonthebottomoftheboard.Eachbuttonhasacommonandgroundpin.Whenthebuttonispusheddown,theconnectioniscompleted,sendingthesignaltotheboard.Thejoystickusesthe4slotsatthetopoftheboardforup,down,left,andrightmovements.Theboardcanalsoacceptjoysticksthatonlyuse5pins.Thosearecommonwithballtopsticks.TheboardincludesaUSBcablethatplugsintothepinsonthefar-leftoftheboard.
![Page 199: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/199.jpg)
GPIOpinsTheRaspberryPiincludespinscalledGPIOthatcanbeconnecteddirectlytoafewbuttonsandajoystick,similartotheencoderboardswesawpreviously.
GPIOlayoutbyraspberrypi.org
TheprecedinglayoutisofModelAandModelB.ModelA+andB+includeevenmorepinsbutarebackwardscompatiblewiththeAandBpinlayout.Thepinsweareinterestedinaretheyellowandblack-labeledpins.Theotherpins—1,3,4,and17arepowerpins.Becausethebuttonsdon’trequirepower,wecansafelyignorethese.Allofyourbuttons’groundwiresshouldconnecttoacommongroundpin.TheotherwiresshouldindividuallybeconnectedtoanindependentyellowGPIOpin.
Whilepin8and10looklikeproperGPIOpins,theyareactuallyserialports,soyoushouldavoidusingthem.
Onceyouhaveconnectedthewires,youwillneedtoinstallanapplicationthatwillreadfromtheGPIOpinsandoutputakeyboardcommand.
Adafruit(http://www.adafruit.com/)hasreleasedautilitycalledRetrogamethatdoesjustthis.ItisasmallCprogramthatyoucanedit,thenbuild,andruntoreadinputfromyourGPIO.
Bydefault,Retrogamehassetthefollowingcontrolstothesepins:
Controls Pins
Left 2
Right 3
Down 4
Up 17
Z 27
![Page 200: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/200.jpg)
X 22
R 23
Q 18
InstallingandbuildingToinstallRetrogamemakeuseofthefollowingsteps:
1. DownloadRetrogamebytypinggitclonehttps://github.com/adafruit/Adafruit-Retrogame.gitandpressEnter.
2. ChangetothenewdirectorybytypingcdAdafruit-Retrogame.Ifyouneedtomakechangestothepinnumbersorkeys,typenanoretrogame.candscrolltoaroundline75.Youwillseealinesayingstarthere.EditthepinnumbersandKEY_commands,asinstructed.
3. BuildRetrogamebytypingmakeretrogameandpressEnter.4. Whenithasfinishedbuilding,typesudo./retrogametotestyourGPIOenabled
buttons.
Torunitatbootup,Adafruitrecommendsthatyouaddittoyourrc.localfile,asfollows:
1. Typesudonano/etc/rc.localandpressEnter.2. Gototheverylastlinebeforeexit0.Ourentryneedstobemadebeforethis.3. Typethepathtoyourretrogameapplication,forexample,/home/pi/Adafruit-
Retrogame/retrogame&.4. PressCtrl+XandthenYtosavethefile.5. Youwillnowhavetoaddaudevrule,sothatotherapplicationscanseethenew
buttons.Udevisessentiallyadevicemanager.Settinguptheruleswillletotherapplicationsknowhowtouseyourdevice.
6. Typesudonano/etc/udev/rules.d/10-retrogame.rulesandpressEnter.7. Then,typeSUBSYSTEM=="input",ATTRS{name}=="retrogame",
ENV{ID_INPUT_KEYBOARD}="1"
8. PressCtrl+X,thenYtosaveyournewudevrules.9. Now,restartyourRaspberryPi,andyourGPIOcontrollerwillbeready.
![Page 201: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/201.jpg)
![Page 202: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/202.jpg)
TroubleshootingcontrollersThereareafewcommonproblemsthatcancropupwhenusingdifferenttypesofcontrollersonyourPi.Themostcommonone,isthatyoujustcan’tseemtogetyourgametorecognizeanyinput.Yourfirststepshouldbetocheck/dev/inputandensurethatthereisajsX(wherexisthejoysticknumber)fileinthedirectory.
IfyouseeyourjsXfile,typejstest/dev/input/jsX.Youshouldnowbeabletopressthebuttonsonyourcontrollerandseethedifferentinput.
Ifyoudon’tseeanythinginhere,disconnectyourcontroller,thenplugitbackinandrundmesg.Youshouldseesometextscrollbyreallyquickly.Theverylastlinesshouldshowthatyouhavepluggedinyourjoystick.
Ifyoudon’tseeyourcontrollerindmesg,tryusingapoweredUSBhub.Yourcontrollermightneedextrapower.
Whenrunninghciconfig,ifnothingappears,itmightbebecauseyourUSBBluetoothdongleisn’tgettingenoughpower.TryconnectingittoapoweredUSBhubandseeifthis
![Page 203: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/203.jpg)
fixestheissue.Ifnot,yourBluetoothdonglemightnotbesupported.
![Page 204: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/204.jpg)
![Page 205: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/205.jpg)
SummaryYouhavenowlearnedaboutdifferentgamepadsandjoysticks.Youhavelearnedhowtobuildyourown,andhowtoconnectthemdirectlytotheRaspberryPihardware.YoualsoknowhowtoconnectnonstandardcontrollerssuchastheXboxandDualShock3.YoucannowtroubleshootyourcontrollersandyouhavelearnedmoreabouttheinnerworkingsofRaspbianandLinux.
Inthenextchapter,wewillgooversomegeneraltroubleshootingtipsfortheRaspberryPi.
![Page 206: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/206.jpg)
![Page 207: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/207.jpg)
Chapter8.TroubleshootingSofar,welearnedhowtomakeourowngame,installnumerousemulatorsandvideogames,hookupperipherals,connectjoysticks,andusethehardwarepins.However,whathappenswhensomethinggoeswrong?ThischapterwillguideyouthroughsomeofthecommonissuesyoumightfacewithaRaspberryPi.
![Page 208: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/208.jpg)
Usingraspi-configTheraspi-configtoolisabasicutilitythatisincludedineachcopyofRaspbian.Itisamenu-basedGUIthatenablesyoutoeasilymodifyyourRaspberryPisettings.
Torunraspi-config,typesudoraspi-configonthecommandline.
Theraspi-configtooloffersthefollowingoptions:
Expandfilesystem:ThisoptionwillresizetheOStousealloftheavailableSDcardspace.Changeuserpassword:ThiswillpromptyouforanewpasswordfortheuserPi.Enableboottodesktop/Scratch:Thisallowsyoutoswitchbetweenbootingtothecommandprompt,Scratch,orthedesktop.Internationalizationoptions:Thisoptionallowsyoutochangeyourtimezoneandyourkeyboardlayout.Enablecamera:IfyouhavetheRaspberryPicameramodule,checkthistoyes.AddtoRastrack:ThisoptionenablesotherpeopletoknowyourPi’slocation.Overclock:YoucanchangeyourRaspberryPi’sspeedhere.Advancedoptions:
Therearemanyadvancedoptionsinraspi-configwhichareexplainedasfollows:
Overscan:Ifyouseeblackbarsonyourmonitor,oryourscreenmightbealittleoff;useoverscantocorrectit.Hostname:ThissetsyourRaspberryPi’snetworkname(Default:raspberrypi).Memorysplit:ThischangesthememoryavailabletotheGPU,whileleavingtheresttoyourapplications.Theminimumis16MB.
NoteIfyouhaveModelAorA+themaximumsplitcanbe192MB,andonModelBorB+,youcangoto448MB.Iwouldn’trecommendgoinghigherthan128MB,asyouwanttodevoteenoughRAMtoLinux.
SSH:ThisoptionallowsyoutoremotelyconnecttoyourRaspberryPi.SPI:ThisenablesautoloadingoftheSPImodule.Yourhardwareshouldletyouknowifyouneedthis.I2C:ThisenablesautoloadingoftheI2Cmodule.Serial:Thisoptionenablesanddisablesdatagoingtotheserialpins.Audio:Thiswillsetwhereaudioisoutputfrom;HDMIoraudiojack.Update:Thiswillupdateraspi-configtothelatestversion.
![Page 209: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/209.jpg)
![Page 210: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/210.jpg)
CommontroubleshootingHerearesomeofthecommonerrorsandthemeanstotroubleshootthem:
![Page 211: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/211.jpg)
EmulationStationreturnsanerrorwhenItrytolaunchitInsuchasituation,runsudoapt-get-yinstalllibsdl1.2-devlibboost-filesystem-devlibfreeimage-devlibfreetype6-devlibsdl-mixer1.2-devttf-
dejavu.
ThiswillinstalltherequireddependenciesthattheEmulationStationrequirestorun.
EmulationStation,aswellasothergames,mightrequiredependenciesthathavenotbeenloadedduringtheinstall.Forexample,libsdl1.2-dev,libboost-filesystem-dev,libfreeimage-dev,libfreetype6-dev,libsdl-mixer1.2-dev,andttf-dejavuarecommonlibrariesthatareusedinanumberofgamesthatmightnothavebeeninstalled,orneedtobeupdated.
![Page 212: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/212.jpg)
NothinghappenswhenIapplypowerInthisparticularinstance,tryoutthefollowingthings:
Makesurethepowersupplyisratedfor5Vwithatleast1A(1000mA).Itwouldhelpifyoucangetupto2.1A(2100mA).Checkwhetherthepowerlightsareilluminatedontheboard.EnsurethatthemonitorisonandpluggedintotheRaspberryPi.CheckthattheSDcardisformattedproperly.
Mostofthetime,aRaspberryPiwillfailtoboot,orexperienceproblemsduringuse,becauseofaninadequatepowersupply.ManyMicroUSBchargersaremanufacturedwithminimalqualityassurance,soifyoudoexperienceissues,thefirstthingtodowouldbetotryadifferentbrandofcharger.MostbrandedcellphonechargerswillproperlypoweraRaspberryPi.
Ifthisdoesn’tfixtheissue,thenextstepistotestouttheSDcard.AproperlyformattedSDcardwillhaveasmallbootdrivethatisreadablebyWindows,MacOSX,andLinuxoperatingsystems.Ifyoucannotseethebootdrive,oranyfilesinsideit,thenitismostlikelythatyourSDcardhasn’tbeenproperlyimaged.
YoucanalsotryusingtheNOOBSsoftwarethattheRaspberryPiFoundationoffers.ThisisasetoffilesthatyoucandraganddroptoanyfreshlyformattedSDcard.WhenyoubootuptheRaspberryPiwiththatSDcard,itwillattempttoinstallanoperatingsystemontoitself.TogettheNOOBSpackage,visit:
http://www.raspberrypi.org/downloads/
FormoreinformationonusingNOOBScheckout:
http://www.raspberrypi.org/introducing-noobs/
![Page 213: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/213.jpg)
SomeofthegamesseemslowYoucanoverclockyourRaspberryPitoekeoutextraperformanceandspeed.
Warning:overclockingcancorruptyourSDcard,requiringyoutoreloadRaspbianonit.IfyourRaspberryPiseemstobeunresponsive,rebootandholddowntheShiftkeytotemporarilyresettheoverclocksettings.GothroughthefollowingstepstooverclockyourRaspberryPi:
1. Runsudoraspi-configfromthecommandline.2. SelectOverclockfromthemainmenu.3. Selectthelowestoverclock.4. Rebootandchecktheperformance.5. Ifitisstillslow,selectthenextoverclocksetting.6. Ifthegamestillrunsatanunacceptableperformance,thebestbetistoposttothe
RaspberryPiforums.AstheRaspberryPiplatformmatures,newenhancementsandperformancetweakswillbeavailable.
Bydefault,theRaspberryPirunsat700MHzbuthasthecapabilitytobeoverclockedtoahigherspeed.MostRaspberryPishavebeennotedtobeworkingfineat900MHzandsomeevenhigherthan1GHz.OverclockingtheCPUwithraspi-configautomaticallythrottlesthespeed,asrequired.So,whennotinuse,itreducespowerdownto700MHz.Evenwiththethrottle,overclockingcanmakeyoursystemunstableandcanleadtoSDcardcorruption.Ifyoursystemfailstobootafteroverclocking,holdingdownShifttriestoturnofftheoverclockinginthesoftware.Ifthisdoesnotwork,youcaneditthe/boot/config.txtfileandsetarm_freq=700todisableoverclocking.Ifallelsefails,youcanreimageyourSDcard.Alloverclockinginformationisstoredinconfig.txt,andreimagingyourcardwillresetit.
![Page 214: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/214.jpg)
ConnectingviaHDMIdoesn’tworkEdittheconfig.txtfileandsethdmi_safe=1.
Typesudonano/boot/config.txt,intheterminalFindthe#hdmi_safe=1lineRemovethe#fromthelinePressCtrl+X,thenpressYtosavethefileRebootyourRaspberryPi
TurntheTVonbeforeturningontheRaspberryPi.TryadifferentHDMIcable.
ThebootdrivecontainsaTEXTfilenamedconfig.txt.ThisfilestoresalloftheconfigurationparametersandisreadeachtimeyourRaspberryPipowerson.Editingthisfileallowsyoutofine-tuneyourRaspberryPiandcanalsohelpresolvevariousissuesthatcancropupduringuse.YoucanalsoeditthisfileonyourPCorMacbyputtingtheSDcardintothecomputer.
IfyouhavetroublegettinganimagetoappearonyourTVthroughHDMI,themostcommonfixistoeditconfig.txtandsethdmi_safe=1.ThischangesandbooststheHDMIsignal,sothatitismorelikelytosyncwithyourTV.AnothersimplechangeistoensurethattheTVisonandconnectedbeforeyoupowerontheRaspberryPi.
![Page 215: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/215.jpg)
TheDualShock3controllerdoesnotconnectInthiscase,
EnsurethattheDualShock3batteryisfullycharged.
NoteChargingcantakeover2hourstofullycomplete.
Usingasmallpin,presstheresetbuttononthebackofthecontroller.UseapoweredUSBhubforyourBluetoothdongle.UseaMicroUSBcabletoensurethatthecontrollerworkswhenpluggedin.
![Page 216: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/216.jpg)
IgetanerrorwhencompilingRetrogameThemostcommoncauseoferrorsisforgettingapieceofsyntax.
Checkwhethereachlinehastheproperamountofcommas.
Forexample:{17,KEY_DOWN},
![Page 217: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/217.jpg)
![Page 218: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/218.jpg)
SummaryInthischapter,youhavelearnedhowtotroubleshootdifferentailmentsthatcanafflictyourRaspberryPi.Youhavelearnedhowtooverclockyourprocessor,edityourconfig.txttoenabledifferentmodes,resetyourcontroller,andmakesureyouhaveaproperpoweredPi.
Anextrapieceofadvice:Don’tbeafraidtotinkerandexperimentwithyourRaspberryPi.Itisveryhardtodamagethehardware.Ihaveyettohurtone.Ifeverythingseemsbroken,reformatyourSDcardandstartover.
Ifallelsefails,wearepartofalargecommunityofenthusiaststhatwanttowatchyousucceed.Jointheforumsathttp://raspberrypi.org.Therearemanywhowillbewillingtohelp.
Also,ensurethatyoucheckouttheseguidesformoreinformation:
E-LinuxRu-PiTroubleshootingguideathttp://elinux.org/R-Pi_TroubleshootingE-LinuxR-PiConfigguideathttp://elinux.org/RPiconfig
![Page 219: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/219.jpg)
![Page 220: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/220.jpg)
AppendixA.GamesListThisappendixcontainsoflistofsomeofthegamesavailablefromtherepositories.ThislistiscollatedfromtheRaspberryPigamingsubforum.
CheckoutthefollowingURLsformoreupdatesonavailablegames:
http://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794http://www.raspians.com/Knowledgebase/1-debian-wheezy-games-repository-sudo-apt-get-install/
![Page 221: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/221.jpg)
GamesavailableviaApt-GetThefollowingisthelistofgamesthatareavailableviaApt-Get:
20,000LightYearsIntoSpace3DChess4-DigitAbuseACM(Aliens:ColonialMarines)AirstrikeAllegrodemoAngryDrunkenDwarvesAtomAtomicTanksBattleforWesnothBattleTanksBattleballBeneathaSteelSkyBlobWars:MetalBlobSolidBlockOut2DeSmuMEFeedingFrenzyFlareFlightoftheAmazonQueenFreeCivFreeCraftFreeDinkFreesweepFunnyBoatFuseGalagaGalaga:HyperspaceGNUShogiHexxagonKETM(KillEverythingThatMoves)LincityLittleCraneMancalaMednafenMicropolisMinecraft:PiEditionMonsterzNetHackOpenTTD
![Page 222: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/222.jpg)
OvergodPrBoomPydanceRafkillSnake4SopwithSpaceAryaryaSpaceZeroSpoutStaxStellaSuperTuxTaguaTeddyTetzleTINTTriplaneVavoomXSoldierXtronYahtzeeSharp
![Page 223: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/223.jpg)
![Page 224: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/224.jpg)
RaspberryPi2Asofthiswriting,theRaspberryPiFoundationhasintroducedabrandnewboardcalledthePi2.WhilesharingthelayoutandpriceoftheModelB+,thePi2hasbeenheavilyupgraded.
ThebiggestchangeisthemovefromanARMv6runningat700MHz,toaquad-coreARMv7runningat900MHz.TheARMv7isaprettybigupgrade;itiswhatmostAndroidreleasesarecompiledforandtheminimumversionforotherLinuxdistributions.MicrosofthasevenmentionedreleasingacustomizedversionofWindows10fortheRaspberryPi.TheothermajorupgradeisthattheRAMhasbeenincreasedfrom512MBto1GB.
ThePi2isalsobackwardscompatiblewithsoftwarewrittenfortheoriginalPi.InordertomoveyourPi’sSDcardtothenewestPi2,followthesesteps:
OntheModelA,B,orB+runthesecommands:
1. First,runthesudoapt-getupdatecommand.2. Afterthatrunthesudoapt-getupgradecommandtoruntheupgrades.3. Next,runthesudoapt-getdist-upgradecommand.4. Finally,runthesudoapt-getinstallraspberrypi-ui-modscommand.
Afterthesetasksarecompleted,youroperatingsystemwillbeupdatedandyoucansafelymoveyourSDcardbetweenthePi2andoriginalRaspberryPi.
![Page 225: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/225.jpg)
IndexA
AdafruitURL/GPIOpins
ApplicationProgrammingInterface(API),Minecraftusing/UsingtheMinecraft:PiEditionApplicationProgrammingInterfaceURL,fordocumentation/UsingtheMinecraft:PiEditionApplicationProgrammingInterface
AppStoreabout/RaspberryPiAppStoreusing/UsingtheAppStore
apt-cachesearchkeywordcommandabout/Findinggamesviatherepositories
Apt-Getgameslist/GamesavailableviaApt-Get
apt-getcommandused,forinstallingMednafen/Mednafen
Arcadesticksabout/Arcadesticks
Atari2600about/Stella(Atari2600)
![Page 226: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/226.jpg)
BBluetoothconnectivity
SonyDualShock3controllers,settingup/SonyDualShock3controllersBluetoothdongle
URL/SonyDualShock3controllers
![Page 227: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/227.jpg)
CCaveStory
about/CaveStoryinstalling/InstallingandrunningURL,forsourcecode/Installingandrunningcontrols/Controls
ChameleonPiabout/ChameleonPiURL,fordownloading/ChameleonPisystems/ChameleonPisplashscreen/ChameleonPigamefiles,copyingviaSAMBAshares/ChameleonPiversusRetroPie/ChameleonPigamefiles,copyingviaUSBdrive/ChameleonPi
controllersusing/ControllersontheRaspberryPigamepads/GamepadsArcadesticks/ArcadesticksXbox360controllers/Xbox360controllersSonyDualShock3controllers/SonyDualShock3controllersUSBencoders/USBencodersGPIOpins/GPIOpinstroubleshooting/Troubleshootingcontrollers
costumeabout/Somepointersandterminology
![Page 228: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/228.jpg)
DDoom
about/DoomPrBoom/Doomcontrols/Controls
DualShock3controllerconnection,troubleshooting/TheDualShock3controllerdoesnotconnect
![Page 229: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/229.jpg)
EEmulationStation
executionerror,troubleshooting/EmulationStationreturnsanerrorwhenItrytolaunchit
emulatorsabout/EmulatorsMednafen/MednafenFCEUX/FCEUX(NES)PiSNES/PiSNES(SNES)MAME4ALL/MAME4ALLFinalBurnAlpha/FinalBurnAlphaPCSX_ReARMed/PCSX_ReARMedPicoDrive/PicoDrive(Genesis/MegaDrive)Stella/Stella(Atari2600)
![Page 230: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/230.jpg)
FFCEUX
about/FCEUX(NES)using/FCEUX(NES)
FinalBurnAlphaabout/FinalBurnAlphadownloading/FinalBurnAlphaURL,fordownloading/FinalBurnAlphacontrols/Controls
first-personshooter(FPS)about/Doom
FlappyBirdclonebuilding/Let’sbuildaFlappyBirdclone!newproject,creating/Creatinganewprojectvariables,creating/Makingthevariablesstage,setting/Settingthestagefloor,creating/Makingthefloorpipes,creating/Creatingthepipesmaincharacter,creating/Workingwiththemaincharacterenhancing/Enhancingthegame
foreverloopsabout/Somepointersandterminology
FreeCivabout/FreeCivinstalling/Installingandrunningexecuting/Installingandrunningserver,hosting/HostingaFreeCivservercontrols/LearningthecontrolsURL,forcontrollist/Learningthecontrols
![Page 231: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/231.jpg)
GGalaga*Hyperspace
about/Galaga:Hyperspaceinstalling/Installingandrunningexecuting/Installingandrunningcontrols/Learningthecontrols
gamepadsabout/Gamepads
gamessearching,viarepositories/Findinggamesviatherepositories
GPIOpinsabout/GPIOpinsRetrogame/GPIOpins
![Page 232: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/232.jpg)
HHDMI
connection,troubleshooting/ConnectingviaHDMIdoesn’twork
![Page 233: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/233.jpg)
Iif…elsestatement
about/Somepointersandterminologyifstatement
about/Somepointersandterminologyinadequatepowersupply
troubleshooting/NothinghappenswhenIapplypowerinstallation,CaveStory
about/Installingandrunninginstallation,FreeCiv
about/Installingandrunninginstallation,Galaga*Hyperspace
about/Installingandrunninginstallation,Mednafen
apt-getcommand,using/Mednafeninstallation,Minecraft
about/Installingandrunninginstallation,Njam
about/Installingandrunninginstallation,NOOBS
about/UsingNOOBSinstallation,OpenArena
about/Installationinstallation,PrBoom
about/Installingandrunninginstallation,Retrogame
about/Installingandbuildinginstallation,Stella
about/Stella(Atari2600)installation,SuperTux
about/Installingandrunninginstallation,xboxdrv/Xbox360controllersinterface,Scratch
about/UnderstandingtheScratchinterface
![Page 234: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/234.jpg)
Jjoystickpackage
installing/ControllersontheRaspberryPi
![Page 235: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/235.jpg)
LLinux
SDcard,creating/CreatingtheSDcardinLinux
![Page 236: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/236.jpg)
MMacintoshOSX
SDcard,creating/CreatingtheSDcardinMacintoshOSXMAME4ALL
about/MAME4ALLdownloading/MAME4ALLURL,fordownloading/MAME4ALLcontrols/Controls
Mednafenabout/Mednafeninstalling,apt-getcommandused/Mednafen
Minecraftabout/Minecraft:PiEditioninstalling/InstallingandrunningnewMinecraftworld,creating/CreatinganewMinecraftworldApplicationProgrammingInterface(API),using/UsingtheMinecraft:PiEditionApplicationProgrammingInterfacemultiplayergame/MultiplayerMinecraftcontrols/Controls
MultipleArcadeMachineEmulator(MAME)about/MAME4ALL
![Page 237: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/237.jpg)
NNintendoEntertainmentSystem(NES)
about/FCEUX(NES)Njam
about/Njaminstalling/Installingandrunningexecuting/Installingandrunningcontrols/Learningthecontrols
NOOBSusing/UsingNOOBSinstalling/UsingNOOBSURL,fordownloading/UsingNOOBS,NothinghappenswhenIapplypowerabout/NothinghappenswhenIapplypower
NXEngineabout/CaveStory
![Page 238: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/238.jpg)
OOpenArena
about/OpenArenainstalling/Installationsingleplayermatch/Singleplayermatchmultiplayermatch/Multiplayermatchserver,creatingformultiplayermatch/Runningaserverserver,joiningformultiplayermatch/Joiningaserver
overclockabout/Someofthegamesseemslow
![Page 239: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/239.jpg)
PPCSX_ReARMed
about/PCSX_ReARMeddownloading/PCSX_ReARMedcontrols/Controls
PicoDriveabout/PicoDrive(Genesis/MegaDrive)downloading/PicoDrive(Genesis/MegaDrive)controls/Controls
PingPongabout/PingPongbuilding/PingPongpaddles,creating/Makingthepaddlesbouncingball,creating/Followingthebouncingball
PiPlayabout/PiPlayemulatorsandgames/PiPlayURL,fordownloading/PiPlaydownloading/PiPlaymenuscreen/PiPlaygamefiles,loading/PiPlayfrontend/PiPlay
PiSNESabout/PiSNES(SNES)URL,fordownloading/PiSNES(SNES)downloading/PiSNES(SNES)controls/Controls
pointers,Scratchvariable/Somepointersandterminologystage/SomepointersandterminologyXposition/SomepointersandterminologyYPosition/Somepointersandterminologysprite/Somepointersandterminologycostume/Somepointersandterminologyifstatement/Somepointersandterminologyif…elsestatement/Somepointersandterminologyforeverloops/Somepointersandterminology
PrBoomabout/Doominstalling/Installingandrunning
![Page 240: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/240.jpg)
QQuake3Arena
about/OpenArenacontrols/Controls
![Page 241: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/241.jpg)
RRaspberryPi
ModelA/ThedifferentflavorsofaRaspberryPiModelB/ThedifferentflavorsofaRaspberryPiModelB+/ThedifferentflavorsofaRaspberryPiModelA+/ThedifferentflavorsofaRaspberryPiURL,fordownloading/SettingupanSDcardsettingup/HookingupyourRaspberryPiconnecting,toWiFiaccesspoint/ConnectingtoaWi-FiaccesspointAppStore/RaspberryPiAppStoretroubleshooting/Commontroubleshooting
raspi-configtoolusing/Usingraspi-config
raspi-configtool,advancedoptionsoverscan/Usingraspi-confighostname/Usingraspi-configmemorysplit/Usingraspi-configSSH/Usingraspi-configSPI/Usingraspi-configI2C/Usingraspi-configserial/Usingraspi-configaudio/Usingraspi-configupdate/Usingraspi-config
raspi-configtool,optionsexpandfilesystem/Usingraspi-configchangeuserpassword/Usingraspi-configenableboottodesktop/Scratch/Usingraspi-configinternationalizationoptions/Usingraspi-configenablecamera/Usingraspi-configaddtoRastrack/Usingraspi-configoverclock/Usingraspi-config
Read-onlymemory(ROM)about/Emulators
repositoriesgames,searchingvia/Findinggamesviatherepositories
Retrogameabout/GPIOpinscontrols/GPIOpinsinstalling/Installingandbuildingbuilding/Installingandbuildingcompilationerror,troubleshooting/IgetanerrorwhencompilingRetrogame
RetroPieabout/RetroPie
![Page 242: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/242.jpg)
systemsandconsoles/RetroPieURL/RetroPieEmulationStationsplashscreen/RetroPiegamecontroller,configuring/RetroPiegamecontroller,settingup/RetroPiegamefiles,copyingwithSAMBAshares/RetroPiegamefiles,copyingviaUSBdrive/RetroPieversusChameleonPi/ChameleonPi
![Page 243: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/243.jpg)
SSAMBAshares
used,forcopyinggamefilesontoPi/RetroPieScratch
about/WhatisScratch?interface/UnderstandingtheScratchinterfacefirstprogram,creating/MakingScratchymovepointers/SomepointersandterminologyFlappyBirdclone,building/Let’sbuildaFlappyBirdclone!PingPong,building/PingPong
SDcardsettingup/SettingupanSDcardbootpartition/SettingupanSDcardLinuxpartition/SettingupanSDcardcreating,inWindows/CreatingtheSDcardinWindowscreating,inMacintoshOSX/CreatingtheSDcardinMacintoshOSXcreating,inLinux/CreatingtheSDcardinLinuxNOOBS,using/UsingNOOBS
SegaGenesis/MegaDriveabout/PicoDrive(Genesis/MegaDrive)
sixadURL,fordownloading/SonyDualShock3controllers
SonyDualShock3controllersabout/SonyDualShock3controllerssettingup,forBluetoothconnectivity/SonyDualShock3controllers
spriteabout/Somepointersandterminology
stageabout/Somepointersandterminology
Stellaabout/Stella(Atari2600)installing/Stella(Atari2600)controls/Controls
SuperNintendoEntertainmentSystem(SNES)about/PiSNES(SNES)
SuperTuxabout/SuperTuxinstalling/Installingandrunningexecuting/Installingandrunningcontrols/Learningthecontrols
![Page 244: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/244.jpg)
Ttroubleshooting
controllers/TroubleshootingcontrollersEmulationStationexecutionerror/EmulationStationreturnsanerrorwhenItrytolaunchitinadequatepowersupply/NothinghappenswhenIapplypoweroverclocking/SomeofthegamesseemslowHDMIconnectionissue/ConnectingviaHDMIdoesn’tworkHDMIconnection/ConnectingviaHDMIdoesn’tworkDualShock3controllerconnection/TheDualShock3controllerdoesnotconnectRetrogamecompilationerror/IgetanerrorwhencompilingRetrogame
![Page 245: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/245.jpg)
UUSBdrive
gamecontroller,configuring/RetroPieused,forcopyinggamefilesontoPi/RetroPie
USBencodersabout/USBencoders
![Page 246: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/246.jpg)
Vvariable
about/Somepointersandterminology
![Page 247: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/247.jpg)
WWiFiaccesspoint
RaspberryPi,connectingto/ConnectingtoaWi-FiaccesspointWiFiadapter
URL/ConnectingtoaWi-FiaccesspointWin32DiskImager
about/SettingupanSDcardURL/CreatingtheSDcardinWindows
WindowsSDcard,creating/CreatingtheSDcardinWindows
![Page 248: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/248.jpg)
XXbox360controllers
about/Xbox360controllersxboxdrv
about/Xbox360controllersinstalling/Xbox360controllersusing/Xbox360controllers
Xpositionabout/Somepointersandterminology
![Page 249: Raspberry Pi Gaming Second Edition - tentacle.netprophet/raspberrypi/Raspberry Pi/1784399337... · Nilesh R. Mohite Cover Work. Manu Joseph. About the Author ... You can upgrade to](https://reader030.vdocuments.us/reader030/viewer/2022021511/5ac006a87f8b9aa15e8eafd7/html5/thumbnails/249.jpg)
YYposition
about/Somepointersandterminology