<<

DirectXexplained Everwonderedjustwhatthatenigmaticnamemeans? Gamingandmultimediaapplicationsaresomeofthemostsatisfyingprogramsyou cangetforyourPC,butgettingthemtorunproperlyisntalwaysaseasyasit ouldbe.First,thePCarchitecturewasneverdesignedasagamingplatform.Sec ond,thewiderangingnatureofthePCmeansthatonepersonsmachinecanbediff erentfromanother.Whilegamesconsolesallcontainthesamehardware,PCsdont:

themassiverangeofdifferencecanma egamingaheadache.

Toalleviateasmuchofthepainaspossible,neededtointroduceaco mmonstandardallgamesandmultimediaapplicationscouldfollowacommon interfacebetweentheOSandwhateverhardwareisinstalledinthePC,ifyouli

e.ThiscommoninterfaceisDirectX,somethingwhichcanbethesourceofmuch

confusion.

DirectXisaninterfacedesignedtoma ecertainprogrammingtas smucheasier,

forboththegamedeveloperandtherestofuswhojustwanttositdownandpla

ythelatestbloc buster.BeforewecanexplainwhatDirectXisandhowitwor s though,weneedalittlehistorylesson. DirectXhistory

Anygameneedstoperformcertaintas sagainandagain.Itneedstowatchfory

ourinputfrommouse,joystic or eyboard,anditneedstobeabletodisplays creenimagesandplaysoundsormusic.Thatsprettymuchanygameatthemostsim plisticlevel. Imaginehowincrediblycomplexthiswasforprogrammersdevelopingontheearly

preWindowsPCarchitecture,then.Eachprogrammerneededtodeveloptheirownw

ayofreadingthe eyboardordetectingwhetherajoystic wasevenattached,le talonebeingusedtoplaythegame.Specificroutineswereneededeventodispl aythesimplestofimagesonthescreenorplayasimplesound.

Essentially,thegameprogrammersweretal ingdirectlytoyourPCshardwareata fundamentallevel.WhenMicrosoftintroducedWindows,itwasimperativeforthe stabilityandsuccessofthePCplatformthatthingsweremadeeasierforboth thedeveloperandtheplayer.Afterall,whowouldbotherwritinggamesforama

chinewhentheyhadtoreinventthewheeleverytimetheybeganwor onanewga

me?Microsoftsideawassimple:stopprogrammerstal ingdirectlytothehardware

,andbuildacommontool itwhichtheycoulduseinstead.DirectXwasborn.

Howitwor s Atthemostbasiclevel,DirectXisaninterfacebetweenthehardwareinyourPC andWindowsitself,partoftheWindowsAPIorApplicationProgrammingInterfac

e.Letsloo atapracticalexample.Whenagamedeveloperwantstoplayasound file,itssimplyacaseofusingthecorrectfunction.Whenthegameruns ,thiscallstheDirectXAPI,whichinturnplaysthesoundfile.Thedeveloper

doesntneedto nowwhatofsoundcardhesdealingwith,whatitscapableof,

orhowtotal toit.MicrosofthasprovidedDirectX,andthesoundcardmanufac

turerhasprovidedaDirectXcapabledriver.Heas sforthesoundtobeplayed, anditiswhichevermachineitrunson.

Fromourpointofviewasgamers,DirectXalsoma esthingsincrediblyeasyatl eastintheory.Youinstallanewsoundcardinplaceofyouroldone,anditco meswithaDirectXdriver.Nexttimeyouplayyourfavouritegameyoucanstill

hearsoundsandmusic,andyouhaventhadtoma eanycomplexconfigurationchang es. Originally,DirectXbeganlifeasasimpletool it:earlyhardwarewaslimiteda ndonlythemostbasicgraphicalfunctionswererequired.Ashardwareandsoftwa rehasevolvedincomplexity,sohasDirectX.Itsnowmuchmorethanagraphical

tool it,andthetermhascometoencompassamassiveselectionofroutineswhic hdealwithallsortsofhardwarecommunication.Forexample,theDirectInputro utinescandealwithallsortsofinputdevices,fromsimpletwomiceto

complexflightjoystic s.OtherpartsincludeDirectSoundforaudiodevicesand

DirectPlayprovidesatool itforonlineormultiplayergaming. DirectXversions ThecurrentversionofDirectXattimeofwritingisDirectX9.0.Thisrunsona llversionsofWindowsfromWindows98uptoandincludingWindowsServer2003a longwitheveryrevisioninbetween.ItdoesntrunonWindows95though:ifyouh

aveamachinewithWindows95installed,yourestuc withtheolderandlesscapa ble8.0a.WindowsNT4alsorequiresaspecificversioninthiscase,itsDirectX 3.0a.

WithsomanyversionsofDirectXavailableovertheyears,itbecomesdifficult to eeptrac ofwhichversionyouneed.Inallbutthemostrarecases,allver

sionsofDirectXarebac wardlycompatiblegameswhichsaytheyrequireDirectX 7willhappilyrunwithmorerecentversions,butnotwitholdercopies.Manycu rrenttitlesexplicitlystatethattheyrequireDirectX9,andwontrunwithoutt

helatestversioninstalled.Thisisbecausetheyma euseofnewfeaturesintro

ducedwiththisversion,althoughithasbeen nownforlazydeveloperstospeci fytheverylatestversionasarequirementwhenthegameinquestiondoesntuse

anyofthenewenhancements.Generallyspea ingthough,ifatitleisversionlo

c edli ethis,youwillneedtoupgradebeforeyoucanplay.Improvementstoth ecoreDirectXcodemeanyoumayevenseeimprovementsinmanytitleswhenyouu pgradetothelatestbuildofDirectX.DownloadingandinstallingDirectXneedn otbecomplex,either. UpgradingDirectX AllavailableversionsofWindowscomewithDirectXinoneformoranotherasa coresystemcomponentwhichcannotberemoved,soyoushouldalwayshaveatleas tabasicimplementationofthesysteminstalledonyourPC.However,manynewg

amesrequiretheverylatestversionbeforetheywor properly,orevenatall. Generally,thebestplacetoinstallthelatestversionofDirectXfromisthe edicatedsectionoftheMicrosoftWebsite,whichisfoundatwww.microsoft.com/ windows/directx.Aswewenttopress,themostrecentbuildavailableforgenera ldownloadwasDirectX9.0b.Youcandownloadeitherasimpleinstallerwhichwi llinturndownloadthecomponentsyoursystemrequiresasitinstalls,ordownl

oadthecompletedistributionpac ageinonegoforlaterofflineinstallation. AnothergoodsourceforDirectXisgamesthemselves.Ifagamerequiresaspecif icversion,itllbeontheinstallationandmayevenbeinstalledautomaticall ybythegamesinstalleritself.Youwontfinditonmagazinecoverdiscsthough,

than stoMicrosoftslicensingterms. Diagnosingproblems DiagnosingproblemswithaDirectXinstallationcanbeproblematic,especiallyi

fyoudont nowwhichoneofthemanycomponentsiscausingyournewlypurchased

gametofallover.Than fully,MicrosoftprovidesausefulutilitycalledtheDi rectXDiagnosticTool,althoughthisisntmadeobvious.Youwontfindthistoolin theMenuwithanyversionofWindows,andeachtendstoinstallitinad ifferentplace.

TheeasiestwaytouseitistoopentheStartMenusRundialog,typeindxdiaga

ndthenclic OK.Whentheapplicationfirstloads,itta esafewsecondstoin terrogateyourDirectXinstallationandfindanyproblems.First,theDirectXFi lesdisplaysversioninformationoneachoneofthefilesyourinstallation

uses.TheNotessectionatthebottomisworthchec ing,asmissingorcorrupted

fileswillbeflaggedhere.

Thetabsmar edDisplay,Sound,Music,InputandNetwor allrelatetospecific areasofDirectX,andallbuttheInputtabprovidetoolstotestthecorrectfu nctioningonyourhardware.Finally,theMoreHelptabprovidesausefulwayto starttheDirectXTroubleshooter,Microsoftssimplelinearproblemsolvingtoolf ormanycommonDirectXissues.