Duel: DirectX Duel Sample Game

Click to open or copy the files for the Duel sample.

Click to open or copy the Misc files (required).

This program requires less than 1 MB of video RAM.

The commands which this game recognizes are listed on the opening screen. These commands include the following:

Key Action
ESC, F12 Quit
NUMPAD 4 Turn left
NUMPAD 6 Turn right
NUMPAD 5 Stop moving
NUMPAD 8 Accelerate forward
NUMPAD 2 Accelerate backward
SPACEBAR Fire
ENTER Start game
F5 Toggle frame rate display

Also see the Dplaunch example.

To play multiplayer, one machine hosts a game, then others join.

To play using TCP/IP over the Internet, the people who are joining the game must enter the IP address of the machine that hosted the game. You can find out the IP address of your machine by running "winipcfg". If you have a net card and a modem installed, you will need to make sure you read the IP address of the modem connection to the Internet. The modem will show up as a "PPP Adapter".  DirectPlay will not work through proxies or firewalls.

Building SDK Samples

This sample uses the following keywords:

_t; _tcscpy; acquire; addblock; addfrag; additemtotree; adjustwindowrectex; ansitowide; beginpaint; blt; bltfast; bltobject; bltscore; bltsplash; cleanupapplication; cleanupcomm; cleanupfonts; cleanupgraphics; cleanupinput; cleanupsfx; clienttoscreen; closehandle; cocreateinstance; coinitialize; convertfield; copymemory; couninitialize; createclipper; createcompatibledc; createdevice; createdialog; createfile; createfontindirect; createpalette; createsurface; createthread; createwindowex; d3dval; ddcolormatch; ddcopybitmap; ddloadbitmap; ddloadpalette; ddreloadbitmap; ddsetcolorkey; debug_out; define_guid; defwindowproc; deletedc; deleteobject; destroygame; destroyship; destroywindow; di_readkeys; directdrawcreate; directinputcreate; directplaylobbycreate; directsoundcreate; dispatchmessage; displayframerate; dlgprocchooseprovider; dlgprochostsession; doapplicationmessage; dosystemmessage; dowizard; dpenumconnectionscallback; dplayclose; dplaycreate; dplaycreateplayer; dplaycreatesession; dplaydestroyplayer; dplayenumplayers; dplayenumsessions; dplaygetplayerdata; dplaygetsessiondesc; dplayopensession; dplayreceive; dplayrelease; dplaysend; dplaysetplayerdata; dplobbyconnect; dplobbycreate; dplobbygetconnectionsettings; dplobbyrelease; dplobbysetconnectionsettings; drawblock; drawbullet; drawfragments; drawscore; drawscreen; drawship; dsfillsoundbuffer; dsgetwaveresource; dsparsewaveresource; dsreloadsoundbuffer; endpaint; enumplayer; enumsession; erasescreen; exitgame; failed; finditemintree; findresource; flip; flipscreen; fliptogdi; fliptogdisurface; free; free_globals; free_sounds; getattachedsurface; getclientrect; getconnection; getdc; getdevicecaps; getdevicestate; getdigit; getdlgitem; getdlgitemtext; getexitcodethread; getmenu; getmessage; getmodulehandle; getobject; getparent; getpixel; getstockobject; getsurfacedesc; getsystemmetrics; gettickcount; getwindowexstyle; getwindowrect; getwindowstyle; globalallocptr; globalfreeptr; globalreallocptr; guidfromstring; idirectdrawsurface_blt; idirectplay2_close; idirectplay2_createplayer; idirectplay2_destroyplayer; idirectplay2_enumplayers; idirectplay2_enumsessions; idirectplay2_getplayerdata; idirectplay2_getsessiondesc; idirectplay2_open; idirectplay2_receive; idirectplay2_release; idirectplay2_send; idirectplay2_setplayerdata; idirectplay3_enumconnections; idirectplay3_initializeconnection; idirectplay3_release; idirectplay_queryinterface; idirectplaylobby_connect; idirectplaylobby_getconnectionsettings; idirectplaylobby_release; idirectplaylobby_setconnectionsettings; idirectsound3dbuffer_release; idirectsound3dbuffer_setposition; idirectsound3dbuffer_setvelocity; idirectsound3dlistener_commitdeferredsettings; idirectsound3dlistener_release; idirectsound3dlistener_setdopplerfactor; idirectsound3dlistener_setposition; idirectsound3dlistener_setrollofffactor; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsound_release; idirectsound_setcooperativelevel; idirectsoundbuffer_getcaps; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_queryinterface; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; imagelist_add; imagelist_create; imagelist_getimagecount; init_globals; init_sounds; initapplication; initfield; initgraphics; initinput; initlocalsounddata; initmessagebuffers; initourship; initplayerlocalsounddata; initsfx; inittreeviewimagelists; isdplay; isequalguid; ishit; isspace; killtimer; launchedbylobby; launchgame; loadbitmap; loadcursor; loadicon; loadimage; loadresource; loadstring; lock; lockresource; m2p; mainwndproc; makeintresource; makelparam; malloc; memcpy; memset; messagebox; mmiofourcc; multibytetowidechar; outputdebugstring; p2m; pack; peekmessage; postmessage; postquitmessage; processsoundflags; processuserinput; propertysheet; propsheet_setwizbuttons; queryinterface; rand; randdouble; randint; reacquireinputdevices; readfile; receivemessages; regcreatekeyex; regget; registerclass; regqueryvalueex; regset; regseta; regsetvalueex; release; releasedc; releaselocaldata; releaseplayerlocaldatacb; releaseplayerlocalsounddata; releasesessiondata; releasespdata; removestalesessions; renderplayercb; resettreerefresh; restore; restoresurfaces; selectobject; senddlgitemmessage; sendgamemessage; sendmessage; sendsync; setblock; setclipper; setcolorkey; setcooperativelevel; setdataformat; setdisplaymode; setdlgitemtext; setfocus; setgamepalette; sethwnd; setpalette; setpixel; setplayerlocalsounddatacb; setrect; settimer; setupfonts; setwindowlong; setwindowpos; setwindowtext; showconnectstatus; showerror; showwindow; srand; stretchblt; stringfromguid; succeeded; switch; systemparametersinfo; text; timegettime; translatemessage; treeview_deleteallitems; treeview_deleteitem; treeview_getchild; treeview_getfirstvisible; treeview_getitem; treeview_getnextitem; treeview_getnextsibling; treeview_getparent; treeview_getroot; treeview_getselection; treeview_selectitem; treeview_setimagelist; unacquire; unlock; updatedisplaystatus; updatefragment; updateframe; updateposition; updatestate; updatetitle; updatewindow; wavefree; wavegetbuffers; waveinit; wavereload; wcslen; widechartomultibyte; widetoansi; winmain; wsprintf; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory