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

JustHost,最新高性价比超便宜俄罗斯CN2 VPS云服务器终身8折优惠,最低仅8元/月起,200Mbps带宽不限流量,五大机房自助自由切换,免费更换IP,俄罗斯cn2vps怎么样,justhost云服务器速度及综合性能详细测评报告

主机参考最新消息:JustHost怎么样?JustHost服务器好不好?JustHost好不好?JustHost是一家成立于2006年的俄罗斯服务器提供商,支持支付宝付款,服务器价格便宜,200Mbps大带宽不限流量,支持免费更换5次IP,支持控制面板自由切换机房,目前JustHost有俄罗斯5个机房可以自由切换选择,最重要的还是价格真的特别便宜,最低只需要87卢布/月,约8.5元/月起!just...

RackNerd 黑色星期五5款年付套餐

RackNerd 商家从2019年上线以来争议也是比较大的,一直低价促销很多网友都认为坚持时间不长可能会跑路。不过,目前看到RackNerd还是在坚持且这次黑五活动也有发布,且活动促销也是比较多的,不过对于我们用户来说选择这些低价服务商尽量的不要将长远项目放在上面,低价年付套餐服务商一般都是用来临时业务的。RackNerd商家这次发布黑五促销活动,一共有五款年付套餐,涉及到多个机房。最低年付的套餐...

乌云数据(10/月),香港cera 1核1G 10M带宽/美国cera 8核8G10M

乌云数据主营高性价比国内外云服务器,物理机,本着机器为主服务为辅的运营理念,将客户的体验放在第一位,提供性价比最高的云服务器,帮助各位站长上云,同时我们深知新人站长的不易,特此提供永久免费虚拟主机,已提供两年之久,帮助了上万名站长从零上云官网:https://wuvps.cn迎国庆豪礼一多款机型史上最低价,续费不加价 尽在wuvps.cn香港cera机房,香港沙田机房,超低延迟CN2线路地区CPU...

sourcegear为你推荐
authorware素材怎样把ppt课件转换为authorware根目录什么叫固件?什么叫根目录?spgnuxPC操作系统如何描述手机区号手机号码前怎样填写正确的国内区号?qq空间装扮qq空间的装扮空间在哪?iphone越狱后怎么恢复已经越狱的iphone怎么恢复到原来的系统bt封杀北京禁用BT下载,是真的吗?为什么?网管工具网管软件好用吗?什么样的网管软件好呢?我想管理二十台电脑,让其中的四五台可以上网,其它的只能上局域网,谁能推荐一款软件吗?如果出钱买也可以!谢谢了!声母是什么声母是什么?单韵母是什么微信怎么看聊天记录微信在手机上怎么查看聊天记录
免费域名注册 免费顶级域名 中国万网域名 免费动态域名 com域名抢注 bluehost sugarsync 日本空间 魔兽世界台湾服务器 本网站服务器在美国 php空间申请 七夕促销 已备案删除域名 秒杀汇 流量计费 web服务器安全 paypal注册教程 google台湾 空间购买 湖南idc 更多