basicsourcegear

sourcegear  时间:2021-02-19  阅读:()
PraiseforBeginning.
NETGameProgramminginVB.
NET:"I'ddefinitelyrecommendthisbook.
"-CraigAndera,CraigAndera'sweblog(http:IIpluralsight.
comlblogslcraig)"So,wouldIrecommendthisbooktoothersAbsolutely!
Ifyoudon'thaveit,buyitnowandsupporttheauthorswhowroteagreatbook.
"-JasonOlson,FromTheSoupToTheNutsweblog(http:IIgeekswithblogs.
netljolson)Beginning.
NETGameProgramminginVB.
NETDAVIDWELLER,ALEXANDRESANTOSLOBAO,ANDELLENHATTONAPressMedia,LLCBeginning.
NETGameProgramminginVB.
NETCopyrightC2004byDavidWeller,AlexandreSantosLobao,andEllenHattonOriginallypublishedbyAPressin2004Allrightsresented.
Nopartofthisworkmaybereproducedortransmittedinanyformorbyanymeans,electronicormechanical,includingphotocopying,recording,orbyanyinformationstorageorretrievalsystem,withoutthepriorwrittenpermissionofthecopyrightownerandthepublisher.
ISBN978-1-59059-401-8ISBN978-1-4302-0724-5(eBook)DOI10.
1007/978-1-4302-0724-5'IIademarkednamesmayappearinthisbook.
Ratherthanuseatrademarksymbolwitheveryoccurrenceofatrademarkedname,weusethenamesonlyinaneditorialfashionandtothebenefitofthetrademarkowner,withnointentionofinfringementofthetrademark.
TechnicalReviewer:AndrewJenksEditorialBoard:SteveAnglin,DanAppleman,EwanBuckingham,GaryCornell,TonyDavis,JasonGilmore,ChrisMills,DominicShakeshaft,JimSumserAssistantPublisher:GraceWongProjectManager:SofiaMarchantCopyEditor:AmiKnoxProductionManager:KariBrooksProofreader:lindaSeifertCompositor:DinaQuanIndexer:RebeccaPlunkettCoverDesigner:KurtKramesManufacturingManager:TomDebolskiTheinformationinthisbookisdistributedonan"asis"basis,withoutwarranty.
Althougheveryprecautionhasbeentakeninthepreparationofthiswork,neithertheauthor(s)norApressshallhaveanyliabilitytoanypersonorentitywithrespecttoanylossordamagecausedorallegedtobecauseddirectlyorindirectlybytheinformationcontainedinthiswork.
Thesourcecodeforthisbookisavailabletoreadersathttp:I/www.
apress.
comintheDownloadssection.
ParaAna:Miesperanza,micorazon,mitesoro,miamiga,miamor.
ContentsataGlanceForewordxiAbouttheAuthorsxiiiAbouttheTechnicalReviewerxvCreditsxviAcknowledgmentsxviiPrefacexixIntroductionxxiChapter1Chapter2Chapter3Chapter4Chapter5Chapter6Chapter7EpilogueBonusChapterAppendixAAppendixBAppendixCAppendixD.
Nettrix:GDI+andCollisionDetection.
.
.
.
.
.
.
1.
Netterpillars:ArtificialIntelligenceandSprites65ManagedDirectXFirstSteps:Direct3DBasicsandDirectXvs.
GDI+141SpaceDonuts:SpritesRevisited207Spacewar!
245Spacewar3D:MeshesandBuffersandTextures,OhMy!
271AddingVisualEffectstoSpacewar3D327TakingYourNextSteps343Porting.
NettrixtoPocketPC351SuggestedReading371MotivationsinGames375HowDoIMakeGames381GuidelinesforDevelopingSuccessfulGames391Index399vContentsForewordxiAbouttheAuthorsxiiiAbouttheTechnicalReviewerxvCreditsxviAcknowledgmentsxviiPrefacexixIntroductionxxiChapter1.
Nettrix:GDI+andCollisionDetection.
.
.
.
lBasicGDI+Concepts2PerformingGraphicOperationswithaGraphicsObject4CreatingGradients7CollisionDetection8OptimizingtheNumberofCalculations18ExtendingtheAlgorithmstoAddaThirdDimension22TheGameProposal23TheGameProject25TheCodingPhase31FinalVersion:CodingtheGameFieldClassandtheGameEngine51AddingtheFinalTouches60Summary64BookReference64Chapter2.
Netterpillars:ArtificialIntelligenceandSprites65Object-OrientedProgramming66ArtificialIntelligence69SpritesandPerformanceBoostingTricks76TheGameProposal84TheGameProject86TheCodingPhase99AddingtheFinalTouches135Summary139viiContentsChapter3ManagedDirectXFirstSteps:Direct3DBasicsandDirectXvs.
GDI+141DirectXOverview1423-DCoordinateSystemsandProjections153DrawingPrimitivesandTexture160TheApplicationProposal168TheApplicationProject169TheCodingPhase170AddingtheFinalTouches203MoreAboutDirectXandGDI+205Summary206Acknowledgments206Chapter4SpaceDonuts:SpritesRevisited207Sprites208SpaceDonuts223Summary243Acknowledgments243Chapter5Spacewar!
245AboutSpacewar246Methodology:ChallengesofWorkingwithSomeoneElse'sCode248UsingtheApplicationWizard248DirectPlay261Summary269Acknowledgments269Chapter6Spacewar3D:MeshesandBuffersandTextures,OhMy!
271DirectXBasics:TheApplicationWizardRevisited272Spacewar3D284TheGameProposal285TheGameProject285Summary326Acknowledgments326viiiContentsChapter7AddingVisualEffectstoSpacewar3D.
.
.
.
.
327PointSprites327Step10:AddingThrustEffectstoSpacewar3D329Step11:AddingExplosionEffectstoSpacewar3D337Step12:AddingaShockwaveEffecttoSpacewar3D339Summary341EpilogueTakingYourNextSteps343MovingOn343HabitstoBuild344ThingsWeNeglectedtoTellYou348HappyTrails350BonusChapterPortingNettrixtoPocketPC351ProgrammingforMobileDevices352TheGameProposal356TheGameProject357TheCodingPhase358AddingtheFinalTouches368Summary369AppendixASuggestedReading371AppendixBMotivationsinGames.
375AppendixCHowDoIMakeGames381AppendixDGuidelinesforDevelopingSuccessfulGames391Index399ixForewordBACKAFEWYEARSAGOIHADANIDEA.
WhatifIcouldmakethepoweroftheDirectXAPIavailabletothedeveloperswhoweregoingtobeusingthenewsetoflanguagesandcommonlanguageruntimethatMicrosoftwasdevelopingTheideawasintriguing,andopeningupalargerportionoftheworldtoDirectXwasagoalIwasonlyhappytoendorse.
·Besides,whatdeveloperdoesn'twanttowritegamesItseemsthatatleastonceaweekIamansweringquestionsdirectlyregard-ingtheperformanceofmanagedcode,andManagedDirectXinparticular.
OneofthemorecommonquestionsIhearissomeparaphraseof"Isitasfastasunmanagedcode"Obviouslyinageneralsenseitisn't.
RegardlessofthequalityoftheManagedDirectXAPI,thefactremainsthatitstillhastorunthroughthesameDirectXAPIthattheunmanagedcodedoes.
Thereisnaturallygoingtobeaslightoverheadforthis,butdoesithavealargenegativeimpactonthemajorityofapplicationsOfcourseitdoesn't.
Nooneissuggestingthatoneofthetop-of-the-linepolygonpushinggamescomingouttoday(say,HalfLife2orDoom3)shouldbewritteninManagedDirectX.
,butthatdoesn'tmeanthatthereisn'tawholeslewofgamesthatcouldbe.
I'llgetmoretothatinjustafewmoments.
Therealityisthatmanyofthedevelopersouttheretodaysimplydon'tknowhowtowritewell-performingmanagedcode.
Thisisn'tthroughanyshortcomingofthesedevelopers,butratherthenewnessoftheAPI,combinedwithnotenoughdocumentationonperformance,andhowtogetthebestoutoftheCLR.
Forthemostpart,we'reallnewdevelopersinthisarea,andthingswillonlygetbetteraspeoplecometounderstandtheprocess.
It'snotatalldissimilartothechangefromassemblertoCcodeforgames.
Itallcomesdowntoasimplequestion:DothebenefitsoutweighthenegativesAreyouwillingtosacrificeasmallbitofperformancefortheeasierdevelopmentofmanagedcodeThequickertimetomarketThegreatersecurityTheeasierdebuggingAreyouevensurethatyouwouldseeadifferenceinperformanceLikeImentionedearlier,therearecertaingamestodaythataren'tgoodfitsforhavingthemainenginewritteninmanagedcode,butthereareplentyoftitlesthatare.
ThetoptensellingPCgamesjustafewmonthsagoincludedtwoversionsoftheSims,ZooTycoon(+expansion),BackyardBasketball2004,andUru:AgesBeyondMyst,anyofwhichcouldhavebeenwritteninmanagedcode.
Anyonewhohastakenthetimetowritesomecodeinoneofthemanagedlanguagesnormallyrealizesthebenefitstheplatformoffersprettyquickly.
UsingxiForewordxiithisbook,youshouldbeabletopickupthebeginningconceptsofgamedevel-opmentprettyeasily.
Ittakesyouthroughthesimplesprite-basedgames,allthewaythroughabasic3-Dgameimplementation.
It'sanexcitingtimetobeadeveloper.
TomMillerLeadDeveloperfortheManagedDirectXLibrary,MicrosoftCorporationAbouttheAuthorsSomewherearound1974,DavidWellerdiscoveredacoin-operatedPonggameinapizzaparlorinSacramento,California,andwasinstantlyhookedoncom-putergames.
Afewyearslater,hewasintroducedtotheworldofprogrammingbyhisgodfather,wholethimusehisRadioShackTRS-80computertolearnaboutprogramminginBASIC.
David'sfirstprogramwasasimpledicegamethatgraphicallydisplayedthedieface(hestillhasthefirstversionheoriginallywroteonpaper).
HequicklyoutgrewBASICthough,andsoondiscoveredtheamazingspeedyoucouldgetbywritingvideogamesinassemblylanguage.
Hespenttheremainderofhishighschoolyearsgettingbadgrades,butwritingcoolsoftware,noneofwhichmadehimanymoney.
Hespentthenext10yearsinthemilitary,learningdetailsaboutcomputersystemsandsoftwaredevelopment.
Shortlyafterheleftthemilitary,DavidwasofferedajobtohelpbuildtheSpaceStationTrainingFacilityatNASA.
Fromthatpointon,hemerrilyspenttimeworkingonvisualsimulationandvirtualrealityapplications.
HemadetheoddshiftintomultitierITapplicationdevelopmentduringtheInternetboom,ultimatelyland-inginsideofMicrosoftasatechnicalevangelist,wherehespendstimeplayingwithallsortsofnewtechnologyandmerrilysayingunderhisbreath,"Ican'tbelievepeoplepaymetohavethismuchfun!
"AlexandreSantosLobiogothisfirstcomputerin1981,whenhewas12,andimmediatelystartedtocreatesimplegamesinBASIC.
Sincethen,computershaveevolvedmassively,andsohashe.
Graduatingwithabachelor'sdegreeincomputersciencein1991,Alexandre,togetherwithsixfriends,foundedthatsameyearacompanythatcametobeknownasasynonymforhigh-qualityservicesinBrasilia,Brazil:HeptaInformatica.
Besideshisexcellentworkinmanysoftwaredevelopmentareas,fromfinancialtotelecommunication,heneverforgothisfirstpassion,andhasalwaysworkedasanonprofessionalgameprogrammer.
From1997to1999healsoworkedatVirtuallyReal(http:I/www.
vrea!
ware.
com),avirtualAustralianamateurgameprogrammingcompanyfoundedbyCraigJardine.
Attheendof2000,Alexandrestartedsearchingfornewhorizonsand,leavingthecompanyhehelpedtocreate,enteredMicrosoftasaconsultant.
Lookingatthenewandextremelyinterestingpossibilitiesofferedbythe.
NETFramework,hedecidedtotakeeverythinghe'slearnedoverthelastdecadeandapplyittothisnewdevelopmentplatform.
xiiiAbouttheAuthorsxivEllenHattonisacomputerscienceundergraduateatEdinburghUniversity.
Shewasexposedtocomputersataveryearlyageandhasbeenfascinatedwiththemeversince.
HerfirstexperiencewithcomputergameswasplayingDreadDragonDoom,atwhichshequicklyexcelledattheageof5.
She'sbeenhookedongameseversince.
Ellenisnotonlyinterestedincomputers.
Sheskisfrequently,amongstothersports,andenjoysgeneralstudentlifeinthebustlingScottishcapital,Edinburgh.
Asherchoiceofdegreesuggests,Ellenstillfindscomputersveryinterestingandisconstantlylookingfornewchallenges.
Thisbookisthelatest.
AbouttheTechnicalReviewerAndrewJenksbeganwritingcodewhenhisparentsboughthimaTI99-4AforaChristmaspresent.
Astapedriveswerehardtouse,andthemediaresultingwasoftenoverwrittenbysingingsiblings,hisfatherbroughthometheirfirstfamilycomputerin1985.
AndrewlearnedtowriteBASICandassemblyprogramsthrougholdSanyomanualsandwhateverhecouldfindinthelibrary.
ThisprovedhandywhenhefoundhimselfbrokeattheGeorgiaInstituteofTechnologyanddiscoveredthatpeoplewouldpayhimtoteachcomputingclasses.
Hewentontoactasadeveloperforanartificialintelligencecompany,managerforacommunicationcompanyatthe1996Olympics,andatechnicaladvisorforseveralpoliticalcampaigns.
AndrewjoinedMicrosoftasaprogrammanagerin2000andcancurrentlybefoundworkingonMSNMmigrationissueswhenhe'snotoffskiingordiving.
DuringAndrew'sillustriouscareerasaprofessionalgeek,hehaswrittencodethatcausedseveralgraphicscardstomakeprettybluesparks,lostonemonitorduetoalongfall,andsetonemachineonfire.
Heismostproudofthefire.
Thatwasgoodcode.
XVxviCreditsFigure6-13:SeriousSam2001isatrademarkofCroteamLtd.
Allrightsreserved.
FigureC-1:QuakeisatrademarkofidSoftware,Inc.
Allrightsreserved.
FigureC-4:PAC-MAN1980NamcoLtd.
Allrightsreserved.
CourtesyofNamcoHoldingCorp.
FigureC-5:SuperMarioBros.
21988byNintendoofAmericaInc.
FigureC-6:GALAGA1980NamcoLtd.
Allrightsreserved.
CourtesyofNamcoHoldingCorp.
FigureC-7:GAUNTLETDARKLEGACYTM1998-2000MidwayGamesWestInc.
GAUNTLETDARKLEGACYisatrademarkofMidwayGamesWestInc.
AcknowledgmentsToolsandTunesTobeginwith,nodevelopmenteffortcanbedonewithouttools.
Theretoolswereinvaluabletome,andIheartilyrecommendthemas"musthave"tools:IDE:VisualStudio.
NETProfessional2003(http:Ilwww.
microsoft.
com/catalog/display.
aspsubid=22&site=11513&x=30&y=4)Sourcecontrol:SourceGear'sVault(http:Ilwww.
sourcegear.
com/vault)DirectX9SDK(http://www.
microsoft.
com/directx)Ialsowanttothankthosethatkeptmerockingwhiletyping:Prodigy,GhettoBoys,Radiohead,Everclear,AC/DC,ChristopherParkening,ElliotFisk,JimmyBuffett,FleetwoodMac,thecastofthemovieChicago,Shakira,NorahJones,AlejandroSanz,Juanes,andmany,manymore.
PeopleWhoReallyMadeThisHappenFewauthorscanwriteabookcompletelybythemselves,andI'mnoexceptiontothisrule.
Firstandforemost,thisbookcouldnothavebeendonewithoutthecodingwisdomofScottHaynie.
HeconvertedtheSpacewargameandwrotethebulkofthecodefortheSpacewar3Dgame.
Inaddition,hegladlycontributedthe3-DmodelsfortheSpacewar3Dgame.
Thisbookwouldhavebeenverydifferentwithouthishelpandideas,andhehasmyundyinggratitude.
Inaddition,otherpeoplehelpedbycontributingcodeorofferingsugges-tions.
TristianCartony(.
Nettrix),StephenToub(.
Netterpillars),CaroleSnyder,andFranklinMunoz.
ForanybodyelsewhocontributedthatIforgottocalloutbyname,pleaseacceptmyapologiesinadvance.
TherearetwootherpeopleI'despeciallyliketothank:TomMiller,theprin-cipaldeveloperoftheManagedDirectXlibraries,graciouslywhackedmeovertheheadseveraltimessaying,"Whatwereyouthinking!
"Withouthis(ifyou'llpardonthepun)directinput,wemighthavetaughtsomebeginnerssomeverybadManagedDirectXhabits.
And,ofcourse,SofiaMarchant,theprojectman-agerforthisbook,whodidagreatjobofbeingmy"velvet-glovedtaskmaster"aswell,makingsureIwasstayingonscheduletogetthisbookdoneontime.
xviiAcknowledgmentsxviiiLastlyonthelistarethepeoplewhohavequietly(ornot-so-quietly)influ-encedthisbook:Mygodfather,CharlesPlott,whoopenedupmyeyestotheworldofcom-putersandcomputergames.
Myhighschoolmathteacher,DuanePeterson,wholetmetakeacom-puterprogrammingclassinspiteofnotknowingenoughmath-theresultofwhichinspiredmetogetadegreeincomputersciencewithamathminor.
Mymomanddad,whoputupwithmyintensepassionforcomputersduringmyadolescence,inspiteofnothavingenoughmoneytobuymethemainframesystemIwantedtoputinourgarage.
Mykids,ErichandGretchen,andtheirmother,Nancy,whopatientlytoleratedmypassionforcomputergamesformanyyears.
Lastly,IwanttothankmygirlfriendAna,whohasmadesomeverygloomydaysformemuchbrighter,andwhogavemeallthesupportshecould,eventhoughshewas2000milesawaymostofthetime.
-DavidWellerPrefaceIAPPROACHEDALEXANDREABOUTAYEARAGOtoofferhimcommentsonhisfirstbook,.
NETGameProgrammingwithDirectX9.
0.
AfterpresentinghimwitharatherlonglistofwhatIwouldhavedonedifferently,Alexgraciouslysuggestedcollaboratingonanewbook.
Wedecidedearlyintheprocesstoreusesomeofthegameexamplesfromhisbook(specifically.
Nettrixand.
Netterpillars),althoughsomepartshavebeenheavilymodified.
Wedidthisfortworeasons:Thegamesaregood,simpleexamplesthatcanstandthetestoftimewhenitcomestolearninggameprogramming.
Therewasnosensecreatingadifferentgamejusttoconveythesameconcept.
Writingdifferentgamesfromscratchwouldtaketimeawayfromaddingnewergamesattheendofthebookthatchallengedthebeginner.
Ofcourse,myyouthfulmemoriesoftheearlycomputergamesinfluencedmetochooseaspacethemeforthelatergames,leaningonthewell-knowngamesofAsteroidsandSpacewar.
ButIwantedtotakethingsastepfurther,toshowhow2-Dgamingknowledgecanquicklyscaleinto3-Dgames.
Ihadneverseenabooktakesuchastep,andwasfranklyworriedthatitcouldn'tbedoneeffectively.
However,thebookyou'reholdingisthebestattemptIcanputfor-ward,andhopefullyyou'llfindtheprogressionsimpleaswellasinstructional.
Duetomydistasteforgamingbooksthatdoubleasgymnasiumfreeweights,Iwantedtocreateabookthatavoidedthelong,pointlesschaptersthatexplainedVisualBasic.
NET(henceforthreferredtoas"VB"),object-orientedprogramming,howtouseVisualStudio,etc.
Thisbookgetsrighttothegames,andassumesyouhavearudimentaryknowledgeofVB.
IfyouneedtogetuptospeedonVB,werecommendMatthewTagliaferri'sLearnVB.
NETThroughGameProgramming(Apress,ISBN1-59059-114-3),whichmakesanexcellentcompanionbooktothisone.
Fordeveloperswhoarealreadyfamiliarwithprogrammingandbasicgamingconcepts,thisbookwillservewellasahigh-speedintroductiontoVisualBasic.
NETand,inlaterchapters,ManagedDirectX.
Ifyou'realreadyintimatelyfamiliarwithDirectXgamedevelopmentandarelookingforabookfocuseddirectlyonManagedDirectX,IrecommendManagedDirectXKickStart(SAMS,2003)writtenbyTomMiller.
Ofcourse,Iwouldloveforyoutobuythisbookaswell,butI'mmoreinterestedingettingyoutowritegamesinManagedDirectXthanIaminmakingabuckortwobyconvincingyoutobuythisbook.
xixPrefaceXXThewholebookisdesignedtobereadinacontinuousway.
InChapter1,westartbycreatingaverysimplegamewhilepresentingthebasicsofcollisiondetection.
Chapter2showshowtobuildanewgame,usingtheconceptspre-sentedinChapter1andaddingnewexplanationsandexamplesaboutartificialintelligenceingames.
Inthefollowingchapters,wecontinuetobuildnewgamesandexplorenewtopicsrelatingtogameprogramming,suchasthebasicsofspritecreation,mul-tiplayerfeatures,3-Dgraphics,portingagametoPocketPC,andmuchmore.
Westartwiththebasicsandincreasethecomplexityaswegoalong,sothatbythetimeyoucometotheadvancedtopics,youhaveallthebackgroundyouneedtogainthemostfromthem.
Neartheendofthebook,westickourtoesinthedeeperDirectXwatersbyinvestigatingpointsprites.
Ihaveyettoseeabookthatdiscussespointspritesinagood,introductorystyle,soevenintermediategamedevelopersshouldfindthispartinteresting.
Pleasekeepinmindthoughthatthisbookisn'tintendedtoprovidearoutetotheprofessionalgameprogrammingworld,becausewedon'tgodeepenoughintosomeessentialaspectsprofessionalgamedevelopersneedtoknow.
However,youcanthinkofthisbookasafirststepintothisworld,sincewedoprovideinsightsintoimportantconceptssuchastheneedtocreateagoodgameprojectandorganizingthegame'steam,aswellasappendixeswrittenbyprofessionalsfromthegameindustrythatserveasguidestogamecreation.
-DavidWellerIntroductionAGameStartswithaGoodIdeaAlthoughthegamesreleasednowadaysaremoreandmoregraphicsintensive,themainpointinagameissometimesforgotten:theplayability.
Youseegameswithbreathtakinggraphics,amazingcut-scenes,and3-Dworldstomakeyoureyespopout,butmanyofthemarereallyannoyingtoplay.
Evenwhenagame'sresponsivenessisokay,sometimesthegameplayisn'tclearorfair.
WhataboutplayinganoldPac-MangameWithallthesegorgeousgamesaround,Pac-ManandtheearlierversionsofMarioBrothersonNintendoarestillsuccesseswithkids.
Wearen'theretotellyoutoforgeteverythingandgetbacktobasics.
Instead,rememberthatagoodgamealwaysstartswithagoodidea,andsometimesthat'senough.
Oneofthemostclonedgamesever,Tetris,wasdesignedbyasingleman,aRussianprogrammer.
It'sstillinterestingtoplayafteralltheseyears,and,ofcourse,wehaveaTetriscloneheretoo-ourversionofa"HelloWorld"programinthefirstchapter.
YoucouldsaythatTetrisisoneinamillion,andwe'dagree.
Butifyouweretosaythatcreatingagoodgamebyyourselfisonlypossibleifit's-assimpleasTetris,thenwe'dhavetodisagree.
OlderfolkswillrememberAnotherWorld,agamethathasasequelcalledFlashBack.
Thegamehadverygoodgraphicsandsoundforitstime,withverynicecharacteranimationandvariouscut-scenesthatcompletedthegamestorybyshowingthecharactersandafantasticworldfrommanydifferentpointsofview.
Well,asingleperson,aFrenchprogrammer,designedthisgame.
TodaywecanseemanysitesontheWebwithgamesfromamateurgameprogrammers.
Someofthemarereallygood,withhigh-qualitygraphicsandsound;and,mostimportantofall,almostallareveryplayabletoo,maybebecausetheyweredesignedbypeoplewholovetocreateandplaygamesbutdon'thavetheurgetomakemoney.
Inthisbook,you'llseemanytipsandtricksthatwillhelpanyonetodesigntheirowngamesalone.
However,ifyoucancountonsomeonetohelpyou,do.
Afterall,there'smoretoagamethanjustagoodidea.
.
.
xxiIntroductionxxiiAGameIsMoreThanJustaGoodIdeaAlthoughagamemuststartwithagoodidea,thereisalotmoretothegameprogrammingworldthanourhumblemindscanimagine.
Let'slookatsomepointsyoumustkeepinmindwhenyoustartyourgameproject:Music:Althoughyoucanalwaysmakeagameusingonlybleepsandbloops,goodbackgroundmusicandnicesoundeffectsforgameactions(shooting,dying,earningbonuspoints,etc.
)makeyourgamesbetter.
Evenifyoudon'tplantohaveamusicexpertonyourstaff,youcan'tforgetthatit'lltakealotoftimetolookformusicwiththecorrectambianceandthebestsoundeffectsamongthemillionsyou'llfindontheInternetorinCDlibraries.
Drawing:It'snotgoodpracticetousegraphicsrippedofffromsomeoneelse'sgame,becauseyourgamewilllackoriginalityandyou'remostlikelybreakingcopyrightlaws.
Sincenoteveryonecandrawanythingbetterthanasquarehouseandasmileysun,you'llwantagoodartist(orseveralofthem)onyourgameteam.
Colors:Coloringthingsonthecomputerisverydifferentfromcoloringthemonpaper.
Ifyourartistscan'tcolorusingagraphicstool,you'llneedsomeonewhocan.
Animation:Creatinganimatedgraphicsisslightlydifferentfromcreatingstaticones.
Almosteveryonecandrawanicetree,forexample,buttodrawawalkingmanoraflyingbirddemandssomeonewithanimationexperience.
Evenwhenyourgamesdon'tuseanimatedsprites,don'tforgetthatyoumayneedananimatedintroductionorcut-scenes.
Code:Well,withoutthisoneyouwouldbereadingaboardgamebook.
Leveldesign:Theleveldesignersaretheoneswho'llalwaysbeworkingtoensureoptimumgameplayandthemostenjoyableplayingexperienceforplayers.
Qualityassurance:Ifyoucan'taffordtohaveaverygoodqualityassuranceteam,you'rebetteroffnotbotheringtomakegames.
Abuggygameisbyfartheworstthingthatcanhappeninagamecompany'sprofile.
Projectmanagement:Workingwithmanypeoplewithdifferentskillsandpersonalitiesrequiresanorganizedwaytogetthebestfromeachofthem.
Evenwhenyou'reworkingalone,youmustn'tunderestimatetheimpor-tanceofagoodproject:Ifyoudon'tsetsomemilestonestocontrolyourproject,youmayworkonitforeverandneverseeanygoodresults.
It'sfarbeyondthescopeofthisbooktoteachyouhowtomanageaproject,butwestronglysuggestyoutakealookatsomestuffonthistopic,ifyou'veneverhadtheopportunityofworkingwithanorganizedteam.
Mostimportantly,youshouldlearngooddevelopmentdisciplinethatwillhelpyouworkaspartofateam.
Etc.
:There'llbelotsmoretoo,butingeneralyoumustbereadytodealwithanynewandunexpectedproblems.
Thetaskofcreatingacommercialgamenowadaysisanythingbutsimple.
Thetimewhenthe"lonewolf"programmercouldcreateanewhitandevengetrichwithitismostcertainlyover.
Nevertheless,let'skeeponethinginmind:Thisbookisforthosewholovegamedesign,whowillbehappywithmakinggamesjusttohavethepleasureofseeingpeopleenjoytheirideas.
Ifyouwanttomakeprofessionalgames,orifyouwanttolearnManagedDirectX,thisbookisareallygoodstartingpoint,butthere'salotmoreyouneedtostudybeforeenteringthegameindustry.
Aswe'veseen,ittakesalotofhardworkandcoordinatedefforttomakeablockbustergamenowadays,butdon'tbescaredoffbythesizeofthemountainyou'reabouttoclimb.
Remember:MaybeyourgamewillbethenextPac-Man,Tetris,orFlightSimulator.
Justkeepinmindonething:Agreatgamestartswithagoodidea!
HowtoReadThisBookThisbookaimstobeapracticalguideforgameprogramming,andtogetthemostoutofit,wesuggestthatyoustarteachchapterbyrunningthechapter'ssamplegamefromthedownloadablecodeontheApressWebsite.
Openthepro-jectinVisualStudio.
NET,andcompileandrunit.
Playforawhile,lookingatthedetailsofthegame,sothatwhenyoustartreadingeachchapteryou'llknowwhatthechapterisabout.
BookContentsInthisbook,we'llcreatefourdifferentgamesspanningsevenchapters,plusabonuschapterattheend.
Thecodeisalsoorganizedbychapter,andinmanycasesisorganizedinincrementalsteps.
TheprogramswerecreatedandtestedIntroductionxxiiiIntroductionxxivwithDirectX9.
0(Summer2003Update)andVisualStudio2003.
You'llneedtoseparatelydownloadtheDirectXSDKfromhttp:I/msdn.
microsoft,com/directx,andifyoudecidetouseadifferenteditor,you'llhavetocreateprojectfilesinwhicheverformatthattoolsupports.
It'sentirelypossibletoedit/runallthesegameswithonlythe.
NETandDirectXSDKs,plusasimpletexteditorlikeNotepad,butwerecommendusingVisualStudio,orsomeotherintelligenteditor,ifpossible.
Inthenextsections,wegiveabriefdescriptionofthecontentsofeachchapter.
Chapter1:.
Nettrix:GDI+andCollisionDetectionInthefirstchapter,weintroducetheconceptofcollisiondetectioningames,presentsimplealgorithmstomanagethedetectionofcollisionbetweenobjectsinagame,andintroducebasicconceptsabouttheGDI+,thegraphicallibraryusedbythe.
NETFrameworktoperformsimplegraphicaloperations.
Inthischapter,wecreateaTetrisclonecalled.
Nettrixtoillustratetheuseoftheseconcepts.
Chapter2:.
Netterpillars:ArtificialIntelligenceandSpritesHereweexaminetheconceptofobject-orientedprogramming,alongwithaglossaryofrelatedterms.
Wealsoexplaintheideaofcreatingalibraryofgameclasses,whichcanbeusedinfurthergamedevelopmentstoimprovethegamequalityandthegameprojectschedule.
Inthischapter,wealsoprovideabriefintroductiontoartificialintelligenceingames,presentingsomeclassicalproblemsyouneedtodealwithinyourgamesalongwithsomesuggestionsabouthowtosolvethem.
Thechapter'ssamplegame,.
Netterpillars,isaSnakesclonethatexplorestheconceptspresentedinthechapter.
Hereweshowyouhowtocreatethefirstreusableclassofthisbook-aGDI+-basedsprite.
Chapter3:ManagedDirectXFirstSteps:Direct3DBasicsandDirectXvs.
GDI+Chapter3presentsManagedDirectX9.
0,exploringthebasicssuchastheuseofmatrixtransformations,transparenttexturing,andcoloredlights.
Herewealsodiscusshowtodecidewhichgraphicslibrary(DirectXorGDI+)tousedependingonthegametype.
Inthischapter,wehavenogame,justasimpleapplicationthatwillexerciseeachofthischapter'sconcepts.
Chapter4:SpaceDonuts:SpritesRevisitedInChapter4,wediscussthecreationofspritesusingaspecialclassfromManagedDirectX.
WealsointroducethebasicconceptsofDirectSoundandDirectlnput.
Usingtheclassesandconceptsdiscussedinthischapter,wewalkyouthroughthecreationofanAsteroidsclonecalledSpaceDonuts.
Chapters:Spacewar!
HerewelookatadditionaltechniquesofrewritingcodethatusedearlierversionsofDirectX,payingparticularattentiontotheDirectDrawlibraries.
Inaddition,weintroducetheconceptsofDirectPlay,whichgivesyoutheabilitytowritenet-worked,multiplayergames.
ThischaptercreatesanimplementationoftheSpacewargame,oneofthefirstgamesevercreatedonacomputer,andstillenjoyabletothisday.
Chapter6:Spacewar3D:MeshesandBuffersandTextures~OhMy!
WenowtaketheSpacewargameandlaunchourselvesintotheworldofDirect3D.
Thischaptercoversmanynew3-Dconcepts,butalsoshowshowtocarryovercodethatexistedinthe2-DversionofSpacewar.
Chapter7:AddingVisualEffectstoSpacewar3DThischaptergoesintothedetailsofwritinggamesthatusepointsprites,arela-tivelyadvancedconcept,butonethatyieldssignificantvisualbenefits.
BonusChapter:Porting.
NettrixtoPocketPCInthisbonuschapter,wediscusstheproblemsdevelopersfacewhenportinggamestodifferentdevices,andpresentthe.
NETCompactFramework.
IntroductionXXVIntroductionxxviUsingtheseconcepts,weshowyouhowtocreateasecondversionofyourTetrisclonebyportingthesamplegamecreatedinChapter1torunonaPocketPC.
AppendixesInordertogiveyouasenseofwhatprofessionalgarnersthinkaboutgamecre-ation,we'veincludedasappendixesarticlesfromthreeprofessionalswhoalreadyworkinthegameindustry,plusasectiononrecommendedbookstoread:AppendixA:SuggestedReadingAppendixB:"MotivationsinGames,"bySarbasstHassanpourAppendixC:"HowDoIMakeGames-APathtoGameDevelopment,"byGeoffHowlandAppendixD:"GuidelinesforDevelopingSuccessfulGames,"byBruceShelley

Gcore(gcorelabs)俄罗斯海参崴VPS简单测试

有一段时间没有分享Gcore(gcorelabs)的信息了,这是一家成立于2011年的国外主机商,总部位于卢森堡,主要提供VPS主机和独立服务器租用等,数据中心包括俄罗斯、美国、日本、韩国、新加坡、荷兰、中国(香港)等多个国家和地区的十几个机房,商家针对不同系列的产品分为不同管理系统,比如VPS(Hosting)、Cloud等都是独立的用户中心体系,部落分享的主要是商家的Hosting(Virtu...

HostKvm开年促销:香港国际/美国洛杉矶VPS七折,其他机房八折

HostKvm也发布了开年促销方案,针对香港国际和美国洛杉矶两个机房的VPS主机提供7折优惠码,其他机房业务提供8折优惠码。商家成立于2013年,提供基于KVM架构的VPS主机,可选数据中心包括日本、新加坡、韩国、美国、中国香港等多个地区机房,均为国内直连或优化线路,延迟较低,适合建站或者远程办公等。下面列出几款主机配置信息。美国洛杉矶套餐:美国 US-Plan1CPU:1core内存:2GB硬盘...

阿里云服务器绑定域名的几个流程整理

今天遇到一个网友,他之前一直在用阿里云虚拟主机,我们知道虚拟主机绑定域名是直接在面板上绑定的。这里由于他的网站项目流量比较大,虚拟主机是不够的,而且我看他虚拟主机已经有升级过。这里要说的是,用过阿里云虚拟主机的朋友可能会比较一下价格,实际上虚拟主机价格比云服务器还贵。所以,基于成本和性能的考虑,建议他选择云服务器。毕竟他的备案都接入在阿里云。这里在选择阿里云服务器后,他就蒙圈不知道如何绑定域名。这...

sourcegear为你推荐
百度k站被百度k站之后你一般是怎么处理的无线路由器限速设置无线路由器能设置限速吗?或者说那个牌子的能。办公协同软件协同企业办公的软件有哪些?畅想中国未来的中国是什么样子的怎么升级ios6iPad怎么升级到iOS6正式版?ios系统ios系统的手机有哪些?rewritebase为什么我写.htaccess这个 rewriterule 进入死循环了,高手帮忙修改优锁笔记本电脑怎么样防止被盗小米什么时候抢购小米手机预约成功后什么时候抢购?recovery教程怎样进入recovery进行双清
四川虚拟主机 动态域名解析软件 域名停靠一青草视频 x3220 监控宝 免费网络电视 卡巴斯基永久免费版 七夕促销 谁的qq空间最好看 股票老左 泉州移动 卡巴斯基免费试用 厦门电信 万网空间管理 游戏服务器出租 云服务器比较 实惠 空间服务器 亿库 websitepanel 更多