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
2021年6月底,raksmart开发出来的新产品“cloud-云服务器”正式上线对外售卖,当前只有美国硅谷机房(或许以后会有其他数据中心加入)可供选择。或许你会问raksmart云服务器怎么样啊、raksm云服务器好不好、网络速度快不好之类的废话(不实测的话),本着主机测评趟雷、大家受益的原则,先开一个给大家测评一下!官方网站:https://www.raksmart.com云服务器的说明:底层...
简介华圣云 HuaSaint是阿里云国际版一级分销商(诚招募二级代理),专业为全球企业客户与个人开发者提供阿里云国际版开户注册、认证、充值等服务,通过HuaSaint开通阿里云国际版只需要一个邮箱,不需要PayPal信用卡,不需要买海外电话卡,绝对的零门槛,零风险官方网站:www.huasaint.com企业名:huaSaint Tech Limited阿里云国际版都有什么优势?阿里云国际版的产品...
BuyVM测评,BuyVM怎么样?BuyVM好不好?BuyVM,2010年成立的国外老牌稳定商家,Frantech Solutions旗下,主要提供基于KVM的VPS服务器,数据中心有拉斯维加斯、纽约、卢森堡,付费可选强大的DDOS防护(月付3美金),特色是1Gbps不限流量,稳定商家,而且卢森堡不限版权。1G或以上内存可以安装Windows 2012 64bit,无需任何费用,所有型号包括免费的...
sourcegear为你推荐
ps抠图技巧photoshop最基本的抠图方法和技巧!童之磊华硕的四核平板电脑,怎么样?怎么升级ios6苹果IOS5怎么升级IOS6版本lockdowndios8.1怎么激活内置卡贴blogcn怎样设置BLOGCN的访问密码聚美优品红包聚美优品怎么给别人发红包如何修改ie主页怎样修改IE主页尚易企业邮局尚易企业邮箱的服务怎么样请客网《请客》这篇文章说明了什么道理?优锁一个大家还没有认的产品,应该怎么去做市场呢?
虚拟主机代理 免费网站域名申请 免费申请域名和空间 inmotionhosting 美国主机推荐 视频存储服务器 360抢票助手 光棍节日志 好玩的桌面 浙江独立 卡巴斯基官方免费版 电子邮件服务器 softbank邮箱 如何建立邮箱 网页提速 supercache ssl加速 netvigator windowsserver2012r2 websitepanel 更多