Tricks of the Windows Game Programming Gurus:Index

All ITKnowledge Source Code Search Tips Advanced Search |

| Tricks of the Windows Game Programming Gurus by Andre LaMothe Sams, Macmillan Computer Publishing ISBN: 0672313618 Pub Date: 09/27/99

Search this book:

Table of Contents

## Index

Symbols

  & (ampersand), 118
  /* */ comment operator, 929
  // comment operator, 929
  :: operator, 943–944
  << operator, 933
  >> operator, 934
  5.6.5 bit encoding format, 290
  8-bit bitmaps, loading, 353–354
  8-bit windows modes, 398–399
  16-bit bitmaps, loading, 354–355
  16-bit high-color mode
    bit encoding formats, 289–290
    pixel formats
      DDPIXELFORMAT structure, 290–293
      finding, 290
    sample program, 293
    writing to screen, 293–298
  24-bit bitmaps, loading, 355–356
  24-bit high-color mode, 299
  32-bit high-color mode, 300–301
  32-bit variables, 22

A

  A* search, 759
  absolute mode (mouse), 556
  acceleration, 804–807
  Acquire() function, 543
  acquiring devices, 543
    joysticks, 573
    keyboard devices, 551
    mouse devices, 559
    reacquisition, 554–556
  actions (AI), 741
  addition. See also mathematics
    fixed-point mathematics, 676
    matrices, 449
    vectors, 918–919
  AddPort() function, 626
  AddRef() function, 221–222
  AdjustWindowRectEx() function, 396
  AI (artificial intelligence), 713–715
    design guidelines, 794–795
    deterministic algorithms, 715
      evasion algorithms, 722
      random motion, 716–717
      tracking algorithms, 717–721
    FSMs (finite state machines), 729–730
      example, 730–734
      personality traits, 734–736
    fuzzy logic, 772–773
      FAMs (fuzzy associative matrices), 783–793
      FLVs (fuzzy linguistic variables), 776–779
      fuzzy set theory, 774–776
      manifolds, 779–783
      normal set theory, 773–774
    genetic algorithms, 770–772
    memory/learning, 736–740
    neural networks, 767–770
      McCulloch-Pitts neurode summation() function, 768
      truth table, 769
    pathfinding, 747, 754–756
      A* search, 759
      bidirectional breadth-first searches, 757
      breadth-first searches, 756–757
      collision avoidance tracks, 749–750
      contour tracing, 749
      depth-first searches, 757–758
      Dijkstra’s search, 759
      racing game example, 753–754
      trial-and-error algorithms, 748–749
      waypoints, 750–753
    patterns (control scripting), 722–723
      conditional logic, 727–729
      creating, 723–724
      processing, 725–726
      reasonable motion, 726–727
    planning
      actions, 741
      decision trees, 742–745
      goals, 740–741
      hard-coded plans, 742
      implementing, 745–747
      production rules, 742
    scripting, 759
      C/C++ compiler, 762–767
      Functions section, 763
      Globals section, 763
      Main section, 763
      scripting language design, 759–762
  AI-controlled demo mode, 682
  algorithms, 24. See also mathematics
    asymptotic analysis, 657–659
    Bresenham’s algorithm, 403–406
      accuracy, 406
      code listing, 407–409
      optimization, 409
    Cohen-Sutherland algorithm, 420–427
    collision algorithm, 849–852
    deterministic AI (artificial intelligence) algorithms, 715
      evasion algorithms, 722
      random motion, 716–717
      tracking algorithms, 717–721
    Fibonacci algorithm, 662
    genetic, 770–772
    pathfinding, 747, 754–756
      A* search, 759
      bidirectional breadth-first searches, 757
      breadth-first searches, 756–757
      collision avoidance tracks, 749–750
      contour tracing, 749
      depth-first searches, 757–758
      Dijkstra’s search, 759
      racing game example, 753–754
      trial-and-error algorithms, 748–749
      waypoints, 750–753
    recursion, 659–662
    Run-Slicing algorithm, 409
    Symmetric Double Step algorithm, 411
  allocating memory, 931
  Alpha(8).8.8.8 bit encoding format, 300
  Alpha.5.5.5 bit encoding format, 289
  ampersand (&), 118
  amplitude, 592, 596
  analyzing algorithms (asymptotic analysis), 657–659
  AND operations, 769
  angles
    critical, 826
    of incidence, 830
    of reflection, 830
  Animate_BOB() function, 534
  animation
    color animation, 373–379
    double-buffering, 301–302
      implementing, 303–305
      optimizing, 304
      sample program, 305–307
    page flipping, 302–303
      Flip() function, 311–313
      sample program, 313–317
    triple-buffering, 312
  antecedents (production rules), 742
  arcade games, 14
  architecture (Windows)
    event model, 53–54
    multitasking, 51–52
    multithreading, 51–53
  arithmetic. See mathematics
  arrays, 648–649
  artificial intelligence. See AI
  ASCII characters, 151, 955–960
  assembly language, 679
  asteroid field (Outpost game), 882–884
  asymptotic analysis, 657–659
  attaching color palettes to surfaces, 272
  audio. See sound
  axons, 767

B

  B-trees. See BSTs (binary search trees)
  back buffers, 243, 307–309
  background color, 139–140
  backups, 25
  BeginPaint() function, 129–130
  behavioral state systems. See FSMs (finite state machines)
  Belm Design Group, 953
  bi-linear filtering, 371
  bidirectional breadth-first searches, 757
  Big O notation, 657
  big-endian format, 290
  binary search trees. See BSTs
  binary shifts, 24
  bit encoding formats, 289–290, 300
  BITMAPFILEHEADER structure, 346
  BITMAPINFO structure, 346
  BITMAPINFOHEADER structure, 346–347
  bitmaps (.BMP files), 97
    blitting, 317–319
      Blit8x8() function, 319–320
      Blt() function, 321–324
      BltFast() function, 324–325
      memory fills, 325–328
      offscreen surfaces, 358–360, 365–366
      surface to surface, 328–331
    clipping, 332–339
      IDirectDrawClipper interface, 339–344
      pixels, 332–333
    file structure
      BITMAPFILEHEADER, 346
      BITMAPINFO, 346
      BITMAPINFOHEADER, 346–347
      DATA AREA, 347
    functions, 519–522
    loading
      8-bit images, 353–354
      16-bit images, 354–355
      24-bit images, 355–356
      LoadBitmap() function, 348
      LoadImage() function, 348–349
      Load_Bitmap_File() function, 349–351
    mapping
      forward mapping, 368
      inverse mapping, 369
    reading manually, 348
    rotating, 366–368
    scaling, 366–373
    templates, 352
    unloading, 351–352
  bits per pixel (bpp), 133
  black holes, simulating, 815–816
  BLACKOUT.H header file (FreakOut), 31–33
  blinking lights animation, 374–379
  Blink_Colors() function, 525
  Blit8x8() function, 319–320
  blitter, 317–319
    bitmaps, copying from surface to surface, 328–331
    Blit8x8() function, 319–320
    Blt() function
      dwFlags parameter, 321–324
      lpDDBltFx parameter, 321–322
      lpDDSrcSurface parameter, 321
      lpDestRect parameter, 321
      lpSrcRect parameter, 321
    BltFast() function, 324–325
    memory fills, 325–328
    offscreen surfaces, 358–360, 365–366
  Blitter Object engine. See BOB engine
  Blt() function
    dwFlags parameter, 321–324
    lpDDBltFx parameter, 321–322
    lpDDSrcSurface parameter, 321
    lpDestRect parameter, 321
    lpSrcRect parameter, 321
  BltFast() function, 324–325
  Blues News Web site, 952
  BMP files. See bitmaps
  board games, 14
  BOB (Blitter Object) engine, 527–528
    Animate_BOB() function, 534
    Collision_BOBS() function, 535
    Create_BOB() function, 528–530
    Destroy_BOB() function, 530
    Draw_BOB() function, 530–531
    Draw_Scaled_BOB() function, 531
    Hide_BOB() function, 535
    Load_Animation_BOB() function, 532
    Load_Frame_BOB() function, 531
    Move_BOB() function, 534
    Set_Animation_BOB() function, 534
    Set_Anim_Speed() function, 533
    Set_Pos_BOB() function, 533
    Set_Vel_BOB() function, 533
    Show_BOB() function, 535
  bouncing objects, modeling, 828–830
  bounding boxes, 481–484
  bounding circles, 478–481
  bpp (bits per pixel), 133
  brainstorming, 14–15
  breadth-first searches, 756–757
  Bresenham’s algorithm, 403–406
    accuracy, 406
    code listing, 407–409
    optimization, 409
  brushes (GDI), 172–173
  BSTs (binary search trees), 662–666
    building, 666–668
    orders, 662
    searching, 668–671
  BS_3STATE button style, 191
  BS_AUTO3STATE button style, 192
  BS_AUTOCHECKBOX button style, 192
  BS_AUTORADIOBUTTON button style, 192
  BS_CHECKBOX button style, 191
  BS_OWNERDRAW button style, 192
  BS_PUSHBUTTON button style, 191
  BS_RADIOBUTTON button style, 191
  buffered data mode (DirectInput), 544
  buffers (DirectSound)
    execute buffers, 218
    primary, 606
    secondary
      circular buffering, 607
      creating, 607–610
      locking, 610–611
      releasing, 611
      static, 606
      streaming, 606
      unlocking, 611
      writing to, 610–611
  busy loops, 701
  buttons
    creating, 193
    notification codes, 193–194
    styles, 191–192

C

  C++, 925–928
    classes, 926, 934
      constructors, 938–941
      defining, 935–936
      destructors, 939–943
      member functions, 937–938, 945–946
      public/private, 936
    comments, 929
    constants, 929
    inheritance, 926–927
    memory management, 931–932
    operators
      delete, 931–932
      new, 931–932
      overloading, 945–946
      scope resolution, 943–944
    polymorphism, 927–928
    stream I/O (input/output), 932–934
    structures, 934–935
    variable
      creating, 930–931
      referential, 929–930
  C/C++ compiler, 26, 762–767
    configuring, 908
      application types, 909
      code generation, 910
      error-level settings, 909
      optimization settings, 909
      search directories, 909
      struct alignment, 910
      threading models, 910
      typecast errors, 909
    directives, 60
  calculations. See algorithms; mathematics
  Cartesian coordinate system, 174
  cascading menus, 117
  cbClsExtra field (WNDCLASSEX structure), 70
  cbSize field (WNDCLASSEX structure), 67
  cbWndExtra field (WNDCLASSEX structure), 70
  cell-based isometric engines, 496–498
  centroids, calculating, 790–793
  characters (ASCII), 955–960
  child controls. See controls
  cilia, 592
  circles, drawing, 180–181
  circular buffering, 607
  class keyword, 935
  classes, 934
    constructors, 938–941
    defining, 935–936
    destructors, 939–943
    inheritance, 926–927
    IOSTREAM, 932
    member functions, 937–938, 945–946
    naming, 57
    public/private, 936
    Windows classes, 66
      registering, 74
      style flags, 67–68
      WNDCLASS structure, 67
      WNDCLASSEX structure, 67–74
  client area (DirectDraw windows), 395–397
  client coordinates, 132
  clip lists, 340–342
  clipping, 332
    bitmaps, 334–339
    DirectX windows, 397–398
    IDirectDrawClipper interface
      clip lists, 340–342
      creating, 339
      sample program, 342–344
    lines, 411–413, 419–420
      Cohen-Sutherland algorithm, 420–427
    pixels, 332–333
    triangles, 464
  Clip_Line() function, 514
  CloseHandle() function, 691–692
  Close_Error_File() function, 518
  CLUTs (color lookup tables), 136
  CoCreateInstance() function, 225, 625
  code optimization, 21–25, 671–672
    algorithms, 24
    assembly language, 679
    backups, 25
    binary shifts, 24
    comments, 23
    double-buffering, 304
    fixed-point math, 673–674
      accuracy, 676
      addition, 676
      converting to/from, 674–675
      division, 676–677
      multiplication, 676–677
      representing numbers, 674
      subtraction, 676
    functions
      inline, 22
      mathematical, 672–673
    look-up tables, 678–679
    loop unrolling, 677–678
    simplicity, 24–25
    variables, 22
  coefficient of restitution, 844–845
  Cohen-Sutherland algorithm, 420–427
  CoInitialize() function, 624
  collisions, 810
    2D object-to-object collision response, 841–842
      coefficient of restitution, 844–845
      collision algorithm, 849–852
      impact events, 843
      impulse force, 843
      n-t coordinate system, 846–849
    avoidance tracks, 749–750
    collision response, 813
    conservation of momentum, 811
    detecting
      bounding boxes, 481–484
      bounding circles, 478–481
      point containment, 484–486
    elastic vs. non-elastic, 828
    kinetic energy, 812
    line segment intersections, 835–840
    vector reflection
      calculating, 830–834
      example, 834–835
    x,y bounce physics, 828–830
  Collision_BOBS() function, 535
  Collision_Test() function, 526
  color
    animation, 373–379
    CLUTs (color lookup tables), 136
    color keys, 360–361
      destination color keying, 364–365
      source color keying, 361–363
    depth, 133
    DirectDraw palettes
      attaching to surfaces, 272
      color depths, 257
      creating, 259–263
    foreground/background, 139–140
    high-color modes
      16-bit, 289–298
      24-bit, 299
      32-bit, 300–301
      computational speed, 288
      memory bandwidth, 288
    interfaces
      IDirectDrawColor Control, 382–383
      IDirectDrawGamma Control, 383
    Outpost game, 877
    palette functions, 522–525
    palletized, 136–137
    RBG (red, green, blue) model, 135–137, 381
    rotation (color shifting), 379–381
    transforms, 381–382
  color keys, 360–361
    destination color keying, 364–365
    source color keying, 361–363
  color lookup tables (CLUTs), 136
  COLORREF structures, 385
  Color_Scan() function, 527
  COM (Component Object Model), 218–219
    COM++, 238
    DCOM (Distributed COM), 239
    function pointers, 232–235
    GUIDs (Globally Unique Identifiers), 223
    interfaces, 219–222
    object creation, 224–226
    sample program, 226–231
  ComCreate() function, 225
  comments, 23, 929
  compiler, 26, 762–767
    configuring, 908
      application types, 909
      code generation, 910
      error-level settings, 909
      optimization settings, 909
      search directories, 909
      struct alignment, 910
      threading models, 910
      typecast errors, 909
    directives, 60
  compiling
    DirectX programs, 231–232
    Outpost game
      compilation files, 897
      runtime files, 898
    resources, 98, 114–116
  complex surfaces, 309–310
  Component Object Model. See COM
  conditional logic
    AI (artificial intelligence) patterns, 727–729
    production rules, 742
  configuring
    C/C++ compiler, 909
    DirectInput, 542
    force feedback, 580–581
  consequences (production rules), 742
  conservation
    of kinetic energy, 812
    of momentum, 811
  console applications, 59
  const keyword, 57
  constants
    creating, 929
    naming, 57
  constructors, 938–941
  contour tracing, 749
  controls
    buttons, 190–191
      creating, 193
      notification codes, 193–194
      styles, 191–192
    sending messages to, 195–197
  cooperation levels
    DirectDraw
      control flags, 251–252
      setting, 251–254
    DirectInput
      joysticks, 568
      keyboard devices, 548–549
      mouse devices, 558
      setting, 543
    DirectSound
      exclusive, 604
      normal, 604
      priority, 604
      setting, 605
      Write_Primary, 605
  coordinates
    Cartesian system, 174
    homogenous, 453
    n-t coordinate system (collisions), 846–849
    polygons, 431
    windows, 132
  copying bitmaps. See blitter
  cosines, 913
  Cramer’s Rule, 839
  CreateClipper() function, 339
  CreateDevice() function, 542
  CreateHatchBrush() function, 172–173
  CreatePalette() function, 261–262
  CreatePen() function, 169–170
  CreateSolidBrush() function, 172
  CreateSoundBuffer() function, 607–609
  CreateSurface() function, 264
  CreateThread() function, 690–691
  CreateWindowEx() function, 75–76
  Create_Bitmap() function, 520
  Create_BOB() function, 528–530
  critical angle, 826
  critical sections, 710
  cross products, 921–923
  CS_DBLCLKS flag, 68
  CS_HREDRAW flag, 67
  CS_NOCLOSE flag, 68
  CS_OWNDC flag, 68
  CS_PARENTDC flag, 68
  CS_SAVEBITS flag, 68
  CS_VREDRAW flag, 68
  CURSOR keyword, 102
  Cursor, The, 952
  cursors, 97
    defining, 102–103
    loading, 103–104
    sample program, 104–106
    setting, 104

D

  data formats
    joysticks, 569
    keyboard devices, 549–551
    mouse devices, 558–559
    setting, 543
  data structures. See structures
  data types, 503–505
  dB (decibal), 613
  DCOM (Distributed COM), 239
  DDBLTFAST_ DESTCOLORKEY flag, 325
  DDBLTFAST_NOCOLORKEY flag, 325
  DDBLTFAST_SRCCOLORKEY flag, 325
  DDBLTFAST_WAIT flag, 325
  DDBLT_ASYNC flag, 324
  DDBLT_COLKEYSRCO VERRIDEORFILL flag, 323
  DDBLT_COLORFILL flag, 323
  DDBLT_DDFX flag, 323
  DDBLT_DDROPS flag, 323
  DDBLT_DEPTHFILL flag, 323
  DDBLT_KEYDEST flag, 324
  DDBLT_KEYDESTOVERRIDE flag, 323
  DDBLT_KEYSRC flag, 324
  DDBLT_ROP flag, 323
  DDBLT_ROTATIONANGLE flag, 324
  DDBLT_WAIT flag, 324
  ddckCKDestBlt field (DDSURFACE2 structure), 268
  ddckCKSrcBlt field (DDSURFACE2 structure), 268
  DDCKEY_COLORSPACE flag, 363
  DDCKEY_DESTBLT flag, 363
  DDCKEY_DESTOVERLAY flag, 363
  DDCKEY_SRCBLT flag, 363
  DDCKEY_SRCOVERLAY flag, 363
  DDCOLORCONTROL structure, 383
  DDERR_DIRECTDRAW ALREADYCREATED return code, 247
  DDERR_GENERIC return code, 247
  DDERR_INVALIDDIRECTDRAWGUID return code, 247
  DDERR_INVALIDPARAMS return code, 247
  DDERR_NODIRECTDRAWHW return code, 247
  DDERR_OUTOFMEMORY return code, 247
  DDPCAPS_1BIT control flag, 261
  DDPCAPS_2BIT control flag, 261
  DDPCAPS_4BIT control flag, 261
  DDPCAPS_8BIT control flag, 261
  DDPCAPS_8BITENTRIES control flag, 262
  DDPCAPS_ALLOW256 control flag, 262
  DDPCAPS_ALPHA control flag, 262
  DDPCAPS_INITIALIZE control flag, 262
  DDPCAPS_PRIMARYSURFACE control flag, 262
  DDPCAPS_VSYNC control flag, 262
  ddpfPixelFormat field (DDSURFACE2 structure), 268–269
  DDPF_ALPHA flag, 291
  DDPF_ALPHAPIXELS flag, 291
  DDPF_LUMINANCE flag, 291
  DDPF_PALETTEINDEXED1 flag, 291
  DDPF_PALETTEINDEXED2 flag, 291
  DDPF_PALETTEINDEXED4 flag, 291
  DDPF_PALETTEINDEXED8 flag, 291
  DDPF_PALETTEINDEXEDTO8 flag, 291
  DDPF_RGB flag, 291
  DDPF_ZBUFFER flag, 291
  DDPF_ZPIXELS flag, 291
  DDPIXELFORMAT structure, 290–291
  DDRAW.DLL file, 31
  DDRAW.LIB file, 31
  DDraw_Attach_Clipper() function, 342–344, 508
  DDraw_Create_Surface() function, 508
  DDraw_Fill_Surface() function, 509
  DDraw_Flip() function, 508
  DDraw_Init() function, 507
  DDraw_Lock_Back_Surface() function, 510
  DDraw_Lock_Primary_ Surface() function, 510
  DDraw_Lock_Surface() function, 509
  DDraw_Shutdown() function, 507
  DDraw_Unlock_Surface() function, 510
  DDraw_Wait_For_Vsync() function, 509
  ddsCaps field (DDSURFACE2 structure), 270–271
  DDSCAPS_BACKBUFFER flag, 270
  DDSCAPS_COMPLEX flag, 270
  DDSCAPS_FLIP flag, 270
  DDSCAPS_LOCALVIDMEM flag, 270
  DDSCAPS_MODEX flag, 270
  DDSCAPS_NONLOCAL VIDMEM flag, 270
  DDSCAPS_OFFSCREENPLAIN flag, 271
  DDSCAPS_OWNDC flag, 271
  DDSCAPS_PRIMARYSURFACE flag, 271
  DDSCAPS_STANDARDVGAMODEflag, 271
  DDSCAPS_SYSTEMMEMORY flag, 271
  DDSCAPS_VIDEOMEMORY flag, 271
  DDSCL_ALLOWMODEX flag, 251
  DDSCL_ALLOWREBOOT flag, 251
  DDSCL_EXCLUSIVE flag, 252
  DDSCL_FPUSETUP flag, 252
  DDSCL_FULLSCREEN flag, 252
  DDSCL_MULTITHREADED flag, 252
  DDSCL_NORMAL flag, 252
  DDSCL_NOWINDOWCHANGES flag, 252
  DDSD_ALPHABITDEPTH flag, 266
  DDSD_BACKBUFFERCOUNT flag, 266
  DDSD_CAPS flag, 266
  DDSD_CKDESTBLT flag, 266
  DDSD_CKDESTOVERLAY flag, 266
  DDSD_CKSRCBLT flag, 266, 362
  DDSD_CKSRCOVERLAY flag, 266
  DDSD_HEIGHT flag, 266
  DDSD_LINEARSIZE flag, 266
  DDSD_LPSURFACE flag, 266
  DDSD_MIPMAPCOUNT flag, 266
  DDSD_PITCH flag, 266
  DDSD_PIXELFORMAT flag, 266
  DDSD_REFRESHRATE flag, 266
  DDSD_TEXTURESTAGE flag, 266
  DDSD_WIDTH flag, 266
  DDSURFACEDESC2 data structure
    ddckCKDestBlt field, 268
    ddckCKSrcBlt field, 268
    ddpfPixelFormat field, 268–269
    ddsCaps field, 270–271
    dwBackBufferCount field, 268
    dwFlags field, 266
    dwHeight field, 266
    dwSize field, 265
    dwWidth field, 266
    lPitch field, 266–267
    lpSurface field, 268
  DD_OK return code (DirectDrawCreate() function), 247
  deallocating memory, 932
  decibels, 613
  decision trees (AI), 742–745
  declarators, 61
  decomposition, 470–471
  #define directives, 60, 501–502
  defining
    classes, 935–936
    constructors, 939–941
    cursors, 102–103
    destructors, 941–943
    icons, 100–101
  degrees, compared to radians, 435
  degrees of membership (DOM), 774–775
  delete operator, 931–932
  DeleteObject() function, 171
  deleting
    GDI (Graphics Device Interface) objects, 171
    timers, 186
  demo mode
    AI-controlled, 682
    prerecorded, 680–682
  dendrites, 767
  depth-first searches, 757–758
  design, 13
    AI (artificial intelligence) guidelines, 794–795
    brainstorming, 14–15
    design documents, 15
    particle systems, 860–861
    storyboards, 15–16
    testing, 16
  destination color keying, 364–365
  Destroy_Bitmap() function, 520
  Destroy_BOB() function, 530
  destructors, 939–943
  detecting collisions
    bounding boxes, 481–484
    bounding circles, 478–481
    point containment, 484–486
  determinates, 417
  deterministic AI (artificial intelligence) algorithms, 715
    evasion algorithms, 722
    random motion, 716–717
    tracking algorithms
      literal vectoring, 717–718
      trajectory vectoring, 718–721
  device contexts, 68, 130
  devices (DirectInput), 539–541. See also force feedback
    cooperation levels, 543
    creating, 542–543
    data acquisition modes, 544
    data formats, 543
    DirectInput objects, creating, 544–546
    generalized input system, 582–584
      DInput_Init() function, 584
      DInput_Init_Joystick() function, 585
      DInput_Init_Keyboard() function, 584
      DInput_Init_Mouse() function, 585
      DInput_Read_Joystick() function, 587
      DInput_Read_ Keyboard() function, 586
      DInput_Read_Mouse() function, 586
      DInput_Release_ Joystick() function, 585
      DInput_Release_ Keyboard() function, 585
      DInput_Release_Mouse() function, 585
      DInput_Shutdown() function, 584
      modules, 588
    GUIDs (globally unique identifiers), 541–542
    interfaces, 541–542
    joysticks, 561–562
      acquiring, 573
      cooperation level, 568
      creating, 567–568
      data formats, 569
      enumeration, 562–567
      polling, 574
      properties, 570–573
      reading data from, 574–575
      releasing, 575
    keyboards
      acquiring, 551
      cooperation level, 548–549
      creating, 546–548
      data formats, 549–551
      reading data from, 551–553
      unacquiring, 553–554
    merging input, 576–579
    mouse
      absolute mode, 556
      acquiring, 559
      cooperation level, 558
      creating, 558
      data format, 558–559
      reading data from, 559–560
      relative mode, 556
      releasing, 560
    polling, 543
    properties, 543
    reacquiring, 554–556
    state, 544
  dialog boxes, 97
  DIENUM_CONTINUE constant, 566
  DIENUM_STOP constant, 566
  DIERR_INPUTLOST error code, 555
  DIERR_INVALIDPARAM error code, 555
  DIERR_NOTACQUIRED error code, 555
  DIERR_NOTINITIALIZED error code, 555
  digital sound, 594–596
  Dijkstra’s search, 759
  DIJOYSTATE structure, 550
  DIJOYSTATE2 structure, 550
  dimensions (matrices), 447
  DIMOUSESTATE structure, 550
  DInput_Init() function, 584
  DInput_Init_Joystick() function, 585
  DInput_Init_Keyboard() function, 584
  DInput_Init_Mouse() function, 585
  DInput_Read_Joystick() function, 587
  DInput_Read_Keyboard() function, 586
  DInput_Read_Mouse() function, 586
  DInput_Release_Joystick() function, 585
  DInput_Release_Keyboard() function, 585
  DInput_Release_Mouse() function, 585
  DInput_Shutdown() function, 584
  Direct3DIM, 218
  Direct3DRM, 218
  DirectDraw, 216, 241
    bitmaps, 345
      file structure, 346–348
      loading, 348–356
      mapping, 368–369
      rotating, 366–368
      scaling, 366–373
      templates, 352
      unloading, 351–352
    blitter, 317–319
      bitmaps, copying from surface to surface, 328–331
      Blit8x8() function, 319–320
      Blt() function, 321–324
      BltFast() function, 324–325
      memory fills, 325–328
    capability-testing functions
      IDIRECTDRAW4
      :: GetCaps(), 386–388
      IDIRECTDRAWPALETTE::GetCaps(), 389
      IDIRECTDRAWSURFACE4::GetCaps(), 388
    clipping
      bitmaps, 334–339
      IDirectDrawClipper interface, 339–344
      pixels, 332–333
    color
      animation, 373–379
      depths, 257
      high-color modes, 288–301
      keys, 360–365
      palettes, 259–263, 272
      rotation, 379–381
      transforms, 381–382
    cooperation levels
      control flags, 251–252
      setting, 251–254
    double-buffering, 301–302
      implementing, 303–305
      optimizing, 304
      sample program, 305–307
    error handling, 246–247
    full-screen mode, 250
    interfaces, 242–245
      accessing, 247–250
      IDirectDraw, 242
      IDirectDrawClipper, 243–244
      IDirectDrawColor-Control, 382–383
      IDirectDrawGamma-Control, 383
      IDirectDrawPalette, 243
      IDirectDrawSurface, 242
      IIDs (interface IDs), 249
      IUnknown, 242
    objects, creating, 245–246
    page flipping, 302–303
      Flip() function, 311–313
      sample program, 313–317
    pixels, plotting, 272–280
    resource management, 284–285
    sample program, 280–283
    surfaces, 263
      back buffers, 307–309
      complex, 309–310
      creating, 264–272
      filling, 325–328
      locking, 275–276
      offscreen, 356–360, 365–366
      primary, 264
      secondary, 264
      unlocking, 277
    triple-buffering, 312
    video modes
      changing, 256–257
      resolutions, 255–256
      sample program, 257–258
      setting, 255
    windows, 390–391
      8-bit windowed modes, 250, 398–399
      client area, 395–397
      clipping, 397–398
      creating, 391–392
      drawing to, 392–395
  DirectDraw interface
    DDraw_Attach_Clipper() function, 508
    DDraw_Create_Surface() function, 508
    DDraw_Fill_Surface() function, 509
    DDraw_Flip() function, 508
    DDraw_Init() function, 507
    DDraw_Lock_Back_ Surface() function, 510
    DDraw_Lock_Primary_ Surface() function, 510
    DDraw_Lock_Surface() function, 509
    DDraw_Shutdown() function, 507
    DDraw_Unlock_Surface() function, 510
    DDraw_Wait_For_Vsync() function, 509
  DirectDrawCreate() function, 236, 245–247
  DirectInput devices, 217, 539–541. See also force feedback
    cooperation levels, 543
    creating, 542–543
    data formats, 543
    DirectInput objects, creating, 544–546
    generalized input system, 582–584
      DInput_Init() function, 584
      DInput_Init_Joystick() function, 585
      DInput_Init_Keyboard() function, 584
      DInput_Init_Mouse() function, 585
      DInput_Read_Joystick() function, 587
      DInput_Read_ Keyboard() function, 586
      DInput_Read_Mouse() function, 586
      DInput_Release_ Joystick() function, 585
      DInput_Release_ Keyboard() function, 585
      DInput_Release_Mouse() function, 585
      DInput_Shutdown() function, 584
      modules, 588
    GUIDs (globally unique identifiers), 541–542
    interfaces, 541–542
    joysticks, 561–562
      acquiring, 573
      cooperation level, 568
      creating, 567–568
      data formats, 569
      enumeration, 562–567
      polling, 574
      properties, 570–573
      reading data from, 574–575
      releasing, 575
    keyboards
      acquiring, 551
      cooperation level, 548–549
      creating, 546–548
      data formats, 549–551
      reading data from, 551–553
      unacquiring, 553–554
    merging input, 576–579
    mouse
      absolute mode, 556
      acquiring, 559
      cooperation level, 558
      creating, 558
      data format, 558–559
      reading data from, 559–560
      relative mode, 556
      releasing, 560
    polling, 543
    properties, 543
    reacquiring, 554–556
    state, 544
  DirectInputCreate() function, 544–545
  directives
    #define, 60, 501–502
    #include, 60
  DirectMedia, 908
  DirectMusic, 217
    COM initialization, 624
    interfaces, 622–623
    MIDI files
      loading, 626–630
      playing, 630
      releasing, 631
      shutting down, 631–632
      status, checking, 631
      stopping, 631
    performances
      creating, 625
      initializing, 625–626
    ports, 626
    sound/music library, 632–633
      DirectMusic API wrapper, 640–643
      DirectSound API wrapper, 635–640
      globals, 634–635
      header file, 633
      types, 633–634
  DirectPlay, 217
  DirectSetup, 218
  DirectSound, 217, 601–602
    cooperation levels
      exclusive, 604
      normal, 604
      priority, 604
      setting, 605
      Write_Primary, 605
    DirectSound objects, creating, 602–604
    interfaces, 602
    panning, 614
    playback frequencies, 613
    playing sounds, 612
    primary buffers, 606
    querying
      GetCaps() function, 614–616
      GetStatus() function, 616
    secondary buffers
      circular buffering, 607
      creating, 607–610
      locking, 610–611
      releasing, 611
      static, 606
      streaming, 606
      unlocking, 611
      writing to, 610–611
    sound/music library, 632–633
      DirectMusic API wrapper, 640–643
      DirectSound API wrapper, 635–640
      globals, 634–635
      header file, 633
      types, 633–634
    stopping sounds, 612
    volume control, 612–613
    .WAV loader, 616–622
  DirectSound3D, 217
  DirectSoundCreate() function, 603
  DirectX, 11, 213–214
    compile time, 231–232
    Direct3DIM, 218
    Direct3DRM, 218
    DirectDraw, see DirectDraw
    DirectInput, see DirectInput devices
    DirectMusic, 217
      COM initialization, 624
      interfaces, 622–623
      MIDI files, 626–632
      performances, 625–626
      ports, 626
      sound/music library, 632–643
    DirectPlay, 217
    DirectSetup, 218
    DirectSound, 217, 601–602
      cooperation levels, 604–605
      interfaces, 602
      objects, creating, 602–604
      panning, 614
      playback frequencies, 613
      playing sounds, 612
      primary buffers, 606
      querying, 614–616
      secondary buffers, 606–611
      sound/music library, 632–643
      stopping sounds, 612
      volume control, 612–613
      .WAV loader, 616–622
    DirectSound3D, 217
    GDI (Graphics Device Interface), combining, 385
    HAL (Hardware Abstraction Layer), 216
    HEL (Hardware Emulation Layer), 216
    installation, 907–908
    interfaces
      creating, 236–237
      querying for, 237–238
    multithreading, 709–710
    Web site, 908
  DISCARDABLE keyword, 116
  DISCL_BACKGROUND flag, 548
  DISCL_EXCLUSIVE flag, 548
  DISCL_FOREGROUND flag, 548
  DISCL_NONEXCLUSIVE flag, 548
  DispatchMessage() function, 85
  Distributed COM (DCOM), 239
  division, 676–677
  DMusic_Delete_All_MIDI() function, 642
  DMusic_Delete_MIDI() function, 642
  DMusic_Init() function, 641
  DMusic_Load_MIDI() function, 641
  DMUSIC_MIDI structure, 627
  DMusic_Play() function, 642
  DMusic_Shutdown() function, 641
  DMusic_Status() function, 643
  DMusic_Stop() function, 642
  DOM (degrees of membership), 774–775
  DOS, Hello World program, 58
  dot products, 450, 919–921
  double-buffering, 268, 301–302
    implementing, 303–305
    optimizing, 304
    sample program, 305–307
  doubly linked lists, 656
  downloading games, 950
  drawing, 26. See also DirectDraw
    circles, 180–181
    ellipses (ovals), 180–181
    lines, 175, 402–403
      Bresenham’s algorithm, 403–409
      FillRect() function, 178–179
      FrameRect() function, 178
      LineTo() function, 176–177
      MoveToEx() function, 175
      Rectangle() function, 177–179
      Run-Slicing algorithm, 409
      Symmetric Double Step algorithm, 411
    points, 173–175
    polygons, 181–182, 430–432
    quadrilaterals, 461–464
    triangles, 461–464
      flat bottom triangles, 467–470
      flat top triangles, 465–467
      overdraw, 464
  drawing tools
    brushes
      creating, 172–173
      defined, 167
      deleting, 172
      selecting, 172
    pens
      creating, 169
      defined, 167
      deleting, 171
      line styles, 169–170
      selecting, 170–171
      stock objects, 168–169
  DrawText() function, 137
  Draw_Bitmap() function, 522
  Draw_BOB() function, 530–531
  Draw_Clip_Line() function, 513
  Draw_Filled_Polygon2D() function, 512
  Draw_Line() function, 407–409, 514
  Draw_Particles() function, 866
  Draw_Pixel() function, 515
  Draw_QuadFP_2D() function, 512
  Draw_Scaled_BOB() function, 531
  Draw_Text_GDI() function, 516
  Draw_Triangle_2D() function, 511
  DSBCAPS structure, 615
  DSBCAPS_CTRDEFAULT flag, 608
  DSBCAPS_CTRLALL flag, 608
  DSBCAPS_CTRLFREQUENCY flag, 608
  DSBCAPS_CTRLPAN flag, 608
  DSBCAPS_CTRLVOLUME flag, 608
  DSBCAPS_LOCHARDWARE flag, 608
  DSBCAPS_LOCSOFTWARE flag, 608
  DSBCAPS_PRIMARYBUFFER flag, 608
  DSBCAPS_STATIC flag, 608
  DSBUFFERDESC structure, 607–608
  DSCAPS structure, 614–615
  DSound_Delete_Sound() function, 638
  DSound_Init() function, 635
  DSound_Load_WAV() function, 617, 636
  DSound_Play_Sound() function, 637–638
  DSound_Replicate_Sound() function, 637
  DSound_Set_Sound_Freq() function, 640
  DSound_Set_Sound_Pan() function, 640
  DSound_Set_Sound_Volume() function, 639
  DSound_Shutdown() function, 636
  DSound_Status_Sound() function, 638–639
  DSound_Stop_Sound() function, 638
  DSSCL_EXCLUSIVE flag, 605
  DSSCL_NORMAL flag, 605
  DSSCL_PRIORITY flag, 605
  DSSCL_WRITEPRIMARY flag, 605
  dwBackBufferCount field, 268
  dwCreationFlags field (CreateThread() function), 691
  dwDevType field (EnumDevices() function), 563–564
  dwExStyle field (CreateWindowEx() function), 75
  dwFlags field
    DDPIXELFORMAT structure, 291
    DDSURFACE2 structure, 266
  dwFlags parameter
    Blt() function, 321–324
    EnumDevices() function, 564
  dwHeight field (DDSURFACE2 structure), 266
  dwSize field
    DDPIXELFORMAT structure, 291
    DDSURFACE2 structure, 265
  dwStyle parameter (CreateWindowEx() function), 75
  dwWidth field (DDSURFACE2 structure), 266

E

  ecosystem simulation games, 14
  elastic collisions, 828
  Element Of operator, 774
  Ellipse() function, 180
  ellipses, drawing, 180–181
  enemies (Outpost game)
    gunships, 888–891
    mines, 886–887
    outposts, 885–886
  energy, kinetic, 812
  EnumDevices() function, 563–564
  error handling
    C/C++ compiler settings, 909
    DirectDraw, 246–247
    error codes, 555
  evasion algorithms, 722
  event handling, 77, 143
    impact events, 843
    keyboard input, 150
      ASCII codes, 151
      GetAsyncKeyState() function, 151, 155–158
      scan codes, 151
      WM_CHAR message, 151–153
      WM_KEYDOWN message, 153–155
      WM_KEYUP message, 154
    main event loops, 84–89
    menus, 122
      sample program, 125–128
      WinProc() function, 123–125
    mouse input
      WM_LBUTTON DBLCLK message, 160
      WM_LBUTTONDOWN message, 160
      WM_LBUTTONUP message, 160
      WM_MBUTTON-DBLCLK message, 160
      WM_MBUTTONDOWN message, 160
      WM_MBUTTONUP message, 160
      WM_MOUSEMOVE message, 158–160
      WM_RBUTTON-DBLCLK message, 160
      WM_RBUTTONDOWN message, 160
      WM_RBUTTONUP message, 160
    real-time event loops, 89–90
    window manipulation messages, see messages
    Windows event model, 53–54
    WinProc() function
      message IDs, 79–80
      parameters, 79
      prototype, 78
      sample program, 80–84
  exclusive cooperation level (DirectSound), 604
  execute buffers, 218
  E_PENDING error code, 555

F

  FAILED macro, 246
  falling objects, simulating, 816–818
  FAMs (fuzzy associative matrices), 783
    examples, 784–786
    processing, 787–789
      centroids, 790–793
      MAX() function, 790
  Fast_Distance() function, 517
  Fast_Distance_3D() function, 517
  Fibonacci algorithm, 662
  fighting games, 13
  filename extensions
    .RC, 97
    .RES, 97
    .WAV, 109
  files
    header files, 60
    metafiles, 97
    WAV
      playing, 110–112
      resource files, 109
      sample program, 112–114
      stopping, 112
  filling
    polygons, 458–459
    surfaces, 325–328
  FillRect() function, 178–179
  filtering, 371
  finding paths. See pathfinding
  Find_Bounding_Box_Poly2D() function, 518
  finite state machines. See FSMs
  firing neurons, 767
  fixed camera view isometric engines, 500
  fixed-point mathematics, 673–674
    accuracy, 676
    addition, 676
    converting to/from, 674–675
    division, 676–677
    multiplication, 676–677
    representing numbers, 674
    subtraction, 676
  flat bottom triangles
    defined, 459
    drawing, 467–470
  flat top triangles
    defined, 459
    drawing, 465–467
  Flip() function, 311–313
  Flip_Bitmap() function, 522
  FLVs (fuzzy linguistic variables), 776–779
  FM synthesis, 596–597
  fonts
    changing, 182
    creating, 183–184
    monospaced, 183
  force, 807–809
  force feedback, 579
    conditions, 580
    configuring, 580–581
    motive forces, 580
    sample program, 581–582
  foreground color, 139–140
  forward kinematics, 853–857
  forward mapping, 368
  Fourier Transform, 593
  frame-based modeling, 871
  FrameRect() function, 178
  FreakOut game, 29–31
    BLACKOUT.H file, 31–33
    DDRAW.DLL file, 31
    DDRAW.LIB file, 31
    FREAKOUT.CPP file, 33–46
  frequencies (playback), 592, 613
  friction
    defined, 821–822
    physics modeling, 822
      air hockey example, 823
      inclined planes, 823–828
  FSMs (finite state machines), 729–730
    example, 730–734
    personality traits, 734–736
  full fuzzy sets, 775
  full-screen isometric engines, 498–500
  full-screen mode (DirectDraw), 250
  function pointers, 232–235
  functions, 937–938
    Acquire(), 543
    AddPort(), 626
    AddRef(), 221–222
    AdjustWindowRectEx(), 396
    Animate_BOB(), 534
    BeginPaint(), 129–130
    Blink_Colors(), 525
    Blit8x8(), 319–320
    Blt(), 321–324
    BltFast(), 324–325
    Clip_Line(), 514
    CloseHandle(), 691–692
    Close_Error_File(), 518
    CoCreateInstance(), 225, 625
    CoInitialize(), 624
    Collision_BOBS(), 535
    Collision_Test(), 526
    Color_Scan(), 527
    ComCreate(), 225
    constructors, 938–941
    CreateClipper(), 339
    CreateDevice(), 542
    CreateHatchBrush(), 172–173
    CreatePalette(), 261–262
    CreatePen(), 169–170
    CreateSolidBrush(), 172
    CreateSoundBuffer(), 607–609
    CreateSurface(), 264
    CreateThread(), 690–691
    CreateWindowEx(), 75–76
    Create_Bitmap(), 520
    Create_BOB(), 528–530
    DDDraw_Create_Surface(), 508
    DDDraw_Flip(), 508
    DDraw_Attach_Clipper(), 342–344, 508
    DDraw_Fill_Surface(), 509
    DDraw_Init(), 507
    DDraw_Lock_Back_ Surface(), 510
    DDraw_Lock_Primary_ Surface(), 510
    DDraw_Lock_Surface(), 509
    DDraw_Shutdown(), 507
    DDraw_Unlock_Surface(), 510
    DDraw_Wait_For_Vsync(), 509
    DeleteObject(), 171
    Destroy_Bitmap(), 520
    Destroy_BOB(), 530
    destructors, 939–943
    DInput_Init(), 584
    DInput_Init_Joystick(), 585
    DInput_Init_Keyboard(), 584
    DInput_Init_Mouse(), 585
    DInput_Read_Joystick(), 587
    DInput_Read_Keyboard(), 586
    DInput_Read_Mouse(), 586
    DInput_Release_Joystick(), 585
    DInput_Release_Keyboard(), 585
    DInput_Release_Mouse(), 585
    DInput_Shutdown(), 584
    DirectDrawCreate(), 236, 245–247
    DirectInputCreate(), 544–545
    DirectSoundCreate(), 603
    DispatchMessage(), 85
    DMusic_Delete_All_MIDI(), 642
    DMusic_Delete_MIDI(), 642
    DMusic_Init(), 641
    DMusic_Load_MIDI(), 641
    DMusic_Play(), 642
    DMusic_Shutdown(), 641
    DMusic_Status(), 643
    DMusic_Stop(), 642
    DrawText(), 137
    Draw_Bitmap(), 522
    Draw_BOB(), 530–531
    Draw_Clip_Line(), 513
    Draw_Filled_Polygon2D(), 512
    Draw_Line(), 407–409, 514
    Draw_Particles(), 866
    Draw_Pixel(), 515
    Draw_QuadFP_2D(), 512
    Draw_Scaled_BOB(), 531
    Draw_Text_GDI(), 516
    Draw_Triangle_2D(), 511
    DSound_Delete_Sound(), 638
    DSound_Init(), 635
    DSound_Load_WAV(), 617, 636
    DSound_Play_Sound(), 637–638
    DSound_Replicate_Sound(), 637
    DSound_Set_Sound_Freq(), 640
    DSound_Set_Sound_Pan(), 640
    DSound_Set_Sound_ Volume(), 639
    DSound_Shutdown(), 636
    DSound_Status_Sound(), 638–639
    DSound_Stop_Sound(), 638
    Ellipse(), 180
    EnumDevices(), 563–564
    Fast_Distance(), 517
    Fast_Distance_3D(), 517
    FillRect(), 178–179
    Find_Bounding_Box_ Poly2D(), 518
    Flip(), 311–313
    Flip_Bitmap(), 522
    FrameRect(), 178
    Game_Init(), 206
    Game_Main(), 206, 297–298
    Game_Shutdown(), 207
    GetAsyncKeyState(), 151, 155–158
    GetCaps(), 614–616
      IDIRECTDRAW4:: GetCaps(), 386–388
      IDIRECTDRAWPALETTE::GetCaps(), 389
      IDIRECTDRAWSURFACE4::GetCaps(), 388
    GetClientRect(), 132
    GetDC(), 130(), 383–384
    GetDeviceState(), 544, 551, 555
    GetMessage(), 85
    GetPixelFormat(), 290, 393
    GetStatus(), 616
    GetStockObject(), 72–73, 168
    GetSystemInfo(), 198–199
    GetSystemMetrics(), 199–203
    GetTextMetrics(), 204–205
    GetTickCount(), 187
    GetWindowRect(), 392–393
    Get_Clock(), 525
    Get_Palette_Entry(), 523
    Hide_BOB(), 535
    HLine(), 515
    Init_Reset_Particles(), 861–862
    inline, 22
    InvalidateRect(), 132–133
    IsPlaying(), 631
    KillTimer(), 186
    LineTo(), 176–177
    LoadBitmap(), 348
    LoadCursor(), 71, 104
    LoadIcon(), 70–71
    LoadImage(), 348–349
    LoadMenu(), 119–120
    LoadString(), 108
    Load_Animation_BOB(), 532
    Load_Bitmap_File(), 349–351, 519
    Load_Frame_BOB(), 531
    Load_Image_Bitmap(), 521
    Load_Palette_From_File(), 524
    Lock(), 275–276, 610
    MAX(), 790
    memcpy(), 304
    MessageBeep(), 65–66
    MessageBox(), 63–64
    MIN(), 788
    MoveToEx(), 175
    Move_BOB(), 534
    naming, 56
    Open_Error_File(), 518
    overloading, 945–946
    PeekMessage(), 89
    Play(), 612
    PlaySegment(), 630
    PlaySound(), 110–111
    Plot16(), 277
    Plot8(), 277
    Plot_Pixel16(), 294–295
    Plot_Pixel_Fast16(), 295
    Plot_Pixel_Faster16(), 296
    pointers, 69
    Poll(), 543
    Polygon(), 181
    PostMessage(), 161–163
    printf(), 932
    Process_Particles(), 864–866
    QueryInterface(), 221, 238, 247
    Rectangle(), 177–179
    RegisterClass(), 74
    RegisterClassEx(), 74
    Release(), 222, 284–285
    ReleaseDC(), 130, 384
    Rotate_Colors(), 525
    Rotate_Polygon2D(), 513
    Save_Palette(), 524
    Save_Palette_To_File(), 523
    Scale_Polygon2D(), 513
    scanf(), 932
    Screen_Transition(), 516
    SelectObject(), 170–171
    SendMessage(), 161–163, 195–197
    SetBkMode(), 140
    SetClipper(), 342, 397
    SetColorKey(), 361–364
    SetCooperativeLevel(), 543, 548, 605
    SetCooperativeLevel(), 251–252
    SetCursor(), 104
    SetDataFormat(), 543, 549
    SetDisplayMode(), 293
    SetEntries(), 354
    SetFrequency(), 613
    SetHWnd(), 397
    SetMenu(), 120
    SetPalette(), 272
    SetPan(), 614
    SetPixel(), 173–175, 234–235
    SetProperty(), 543
    SetTimer(), 185
    SetVolume(), 613
    Set_Animation_BOB(), 534
    Set_Anim_Speed(), 533
    Set_Palette(), 524
    Set_Palette_Entry(), 522
    Set_Pos_BOB(), 533
    Set_Vel_BOB(), 533
    ShowCursor(), 446
    Show_BOB(), 535
    Sleep(), 190
    Start_Clock(), 526
    Start_Particles(), 862–864
    Stop(), 612
    TerminateThread(), 698
    TextOut(), 137
    TranslateMessage(), 85
    Translate_Polygon2D(), 512
    Unacquire(), 553–554
    Unload_Bitmap_File(), 351–352, 519
    Unlock(), 277(), 611
    UpdateWindow(), 77
    ValidateRect(), 131
    VLine(), 516
    WaitForMultipleObjects(), 703–704, 707
    WaitForSingleObject(), 702–704
    Wait_Clock(), 526
    WinMain(), 45, 59–62, 207–210
    WinProc(), 78–84, 123–125
    Write_Error(), 518
  Functions section (scripts), 763
  fuzzifaction, 782
  fuzzy logic, 772–773
    FAMs (fuzzy associative matrices), 783
      examples, 784–786
      processing, 787–793
    FLVs (fuzzy linguistic variables), 776–779
    fuzzy set theory
      DOM (degrees of membership), 774–775
      intersections, 776
      unions, 775
    manifolds, 779–783
    normal set theory, 773–774
  fuzzy set theory
    DOM (degrees of membership), 774–775
    intersections, 776
    unions, 775
  fwdSound parameter (PlaySound() function), 110–111

G

  Gamasutra, 952
  Game Developer, 952
  games, overview of, 184
    demo mode
      AI-controlled, 682
      prerecorded, 680–682
    design, 13
      brainstorming, 14–15
      design documents, 15
      storyboards, 15–16
      testing, 16
    FreakOut, 29–31
      BLACKOUT.H header file, 31–33
      DDRAW.DLL file, 31
      DDRAW.LIB file, 31
      FREAKOUT.CPP source file, 33–46
    history, 9–13
    loop architecture, 16–17
      AI (artificial intelligence), 17
      display synchronization, 18
      example, 18–21
      frame rendering, 18
      initialization, 17
      loops, 18
      player input, 17
      shutdown, 18
    multiplayer
      split-screen setup, 684
      turn-taking, 683
    online resources
      2D/3D engines, 950–951
      Belm Design Group, 953
      Blues News, 952
      book reviews, 951
      download sites, 950
      game programming sites, 949–950
      magazines, 952
      Usenet newsgroups, 951–952
    Outpost, 875–876
      asteroid field, 882–884
      colors, 877
      compiling, 897–898
      design, 876–877
      gunships, 888–891
      HUDs (Heads-Up Displays), 892–896
      mines, 886–887
      outposts, 885–886
      particle system, 896
      player’s ship (Wraith), 880–882
      playing, 896
      power-ups, 891–892
      rendering tools, 878
      scrolling, 878–880
      sound, 878
      universe size, 878
    saving, 682–683
    T3D Game Console, 205
      architecture, 206
      Game_Init() function, 206
      Game_Main() function, 206
      Game_Shutdown() function, 207
      WinMain() function, 207–210
    types
      arcase games, 14
      ecosystem simulations, 14
      fighting games, 13
      first-person games, 13
      interactive stories, 14
      mechanical simulations, 14
      puzzle/board games, 14
      retro games, 14
      sports games, 13
      strategy games, 14
  Game_Init() function, 206
  Game_Main() function, 206, 297–298
  Game_Shutdown() function, 207
  gamma control, 383
  gamma correction, 381
  GDI (Graphics Device Interface), 128, 165–166
    brushes
      creating, 172–173
      defined, 167
      deleting, 172
      selecting, 172
    color
      palletized, 136–137
      RGB (red, green, blue) mode, 135–137
    pens, 168
      creating, 169
      defined, 167
      deleting, 171
      line styles, 169–170
      selecting, 170–171
      stock objects, 168–169
    shapes, drawing
      circles, 180–181
      ellipses (ovals), 180–181
      lines, 175–177
      points, 173–175
      polygons, 181–182
      rectangles, 177–179
    text, printing
      DrawText() function, 137
      example, 140–141
      fonts, 182–184
      foreground/background colors, 139–140
      sample program (DEMO3.5.CPP), 141–143
      TextOut() function, 137
    timing
      low-level timing, 187–190
      timers, 185–186
      WM_TIMER message, 184–187
    video displays, 133–135
      2D acceleration, 134
      3D acceleration, 134
      color depth, 133
      interlaced/noninterlaced, 134
      pixels, 133
      refresh rates, 134
      resolution, 133
      VRAM (video RAM), 134
    Window controls
      buttons, 191–194
      sending messages to, 195–197
    WM_PAINT message, 128–133
  genetic algorithms, 770–772
  genetic evolution, 771
  GetAsyncKeyState() function, 151, 155–158
  GetCaps() function, 614–616
    IDIRECTDRAW4::GetCaps(), 386–388
    IDIRECTDRAWPALETTE::GetCaps(), 389
    IDIRECTDRAWSURFACE4::GetCaps(), 388
  GetClientRect() function, 132
  GetDC() function, 130, 383–384
  GetDeviceState() function, 544, 551, 555
  GetMessage() function, 85
  GetPixelFormat() function, 290, 393
  GetStatus() function, 616
  GetStockObject() function, 72–73, 168
  GetSystemInfo() function, 198–199
  GetSystemMetrics() function, 199–203
  GetTextMetrics() function, 204–205
  GetTickCount() function, 187
  GetWindowRect() function, 392–393
  Get_Clock() function, 525
  Get_Palette_Entry() function, 523
  global variables, 22
  Globally Unique Identifiers (GUIDs), 223, 541
  Globals section (scripts), 763
  graphics. See also GUIs (graphical user interfaces)
    animation
      color animation, 373–379
      double-buffering, 301–307
      page flipping, 302–303, 311–317
      triple-buffering, 312
    bitmaps, 97, 345
      file structure, 346–347
      functions, 519–522
      loading, 348–356
      mapping, 368–369
      reading manually, 348
      rotating, 366–368
      scaling, 366–373
      templates, 352
      unloading, 351–352
    blitter, 317–319
      bitmaps, copying from surface to surface, 328–331
      Blit8x8() function, 319–320
      Blt() function, 321–324
      BltFast() function, 324–325
      memory fills, 325–328
      offscreen surfaces, 358–360, 365–366
    circles, 180
    clipping
      bitmaps, 334–339
      IDirectDrawClipper interface, 339–344
      pixels , 332–333
    color, see color
    device contexts, 68, 130
    ellipses, 180–181
    Graphics Device Interface, see GDI
    icons, 97–99
      defining, 100–101
      loading, 102
      resource files, 99
    lines
      clipping, 411–413, 419–427
      drawing, 175–177, 402–411
      intersection of, calculating, 413–418
      slopes, 404
    matrices, 446–448
      addition, 449
      dimensions, 447
      identity matrix, 448–449
      multiplication, 449–452
      rotation, 455–457
      scaling, 455
      subtraction, 449
      transformations, 452–454
      translation, 454
      zero matrix, 449
    points, 173–175
    polygons
      collision detection, 478–486
      convex vs. concave, 427
      data structures, 428–430
      drawing, 181–182, 430–432
      filling, 458–459
      functions, 511–513
      local coordinates, 431
      scaling, 445–446
      world coordinates, 431
    quadrilaterals, 459
      drawing, 461–464
      rasterizing, 472–473
      triangulating, 473–477
    rectangles, 177–179
    rotation
      accuracy, 444
      matrices, 455–457
      points in 2D planes, 439–441
      polygons, 441–443
      trigonometry, 435–439
    scaling, 445–446, 455
    software, 26
    translation, 433–434, 454
    triangles, 459
      clipping, 464
      decomposition, 470–471
      drawing, 461–470
      overdraw, 464
    video displays, 133–135
      2D acceleration, 134
      3D acceleration, 134
      color depth, 133
      interlaced/noninterlaced, 134
      pixels, 133
      refresh rates, 134
      resolution, 133
      VRAM (video RAM), 134
  Graphics Device Interface. See GDI
  gravity, physics modeling
    black hole simulations, 815–816
    falling objects, 816–818
    gravitational force, 814–815
    space-time curvature, 813
    trajectory paths, 818–821
  GUIDs (Globally Unique Identifiers), 223, 541
  GUIs (graphical user interfaces). See also graphics; Windows operating system
    buttons
      creating, 193
      notification codes, 193–194
      styles, 191–192
    dialog boxes, 97
    menus
      cascading, 117
      creating, 116–119
      event handling, 122–125
      hotkeys, 118
      loading, 119–122
      sample program, 125–128
    message boxes
      MessageBox() function, 63–64
      sample program, 59–60
      sounds, 65–66
    multiplayer games
      split-screen setup, 684
      turn-taking, 683
    window manipulation messages, see messages
    windows, 390–391
      8-bit windowed modes, 398–399
      client area, 395–397
      coordinates, 132
      creating, 75–77
      clipping, 397–398
      creating, 391–392
      drawing to, 392–395
      multiple, 90–92
      updating, 77
  gunships (Outpost game), 888–891

H

  HAL (Hardware Abstraction Layer), 216
  handles, 70
  hard-coded plans (AI), 742
  Hardware Abstraction Layer (HAL), 216
  Hardware Emulation Layer (HEL), 216
  hatch brushes, 172–173
  hbrBackground field (WNDCLASSEX structure), 72
  hCursor field (WNDCLASSEX structure), 71
  header files, 60
    bitmap files, 346
    T3DLIB3 sound/music library, 633
  Heads-Up Displays. See HUDs
  hearing, physiology of, 592
  HEL (Hardware Emulation Layer), 216
  Hello World program, 58–59
  Hide_BOB() function, 535
  high-color modes
    16-bit
      bit encoding formats, 289–290
      pixel formats, 290–293
      sample program, 293
      writing to screen, 293–298
    24-bit, 299
    32-bit, 300–301
    computational speed, 288
    memory bandwidth, 288
  high-level AI (artificial intelligence)
    actions, 741
    decision trees, 742–745
    goals, 740–741
    hard-coded plans, 742
    implementing, 745–747
    production rules, 742
  hInstance field
    CreateWindowEx() function, 76
    WNDCLASSEX structure, 70
  hinstance parameter (WinMain() function), 61
  historical overview
    gaming, 9–13
    Windows operating system
      Windows 1.0, 48
      Windows 2.0, 48
      Windows 3.x, 48–49
      Windows 95, 49–50
      Windows 98, 50
      Windows NT, 50
  HLine() function, 515
  hMenu parameter (CreateWindowEx() function), 76
  hmod parameter (PlaySound() function), 110
  homogenous coordinates, 453
  hotkeys, 118
  hprevinstance parameter (WinMain() function), 61
  HUDs (Heads-Up Displays), 892–896
  Hungarian notation
    class naming, 57
    constant naming, 57
    function naming, 56
    parameter naming, 58
    prefix codes, 55–56
    type naming, 57
    variable naming, 56
  hwnd parameter
    MessageBox() function, 63
    WinProc() function, 79
  hWndParent parameter (CreateWindowEx() function), 76
  hypotenuse, 912

I

  I/O (input/output)
    DirectInput devices, 539–541
      cooperation levels, 543
      creating, 542–543
      data acquisition modes, 544
      data formats, 543
      DirectInput objects, creating, 544–546
      generalized input system, 582–588
      GUIDs (globally unique identifiers), 541–542
      interfaces, 541–542
      joysticks, see joysticks
      keyboards, see keyboard devices
      merging input, 576–579
      mouse, 556–560
      polling, 543
      properties, 543
      reacquiring, 554–556
      state, 544
    force feedback, 579
      conditions, 580
      configuring, 580–581
      motive forces, 580
      sample program, 581–582
    input loops, 538
    streams, 932–934
  ICON keyword, 100
  icons, 97–99
    defining, 100–101
    loading, 102
    resource files, 99
  IDC_APPSTARTING value, 71
  IDC_ARROW value, 71
  IDC_CROSS value, 71
  IDC_IBEAM value, 71
  IDC_NO value, 71
  IDC_SIZEALL value, 72
  IDC_SIZENESW value, 72
  IDC_SIZENS value, 72
  IDC_SIZENWSE value, 72
  IDC_SIZEWE value, 72
  IDC_UPARROW value, 72
  IDC_WAIT value, 72
  identifiers. See IDs
  identity matrix, 448–449
  IDirectDraw interface, 242
  IDirectDrawClipper interface, 243–244
    clip lists, 340–342
    creating, 339
    sample program, 342–344
  IDirectDrawColorControl interface, 382–383
  IDirectDrawGammaControl interface, 383
  IDirectDrawPalette interface, 243
  IDirectDrawSurface interface, 242
  IDirectInput interface, 541
  IDirectInputDevice interface, 541
  IDirectInputDevice2 interface, 542
  IDirectMusic interface, 623
  IDirectMusicLoader interface, 623
  IDirectMusicPerformance interface, 623
  IDirectMusicPort interface, 623
  IDirectMusicSegment interface, 623
  IDirectMusicSegmentState interface, 623
  IDirectSound interface, 602
  IDirectSoundBuffer interface, 602
  IDirectSoundCapture interface, 602
  IDirectSoundNotify interface, 602
  IDs
    GUIDs (Globally Unique Identifiers), 223
    IIDs (Interface Identifiers), 223, 249
    message IDs, 79
  IFF (Interchange File Format), 616
  IIDs (Interface Identifers), 223, 249
  image-processing programs, 26
  immediate mode
    Direct3D, 218
    DirectInput, 544
  impact events, 843
  impulse force, 843
  inclined planes, 823–828
  #include directives, 60
  influence, radii of, 736
  inheritance, 926–927
  initialization, 17
  Init_Reset_Particles() function, 861–862
  inline() functions, 22
  inorder searches (BSTs), 668
  input devices. See DirectInput devices
  input/output. See I/O
  installing DirectX, 907–908
  integration, 792
  intelligence. See AI (artificial intelligence)
  interactive stories, 14
  Interchange File Format (IFF), 616
  Interface Identifiers (IIDs), 223
  interfaces, 219, 242–245
    accessing, 247–250
    creating, 236–237
    IDirectDraw, 242
    IDirectDrawClipper, 243–244
      clip lists, 340–342
      creating, 339
      sample program, 342–344
    IDirectDrawColorControl, 382–383
    IDirectDrawGammaControl, 383
    IDirectDrawPalette, 243
    IDirectDrawSurface, 242
    IDirectInput, 541
    IDirectInputDevice, 541
    IDirectInputDevice2, 542
    IDirectMusic, 623
    IDirectMusicLoader, 623
    IDirectMusicPerformance, 623
    IDirectMusicPort, 623
    IDirectMusicSegment, 623
    IDirectMusicSegmentState, 623
    IDirectSound, 602
    IDirectSoundBuffer, 602
    IDirectSoundCapture, 602
    IDirectSoundNotify, 602
    IIDs (Interface IDs), 223, 249
    IUnknown, 221–222, 242, 602
    querying for, 237–238
  interlaced video displays, 134
  intersecting line segments (collisions), 835–840
  intersection of lines, calculating
    general form, 416
    matrix form, 416–418
    Point Slope form, 413–415
    Y-Intercept form, 416
  intersection operator, 774
  InvalidateRect() function, 132–133
  inverse kinematics, 854, 858–859
  inverse mapping, 369
  IOSTREAM class, 932
  ISO (isometric) engines
    cell-based, 496–498
    fixed camera view, 500
    full-screen, 498–500
  isometric engines
    cell-based, 496–498
    fixed camera view, 500
    full-screen, 498–500
  IsPlaying() function, 631
  IUnknown interface, 242, 602
    definition, 221
    functions
      AddRef, 221–222
      QueryInterface, 221
      Release, 222

J–K

  joysticks, 561–562
    acquiring, 573
    cooperation level, 568
    creating, 567–568
    data formats, 569
    enumeration, 562–567
    polling, 574
    properties, 570–573
    reading data from, 574–575
    releasing, 575
  keyboard devices (DirectInput)
    acquiring, 551
    cooperation level, 548–549
    creating, 546–548
    data formats, 549–551
    event handling, 150
      ASCII codes, 151
      GetAsyncKeyState() function, 151, 155–158
      scan codes, 151
      WM_CHAR message, 151–153
      WM_KEYDOWN message, 153–155
      WM_KEYUP message, 154
    reading data from, 551–553
    unacquiring, 553–554
  keys, color, 360–361
    destination color keying, 364–365
    source color keying, 361–363
  keywords
    class, 935
    const, 57
    CURSOR, 102
    DISCARDABLE, 116
    ICON, 100
    MENUITEM, 118
    POPUP, 117
    public, 936
    struct, 648
    WAVE, 109
  KillTimer() function, 186
  kinematics
    forward, 853–857
    inverse, 854, 858–859
  kinetic energy, 812

L

  laws of physics
    Newton’s First Law, 799
    Newton’s Second Law, 807
  lbs. (pounds), 799
  libraries
    T3DLIB1
      2D graphic functions, 513–516
      2D polygon functions, 511–513
      bitmap functions, 519–522
      data types, 503–505
      #defines directives, 501–502
      DirectDraw interface, 507–510
      engine architecture, 500–501
      globals, 506–507
      macros, 502–503
      math/error functions, 517–518
      palette functions, 523–525
      structures, 503–505
      utility functions, 526–527
    T3DLIB2, 582–584
      DInput_Init() function, 584
      DInput_Init_Joystick() function, 585
      DInput_Init_Keyboard() function, 584
      DInput_Init_Mouse() function, 585
      DInput_Read_Joystick() function, 587
      DInput_Release_ Joystick() function, 585–586
      DInput_Release_ Keyboard() function, 585
      DInput_Release_Mouse() function, 585–586
      DInput_Shutdown() function, 584
      modules, 588
    T3DLIB3, 632–633
      DirectMusic API wrapper, 641–642
      DirectSound API wrapper, 635–640
      globals, 634–635
      header file, 633–634
  lights, blinking, 374–379
  line styles (pens), 169–170
  lines
    clipping, 411–413, 419–420
      Cohen-Sutherland algorithm, 420–427
    drawing, 402–403
      Bresenham’s algorithm, 403–409
      LineTo() function, 176–177
      MoveToEx() function, 175
      Run-Slicing algorithm, 409
      Symmetric Double Step algorithm, 411
    intersection of, calculating, 835–840
      general form, 416
      matrix form, 416–418
      Point Slope form, 413–415
      Y-Intercept form, 416
    slopes, 404
  LineTo() function, 176–177
  linked lists, 649–650
    creating, 650–651
    doubly linked lists, 656
    nodes
      adding, 652–653
      deleting, 653–655
    traversing, 651–652
  lists
    clip lists, 340–342
    linked lists, 649–650
      creating, 650–651
      doubly linked lists, 656
      nodes, 652–655
      traversing, 651–652
  little-endian format, 290
  LoadBitmap() function, 348
  LoadCursor() function, 71, 104
  LoadIcon() function, 70–71
  LoadImage() function, 348–349
  loading
    bitmaps
      8-bit images, 353–354
      16-bit images, 354–355
      24-bit images, 355–356
      LoadBitmap() function, 348
      LoadImage() function, 348–349
      Load_Bitmap_File() function, 349–351
    cursors, 103–104
    icons, 102
    menus, 119–122
      LoadMenu() function, 119–120
      SetMenu() function, 120
    MIDI files, 626–630
    strings, 108
  LoadMenu() function, 119–120
  LoadString() function, 108
  Load_Animation_BOB() function, 532
  Load_Bitmap_File() function, 349–351, 519
  Load_Frame_BOB() function, 531
  Load_Image_Bitmap() function, 521
  Load_Palette_From_File() function, 524
  local coordinates (polygons), 431
  Lock() function, 275–276, 610
  locking
    DirectDraw surfaces, 275–276
    sound buffers, 610–611
  look-up tables, 678–679
  loops
    architecture, 16–17
      AI (artificial intelligence), 17
      display synchronization, 18
      example, 18–21
      frame rendering, 18
      initialization, 17
      loops, 18
      player input, 17
      shutdown, 18
    busy, 701
    input loops, 538
    main event loops, 84–89
    real-time event loops, 89–90
    unrolling, 677–678
  low-level timing, 187–190
  LOWORD macro, 123
  lpcaption parameter (MessageBox() function), 63
  lpClassName parameter (CreateWindowEx() function), 75
  lpcmdline parameter (WinMain() function), 61
  lpCursorName field (WNDCLASSEX structure), 71
  lpDDBltFx parameter (Blt() function), 321–322
  lpDDSrcSurface parameter (Blt() function), 321
  lpDestRect parameter (Blt() function), 321
  lpfnWndProc field (WND-CLASSEX structure), 68–69
  lPitch field (DDSURFACE2 structure), 266–267
  lpParam parameter (CreateWindowEx() function), 76
  lpParameter parameter (CreateThread() function), 691
  lpSrcRect parameter (Blt() function), 321
  lpStackSize parameter (CreateThread() function), 691
  lpStartAddress parameter (CreateThread() function), 691
  lpSurface field (DDSURFACE2 structure), 268
  lpszClassName field (WNDCLASSEX structure), 73
  lpszMenuName field (WNDCLASSEX structure), 73
  lptext parameter (MessageBox() function), 63
  lpThreadAttributes parameter (CreateThread() function), 691
  lpThreadId parameter (CreateThread() function), 691
  lpWindowName parameter (CreateWindowEx() function), 75

M

  macros
    FAILED, 246
    LOWORD, 123
    MAKEINTRESOURCE, 102
    SUCCEEDED, 246
    T3DLIB1 library, 502–503
  magazines, 952
  Main section (scripts), 763
  MAKEINTRESOURCE macro, 102
  manifolds, fuzzy, 779–783
  mapping bitmaps
    forward mapping, 368
    inverse mapping, 369
  mass, 799
  mathematics, 911. See also algorithms
    asymptotic algorithm analysis, 657–659
    code optimization, 672–673
    fixed-point math, 673–674
      accuracy, 676
      addition, 676
      converting to/from, 674–675
      division, 676–677
      multiplication, 676–677
      representing numbers, 674
      subtraction, 676
    integration, 792
    matrices, 446–448
      addition, 449
      dimensions, 447
      FAMs (fuzzy associative matrices), 783–793
      identity matrix, 448–449
      line intersections, calculating, 416–418
      multiplication, 449–452
      rotation, 455–457
      scaling, 455
      subtraction, 449
      transformations, 452–454
      translation, 454
      zero matrix, 449
    trigonometry, 435–439, 911–912
      cosines, 913
      identities, 438, 914–915
      Pythagorean theorem, 913
      sines, 913
      tangents, 913
    vectors, 915–916
      addition, 918–919
      cross products, 921–923
      dot products, 919–921
      length, 916–917
      as linear combinations, 924
      normalization, 917
      position vectors, 923–924
      scalar multiplication, 917–918
      subtraction, 919
      zero vectors, 923
  matrices, 446–448
    addition, 449
    dimensions, 447
    FAMs (fuzzy associative matrices), 783
      examples, 784–786
      processing, 787–793
      MAX() function, 790
    identity matrix, 448–449
    line intersections, calculating, 416–418
    multiplication, 449–452
    rotation, 455–457
    scaling, 455
    subtraction, 449
    transformations, 452–454
    translation, 454
    zero matrix, 449
  MAX() function, 790
  MB_ABORTRETRYIGNORE flag, 64
  MB_DEFBUTTONn flag, 64
  MB_ICONEXCLAMATION flag, 64
  MB_ICONINFORMATION flag, 64
  MB_ICONQUESTION flag, 64
  MB_ICONSTOP flag, 64
  MB_OK flag, 63
  MB_OKCANCEL flag, 63
  MB_RETRYCANCEL flag, 63
  MB_YESNO flag, 63
  MB_YESNOCANCEL flag, 63
  McCulloch-Pitts neurode summation function, 768
  mechanical simulation games, 14
  member functions. See functions
  memcpy() function, 304
  memory
    AI (artificial intelligence), 736–740
    allocating, 931
    deallocating, 932
    high-color mode requirements, 288
    leaks, 942
    VRAM (video RAM), 134
  MENUITEM keyword, 118
  menus
    cascading, 117
    creating, 116–119
    event handling, 122
      sample program, 125–128
      WinProc() function, 123–125
    hotkeys, 118
    loading, 119–122
      LoadMenu() function, 119–120
      SetMenu() function, 120
  merging input device data, 576–579
  message boxes
    MessageBox() function, 63–64
    sample program, 59–60
    sounds, 65–66
  MessageBeep() function, 65–66
  MessageBox() function, 63–64
  messages, 143
    IDs, 79
    passing to threads, 698–701
    retrieving, 85
    sending
      to controls, 195–197
      PostdMessage() function, 161–163
      SendMessage() function, 161–163
    testing for, 89
    WM_ACTIVATE, 144–145
    WM_ACTIVATEAPP, 144
    WM_CHAR, 151–153
    WM_CLOSE, 144–147
    WM_KEYDOWN, 153–155
    WM_KEYUP, 154
    WM_LBUTTONDBLCLK, 160
    WM_LBUTTONDOWN, 160
    WM_LBUTTONUP, 160
    WM_MBUTTONDBLCLK, 160
    WM_MBUTTONDOWN, 160
    WM_MBUTTONUP, 160
    WM_MOUSEMOVE, 158–160
    WM_MOVE, 144, 149–150
    WM_MOVING, 144
    WM_PAINT, 128–133
    WM_RBUTTONDBLCLK, 160
    WM_RBUTTONDOWN, 160
    WM_RBUTTONUP, 160
    WM_SIZE, 144, 147–148
    WM_SIZING, 144
    WM_TIMER, 184–187
  metafiles, 97
  methods. See functions
  metrics
    system metrics
      constants, 199–203
      retrieving, 199
    text metrics, 204–205
  Microsoft Web site, 908, 951
  MIDI (Musical Instrument Digital Interface) files, 27, 597–598. See also DirectMusic
    loading, 626–630
    playing, 630
    releasing, 631
    sequencing programs, 27
    status, checking, 631
    stopping, 631
  MIN() function, 788
  mines (Outpost game), 886–887
  MMIO (multimedia I/O interface), 617
  modeling. See physics modeling
  modes
    demo mode
      AI-controlled, 682
      prerecorded, 680–682
    Direct3D
      Immediate, 218
      Retained, 218
    DirectDraw
      full-screen, 250
      video modes, 255–258
      windowed, 250
      windowed modes, 390–399
    DirectInput, 544
    mouse devices, 556
  momentum, 809–810
    collision response, 813
    conservation of, 811
  monitors, 133–135
  monospaced fonts, 183
  motive forces, 580
  mouse devices
    absolute mode, 556
    acquiring, 559
    cooperation level, 558
    creating, 558
    data format, 558–559
    event handling, 158, 160
    reading data from, 559–560
    relative mode, 556
    releasing, 560
  MoveToEx() function, 175
  Move_BOB() function, 534
  moving objects. See translation
  multimedia. See also animation; graphics; sound
  multimedia I/O interface (MMIO), 617
  multiplayer games
    split-screen setup, 684
    turn-taking, 683
  multiple inheritance, 927
  multiplication
    fixed-point mathematics, 676–677
    matrices, 449–452
    vectors
      cross products, 921–923
      dot products, 919–921
      scalar multiplication, 917–918
  multiprocessors, 686
  multitasking
    preemptive, 687
    Windows, 51–52
  multithreading, 685–686, 711
    advantages, 687–689
    defined, 687
    DirectX, 709–710
    priority levels, 687
    sample programs, 693–696
    threads
      creating, 689–691
      handles, closing, 691–692
      with messages, 698–701
      multiple objects, waiting for, 707–709
      signaling, 702–704
      synchronizing, 704–707
      terminating, 692, 697–698
    Windows, 51–53
  music. See sound
  Musical Instrument Digital Interface. See MIDI files
  mutexes, 710

N

  N (Newton), 799
  n-t coordinate system (collisions), 846–849
  naming conventions, Hungarian notation
    class naming, 57
    constant naming, 57
    function naming, 56
    parameter naming, 58
    prefix codes, 55–56
    type naming, 57
    variable naming, 56
  navigation, scrolling
    homogeneous tile engines, 489–494
    page scrolling engines, 488–489
    sparse bitmap tile engines, 494–495
  ncmdshow parameter (WinMain() function), 61–62
  neural networks (AI), 767–770
    McCulloch-Pitts neurode summation() function, 768
    truth table, 769
  neurodes, 768–770
  neurons, 767
  new operator, 931–932
  newsgroups, 951–952
  Newton (N), 799
  Newton, Sir Isaac
    Newton’s First Law, 799
    Newton’s Second Law, 807
  nHeight parameter (CreateWindowEx() function), 76
  nodes (linked lists)
    adding, 652–653
    deleting, 653–655
  non-elastic collisions, 828
  normal cooperation level (DirectSound), 604
  normal force, 824
  normal set theory, 773–774
  norms (vectors), 916
  notations, Big O, 657
  notification codes, 193
  nWidth parameter (CreateWindowEx() function), 76
  Nyquist frequency, 595

O

  objects. See also controls
    BOB (Blitter Object) engine, 527–528
      Animate_BOB() function, 534
      Collision_BOBS() function, 535
      Create_BOB() function, 528–530
      Destroy_BOB() function, 530
      Draw_BOB() function, 530–531
      Draw_Scaled_BOB() function, 531
      Hide_BOB() function, 535
      Load_Animation_BOB() function, 532
      Load_Frame_BOB() function, 531
      Move_BOB() function, 534
      Set_Animation_BOB() function, 534
      Set_Anim_Speed() function, 533
      Set_Pos_BOB() function, 533
      Set_Vel_BOB() function, 533
      Show_BOB() function, 535
    COM (Component Object Model), 218–219
      COM++, 238
      creating, 224–226
      DCOM (Distributed COM), 239
      function pointers, 232–235
      GUIDs (Globally Unique Identifiers), 223
      interfaces, 219–222
      sample program, 226–231
    DirectDraw, 245–246
    DirectInput, 544–546
    DirectSound, 602–604
    Graphics Device Interface, See GDI
    stock objects, 168–169
  offscreen surfaces
    blitting, 358–360, 365–366
    creating, 356–358
  Open_Error_File() function, 518
  operators
    >>, 934
    <<, 933
    delete, 931–932
    Element Of, 774
    intersection, 774
    new, 931–932
    overloading, 945–946
    scope resolution, 943–944
    Subset Of, 774
    union, 774
  optimizing code, 21–25, 671–672
    algorithms, 24
    assembly language, 679
    backups, 25
    binary shifts, 24
    comments, 23
    double-buffering, 304
    fixed-point math, 673–674
      accuracy, 676
      addition, 676
      converting to/from, 674–675
      division, 676–677
      multiplication, 676–677
      representing numbers, 674
      subtraction, 676
    inline functions, 22
    look-up tables, 678–679
    loop unrolling, 677–678
    mathematical functions, 672–673
    simplicity, 24–25
    variables, 22
  Outpost game, 875–876
    asteroid field, 882–884
    colors, 877
    compiling
      compilation files, 897
      runtime files, 898
    design
      gameplay, 877
      story, 876–877
    gunships, 888–891
    HUDs (Heads-Up Displays), 892–896
    mines, 886–887
    outposts, 885–886
    particle system, 896
    player’s ship (Wraith), 880–882
    playing, 896
    power-ups, 891–892
    rendering tools, 878
    scrolling, 878–880
    sound, 878
    universe size, 878
  outposts (Outpost game), 885–886
  output. See I/O (input/output)
  ovals, drawing, 180–181
  overdraw, 464
  overloading functions/operators, 945–946

P

  page flipping, 302–303
    Flip() function, 311–313
    sample program, 313–317
  page scrolling engines, 488–489
  paint programs, 26
  PALETTEENTRY structure, 139–140
  palettes, 136, 522–525
  palletized color, 136–137
  panning, 614
  parametric representations, 837
  particle systems, 859–860
    designing, 860–861
    initial conditions, generating, 866–867, 869
    Outpost game, 896
    particle engine software
      Draw_Particles() function, 866
      Init_Reset_Particles() function, 861–862
      Process_Particles() function, 864–866
      Start_Particles() function, 862–864
  passing messages to threads, 698–701
  pathfinding, 747
    A* search, 759
    bidirectional breadth-first searches, 757
    breadth-first searches, 756–757
    collision avoidance tracks, 749–750
    contour tracing, 749
    depth-first searches, 757–758
    Dijkstra’s search, 759
    racing game example, 753–754
    trial-and-error algorithms, 748–749
    waypoints, 750–753
  patterns (AI), 722–723
    conditional logic, 727–729
    creating, 723–724
    processing, 725–726
    reasonable motion, 726–727
  PC_EXPLICIT flag, 140
  PC_NOCOLLAPSE flag, 140
  PC_RESERVED flag, 140
  PeekMessage() function, 89
  pens (GDI)
    creating, 169
    defined, 167
    deleting, 171
    line styles, 169–170
    selecting, 170–171
    stock objects, 168–169
  performances (DirectMusic), 625–626
  personality traits (AI), 734–736
  physics modeling, 797–798
    acceleration, 804–807
    collisions
      2D object-to-object collision response, 841–852
      elastic vs. non-elastic, 828
      line segment intersections, 835–840
      vector reflection, 830–835
      x, y bounce physics, 828–830
    data structures, 870–871
    force, 807–809
    frame-based, 871
    friction
      air hockey example, 823
      defined, 821–822
      inclined planes, 823–828
    gravity effects
      black hole simulations, 815–816
      falling objects, 816–818
      gravitational force, 814–815
      space-time curvature, 813
      trajectory paths, 818–821
    kinematics
      forward, 853–857
      inverse, 854, 858–859
    kinetic energy, 812
    mass, 799
    momentum, 809–810
      collision response, 813
      conservation of, 811
    particle systems, 859–860
      designing, 860–861
      initial conditions, generating, 866–869
      particle engine software, 861–866
    position, 800–802
    time-based, 799–800, 871–873
    velocity, 802–803
  pixels, 133
    clipping, 332–333
    drawing to windows, 392–395
    formats, 290–293
    plotting, 173, 293–298
    plotting (DirectDraw), 272–280
  planning (high-level AI)
    actions, 741
    decision trees, 742–745
    goals, 740–741
    hard-coded plans, 742
    implementing, 745–747
    production rules, 742
  Play() function, 612
  playing sounds
    DirectSound, 612
    MIDI files, 630
    WAV files
      examples, 111–112
      PlaySound() function, 110–111
  PlaySegment() function, 630
  PlaySound() function, 110–111
  Plot16() function, 277
  Plot8() function, 277
  plotting pixels, 173, 272–280, 293–298
  Plot_Pixel16() function, 294–295
  Plot_Pixel_Fast16() function, 295
  Plot_Pixel_Faster16() function, 296
  point containment, 484–486
  Point Slope form, 413–415
  pointers, 69
    function pointers, 232–235
    requesting, 221
  points
    drawing, 173–175
    rotating, 439–441
  Poll() function, 543
  polling devices, 543, 574
  polling loops, 701
  Polygon() function, 181
  polygons
    collision detection
      bounding boxes, 481–484
      bounding circles, 478–481
      point containment, 484–486
    convex vs. concave, 427
    data structures, 428–430
    drawing, 181–182, 430–432
    filling, 458–459
    functions, 511–513
    local coordinates, 431
    quadrilaterals, 459
      drawing, 461–464
      rasterizing, 472–473
      triangulating, 473–477
    rotating, 441–443
    scaling, 445–446
    triangles, 459
      clipping, 464
      decomposition, 470–471
      drawing, 461–470
      overdraw, 464
    world coordinates, 431
  polymorphic functions, 170
  polymorphism, 927–928
  POPUP keyword, 117
  ports (DirectMusic), 626
  position vectors, 923–924
  PostMessage() function, 161–163
  postorder searches (BSTs), 668
  pounds (lbs), 799
  power-ups (Outpost game), 891–892
  predator mines (Outpost game), 886–887
  preemptive multitasking, 687
  preorder searches (BSTs), 668
  preprocessor directives
    #define, 60, 501–502
    #include, 60
  prerecorded demo mode, 680–682
  primary buffers (DirectSound), 606
  primary surfaces (DirectDraw), 242
    creating
      capabilities control settings, 270–271
      code listing, 271–272
      CreateSurface() function, 264
      DDSURFACEDESC2 data structure, 265–270
    defined, 264
    locking, 275–276
    unlocking, 277
  printf() function, 932
  printing text
    DrawText() function, 137
    example, 140–141
    foreground/background colors, 139–140
    sample program, 141–143
    TextOut() function, 137
  priority
    AI (artificial intelligence) plans, 747
    cooperation level (DirectSound), 604
    threads, 687
  private classes, 936
  Process_Particles() function, 864–866
  production rules (AI), 742
  pszSound parameter (PlaySound() function), 110
  public classes, 936
  public keyword, 936
  puzzle games, 14
  pvRef parameter (EnumDevices() function), 564
  Pythagorean theorem, 437, 913

Q–R

  quadrilaterals, 459
    drawing, 461–464
    rasterizing, 472–473
    triangulating, 473–477
  querying
    DirectSound
      GetCaps() function, 614–616
      GetStatus() function, 616
    interfaces, 237–238
  QueryInterface() function, 221, 238, 247
  racing games, 753–754
  radians, 435, 912
  radii of influence, 736
  RAM, VRAM (video RAM), 134
  random motion, 716–717
  rasterization, 134
    Bresenham’s algorithm, 403–406
      accuracy, 406
      code listing, 407–409
    quadrilaterals, 472–473
    Run-Slicing algorithm, 409
    Symmetric Double Step algorithm, 411
  .RC filename extension, 97
  reading
    bitmap files, 348
    input device data
      joysticks, 574–575
      keyboards, 551–553
      mouse devices, 559–560
  reasonable motion, 726–727
  recording
    demos
      AI-controlled demos, 682
      prerecorded demos, 680–682
    sound, 599–600
  Rectangle() function, 177–179
  rectangles, drawing
    FillRect() function, 178–179
    FrameRect() function, 178
    Rectangle() function, 177–179
  recursion, 659–662
  red, green, blue (RGB) color model, 135–137, 381
  referential variables, 929–930
  reflection equations
    calculating, 830–834
    example, 834–835
  refresh rates, 134
  RegisterClass() function, 74
  RegisterClassEx() function, 74
  registering Windows classes, 74
  relative mode (mouse), 556
  Release() function, 222, 284
  ReleaseDC() function, 130, 384
  releasing
    input devices, 545
      joysticks, 575
      mouse, 560
    MIDI files, 631
    sound buffers, 611
  rendering sounds, 612
  .RES filename extension, 97
  resolution, 133
    amplitude resolution, 596
    DirectDraw video modes, 255–256
  resource compiler, 97
  restitution, coefficient of, 844–845
  Retained Mode (Direct3D), 218
  retro games, 14
  return codes
    DirectDrawCreate() function, 247
    MessageBox() function, 64
  RGB (red, green, blue) color model, 135–137, 381
  RGNDATAHEADER structure, 341
  right triangles, 912, 915. See also trigonometry
  Rotate_Colors() function, 525
  Rotate_Polygon2D() function, 513
  rotation
    accuracy, 444
    bitmaps, 366–368
    matrices, 455–457
    points in 2D planes, 439–441
    polygons, 441–443
    trigonometry, 435–439
  Run-Slicing algorithm, 409
  runtime files (Outpost game), 898

S

  sample rates, 595
  Save_Palette() function, 524
  Save_Palette_To_File() function, 523
  saving games, 682–683
  scalar multiplication, 917–918, 450
  Scale_Polygon2D() function, 513
  scaling, 445–446
    bitmaps, 366–373
    matrices, 455
  scan codes, 151
  scanf() function, 932
  Screen_Transition() function, 516
  scripts (AI)
    C/C++ compiler, 762–767
    Functions section, 763
    Globals section, 763
    Main section, 763
    scripting language design, 759–762
  scrolling
    homogeneous tile engines, 489–494
    Outpost game, 878–880
    page scrolling engines, 488–489
    sparse bitmap tile engines, 494–495
  searching
    BSTs (binary search trees), 668–671
    pathfinding, 747
      A* search, 759
      bidirectional breadth-first searches, 757
      breadth-first searches, 756–757
      collision avoidance tracks, 749–750
      contour tracing, 749
      depth-first searches, 757–758
      Dijkstra’s search, 759
      racing game example, 753–754
      trial-and-error algorithms, 748–749
      waypoints, 750–753
  secondary buffers (DirectSound)
    circular buffering, 607
    creating, 607–610
    locking, 610–611
    releasing, 611
    static, 606
    streaming, 606
    unlocking, 611
    writing to, 610–611
  secondary surfaces (DirectDraw), 242, 264
  SelectObject() function, 170–171
  semaphores, 710
  sending messages
    to controls, 195–197
    PostMessage() function, 161–163
    SendMessage() function, 161–163
  SendMessage() function, 161–163, 195–197
  set inclusion, 774
  SetBkMode() function, 140
  SetClipper() function, 342, 397
  SetColorKey() function, 361–364
  SetCooperativeLevel() function, 251–252, 543, 548, 605
  SetCursor() function, 104
  SetDataFormat() function, 543, 549
  SetDisplayMode() function, 293
  SetEntries() function, 354
  SetFrequency() function, 613
  SetHWnd() function, 397
  SetMenu() function, 120
  SetPalette() function, 272
  SetPan() function, 614
  SetPixel() function, 173–175, 234–235
  SetProperty() function, 543
  SetTimer() function, 185
  SetVolume() function, 613
  Set_Animation_BOB() function, 534
  Set_Anim_Speed() function, 533
  Set_Palette() function, 524
  Set_Palette_Entry() function, 522
  Set_Pos_BOB() function, 533
  Set_Vel_BOB() function, 533
  Shannon’s Theorem, 595
  shapes
    circles, 180–181
    ellipses (ovals), 180–181
    lines
      clipping, 411–413, 419–427
      drawing, 402–411, 175–177
      intersection of, calculating, 413–418
    points, 173–175
    polygons, 181–182
      collision detection, 478–486
      convex vs. concave, 427
      data structures, 428–430
      drawing, 430–432
      filling, 458–459
      functions, 511–513
      local coordinates, 431
      rotating, 441–443
      scaling, 445–446
      world coordinates, 431
    rectangles
      FillRect() function, 178–179
      FrameRect() function, 178
      Rectangle() function, 177–179
    quadrilaterals, 459
      drawing, 461–464
      rasterizing, 472–473
      triangulating, 473–477
    triangles, 459. See also trigonometry
      clipping, 464
      decomposition, 470–471
      drawing, 461–470
      overdraw, 464
      right triangles, 912, 915
  ships (Outpost game)
    gunships, 888–891
    player’s ship (Wraith), 880–882
  ShowCursor() function, 446
  Show_BOB() function, 535
  shutting down DirectMusic, 631–632
  signaled threads, 702–704
  sines, 593, 913
  SIZE_MAXHIDE flag, 147
  SIZE_MAXIMIZED flag, 147
  SIZE_MAXSHOW flag, 147
  SIZE_MINIMIZED flag, 147
  SIZE_RESTORED flag, 147
  Sleep() function, 190
  slopes (lines), 404
  SM_ARRANGE constant, 199
  SM_CLEANBOOT constant, 199
  SM_CMOUSEBUTTONS constant, 199
  SM_CXBORDER constant, 199
  SM_CXCURSOR constant, 199
  SM_CXDOUBLECLK constant, 200
  SM_CXDRAG constant, 200
  SM_CXEDGE constant, 200
  SM_CXFIXEDFRAME constant, 200
  SM_CXFULLSCREEN constant, 200
  SM_CXHSCROLL constant, 200
  SM_CXHTHUMB constant, 200
  SM_CXICON constant, 200
  SM_CXICONSPACING constant, 201
  SM_CXMAXIMIZED constant, 201
  SM_CXMAXTRACK constant, 201
  SM_CXMENUCHECK constant, 201
  SM_CXMENUSIZE constant, 201
  SM_CXMIN constant, 201
  SM_CXMINIMIZED constant, 201
  SM_CXMINSPACING constant, 201
  SM_CXMINTRACK constant, 201
  SM_CXSCREEN constant, 201
  SM_CXSIZE constant, 201
  SM_CXSIZEFRAME constant, 201
  SM_CXSMICON constant, 202
  SM_CXSMSIZE constant, 202
  SM_CXVSCROLL constant, 202
  SM_CYCAPTION constant, 202
  SM_CYCURSOR constant, 199
  SM_CYDOUBLECLK constant, 200
  SM_CYDRAG constant, 200
  SM_CYEDGE constant, 200
  SM_CYFIXEDFRAME constant, 200
  SM_CYFULLSCREEN constant, 200
  SM_CYHSCROLL constant, 200
  SM_CYICON constant, 200
  SM_CYICONSPACING constant, 201
  SM_CYKANJIWINDOW constant, 202
  SM_CYMAXIMIZED constant, 201
  SM_CYMAXTRACK constant, 201
  SM_CYMENU constant, 202
  SM_CYMENUCHECK constant, 201
  SM_CYMENUSIZE constant, 201
  SM_CYMIN constant, 201
  SM_CYMINIMIZED constant, 201
  SM_CYMINSPACING constant, 201
  SM_CYMINTRACK constant, 201
  SM_CYSCREEN constant, 201
  SM_CYSIZE constant, 201
  SM_CYSIZEFRAME constant, 201
  SM_CYSMCAPTION constant, 202
  SM_CYSMICON constant, 202
  SM_CYSMSIZE constant, 202
  SM_CYVSCROLL constant, 202
  SM_CYVTHUMB constant, 202
  SM_DBCSENABLED constant, 202
  SM_DEBUG constant, 202
  SM_MENUDROPALIGNMENT constant, 202
  SM_MIDEASTENABLED constant, 202
  SM_MOUSEPRESENT constant, 202
  SM_MOUSEWHEELPRESENT constant, 202
  SM_NETWORK constant, 202
  SM_PENWINDOW constant, 202
  SM_SECURE constant, 203
  SM_SHOWSOUNDS constant, 203
  SM_SLOWMACHINE constant, 203
  SM_SM_CYBORDER constant, 199
  SM_SWAPBUTTON constant, 203
  SND_ASYNC value, 110
  SND_FILENAME value, 110
  SND_LOOP value, 110
  SND_MEMORY value, 110
  SND_NODEFAULT value, 110
  SND_NOSTOP value, 111
  SND_NOWAIT value, 111
  SND_PURGE value, 110
  SND_RESOURCE value, 110
  SND_SYNC value, 110
  software
    3D modelers, 26
    compilers, 26–29
    DirectX, see DirectX
    drawing programs, 26
    image processing programs, 26
    MIDI sequencing programs, 27
    paint programs, 26
    sound-processing programs, 26
  solid brushes, 172
  somas, 767
  sound, 97, 589–590
    decibels, 613
    digital, 594
      amplitude resolution, 596
      sample rates, 595
    DirectMusic, 217
      COM initialization, 624
      interfaces, 622–624
      MIDI loader, 626–630
      MIDI playback, 630–631
      performances, 625–626
      ports, 626
      shutting down, 631–632
    DirectSound, 217, 601–602
      cooperation levels, 604–605
      DirectSound objects, creating, 602–604
      interfaces, 602
      panning, 614
      playback frequencies, 613
      playing sounds, 612
      primary buffers, 606
      querying, 614–616
      secondary buffers, 606–611
      stopping sounds, 612
      volume control, 612–613
      .WAV loader, 616–622
    DirectSound3D, 217
    FM synthesis, 596–597
    hearing, physiology of, 592
    MessageBeep() function, 65–66
    MIDI (Musical Instrument Digital Interface) filesloading, 626–630
      playing, 630
      releasing, 631
      sequencing programs, 27
      status, checking, 631
      stopping, 631
    Outpost game, 878
    processing, 600
    recording, 599–600
    sound waves, 590–591
      amplitude, 592
      frequency, 592
      velocity, 591
      waveforms, 592–593
    sound-processing software, 26
    sound/music library (T3DLIB3), 632–633
      DirectMusic API wrapper, 640–643
      DirectSound API wrapper, 635–640
      globals, 634–635
      header file, 633
      types, 633–634
    spectrum, 593
    WAV files, 108–109, 616–617
      playing, 110–112
      reading, 617–622
      resource files, 109
      sample program, 112–114
      stopping, 112
    wave guide synthesis, 598–599
    wave table synthesis, 598
  source color keying, 361–363
  space-time curvature, 813
  spectrum of sound, 593
  split-screen setup (multiplayer games), 684
  sport games, 13
  Start_Clock() function, 526
  Start_Particles() function, 862–864
  state
    DirectInput devices, 552
    FSMs (finite state machines), 729–730
      example, 730–734
      personality traits, 734–736
  static secondary buffers, 606
  static structures, 648
  statistics, retrieving
    GetSystemInfo() function, 198–199
    GetSystemMetrics() function, 199–203
    GetTextMetrics() function, 204–205
  stock objects, 168–169
  Stop() function, 612
  stopping
    sounds
      DirectSound, 612
      MIDI files, 631
      WAV files, 112
    threads, 692, 697
      with messages, 698–701
      TerminateThread() function, 698
  storyboards, 15–16
  strategy games, 14
  stream I/O (input/output), 932–934
  streaming secondary buffers, 606
  string resources, 97, 106
    loading, 108
    string tables, 107
  struct keyword, 648
  structures, 934–935
    arrays, 648–649
    BITMAPFILEHEADER, 346
    BITMAPINFO, 346
    BITMAPINFOHEADER, 346–347
    BSTs (binary search trees), 662–666
      building, 666–668
      orders, 662
      searching, 668–671
    COLORREF, 385
    DDCOLORCONTROL, 383
    DDPIXELFORMAT, 290–291
    DDSURFACEDESC2
      ddckCKDestBlt field, 268
      ddckCKSrcBlt field, 268
      ddpfPixelFormat field, 268–269
      ddsCaps field, 270–271
      dwBackBufferCount field, 268
      dwFlags field, 266
      dwHeight field, 266
      dwSize field, 265
      dwWidth field, 266
      lPitch field, 266–267
      lpSurface field, 268
    DIJOYSTATE, 550
    DIJOYSTATE2, 550
    DIMOUSESTATE, 550
    DMUSIC_MIDI, 627
    DSBCAPS, 615
    DSBUFFERDESC, 607–608
    DSCAPS, 614–615
    linked lists, 649–650
      creating, 650–651
      doubly linked lists, 656
      nodes, adding/deleting, 652–655
      traversing, 651–652
    PALETTEENTRY, 139–140
    physics modeling, 870–871
    polygons, 428–430
    RGNDATAHEADER, 341
    static, 648
    SYSTEM_INFO, 198
    T3DLIB1 library, 503–505
    TEXTMETRIC, 204–205
    WAVEFORMATEX, 608–609
    WNDCLASS, 67
    WNDCLASSEX
      cbClsExtra field, 70
      cbSize field, 67
      cbWndExtra field, 70
      hbrBackground field, 72
      hCursor field, 71
      hInstance field, 70
      initializing, 74
      lpCursorName field, 71
      lpfnWndProc field, 68–69
      lpszClassName field, 73
      lpszMenuName field, 73
      style field, 67–68
  style field (WNDCLASSEX structure), 67–68
  Subset Of operator, 774
  subtraction
    fixed-point mathematics, 676
    matrices, 449
    vectors, 919
  SUCCEEDED macro, 246
  surfaces, 307. See also manifolds
    back buffers, 307–309
    color palettes, attaching, 272
    complex, 309–310
    creating
      capabilities control settings, 270–271
      code listing, 271–272
      CreateSurface() function, 264
      DDSURFACEDESC2 data structure, 265–270
    filling, 325–328
    locking, 275–276
    offscreen
      blitting, 358–360, 365–366
      creating, 356–358
    primary, 242, 264
    secondary, 242, 264
    unlocking, 277
  SW_HIDE value, 62
  SW_MAXIMIZE value, 62
  SW_MINIMIZE value, 62
  SW_RESTORE value, 62
  SW_SHOW value, 62
  SW_SHOWMAXIMIZED value, 62
  SW_SHOWMINIMIZED value, 62
  SW_SHOWMINNOACTIVE value, 62
  SW_SHOWNA value, 62
  SW_SHOWNOACTIVATE value, 62
  SW_SHOWNORMAL value, 62
  Symmetric Double Step algorithm, 411
  synchronization, 486–488, 704–707
  synthesized sound
    FM synthesis, 596–597
    MIDI (Musical Instrument Digital Interface) files, 597–598
      loading, 626–630
      playing, 630
      releasing, 631
      status, checking, 631
      stopping, 631
    wave guide synthesis, 598–599
    wave table synthesis, 598
  system statistics, retrieving
    GetSystemInfo() function, 198–199
    GetSystemMetrics() function, 199–203
    GetTextMetrics() function, 204–205
  SYSTEM_INFO structure, 198

T

  T3D Game Console, 205
    architecture, 206
    Game_Init() function, 206
    Game_Main() function, 206, 297–298
    Game_Shutdown() function, 207
    WinMain() function, 207–210
  T3DLIB1 library, 500
    2D graphic functions
      Clip_Line(), 514
      Draw_Clip_Line(), 513
      Draw_Line(), 514
      Draw_Pixel(), 515
      Draw_Text_GDI(), 516
      HLine(), 515
      Screen_Transition(), 516
      VLine(), 516
    2D polygon functions
      Draw_Filled_ Polygon2D(), 512
      Draw_QuadFP_2D(), 512
      Draw_Triangle_2D(), 511
      Rotate_Polygon2D(), 513
      Scale_Polygon2D(), 513
      Translate_Polygon2D(), 512
    bitmap functions
      Create_Bitmap(), 520
      Destroy_Bitmap(), 520
      Draw_Bitmap(), 522
      Flip_Bitmap(), 522
      Load_Bitmap_File(), 519
      Load_Image_Bitmap(), 521
      Unload_Bitmap_File(), 519
    data types, 503–505
    #defines directives, 501–502
    DirectDraw interface functions
      DDraw_Attach_Clipper(), 508
      DDraw_Create_Surface(), 508
      DDraw_Fill_Surface(), 509
      DDraw_Flip(), 508
      DDraw_Init(), 507
      DDraw_Lock_Back_ Surface(), 510
      DDraw_Lock_Primary_ Surface(), 510
      DDraw_Lock_Surface(), 509
      DDraw_Shutdown(), 507
      DDraw_Unlock_ Surface(), 510
      DDraw_Wait_For_ Vsync(), 509
    engine architecture, 500–501
    globals, 506–507
    macros, 502–503
    math/error functions
      Close_Error_File(), 518
      Fast_Distance(), 517
      Fast_Distance_3D(), 517
      Find_Bounding_Box_ Poly2D(), 518
      Open_Error_File(), 518
      Write_Error(), 518
    palette functions
      Blink_Colors(), 525
      Get_Palette_Entry(), 523
      Load_Palette_From_ File(), 524
      Rotate_Colors(), 525
      Save_Palette(), 524
      Save_Palette_To_File(), 523
      Set_Palette(), 524
      Set_Palette_Entry(), 522
    structures, 503–505
    utility functions
      Collision_Test(), 526
      Color_Scan(), 527
      Get_Clock(), 525
      Start_Clock(), 526
      Wait_Clock(), 526
  T3DLIB2.CPP (generalized input system), 582–584
    functions
      DInput_Init(), 584
      DInput_Init_Joystick(), 585
      DInput_Init_Keyboard(), 584
      DInput_Init_Mouse(), 585
      DInput_Read_Joystick(), 587
      DInput_Release_ Joystick(), 585–586
      DInput_Release_ Keyboard(), 585
      DInput_Release_ Mouse(), 585–586
      DInput_Shutdown(), 584
    modules, 588
  T3DLIB3 sound/music library, 632–633
    DirectMusic API wrapper functions
      DMusic_Delete_All_ MIDI(), 642
      DMusic_Delete_MIDI(), 642
      DMusic_Init(), 641
      DMusic_Load_MIDI(), 641
      DMusic_Play(), 642
      DMusic_Shutdown(), 641
      DMusic_Status(), 643
      DMusic_Stop(), 642
    DirectSound API wrapper functions
      DSound_Delete_Sound(), 638
      DSound_Init(), 635
      DSound_Load_WAV(), 636
      DSound_Play_Sound(), 637–638
      DSound_Replicate_ Sound(), 637
      DSound_Set_Sound_ Freq(), 640
      DSound_Set_Sound_ Pan(), 640
      DSound_Set_Sound_ Volume(), 639
      DSound_Shutdown(), 636
      DSound_Status_Sound(), 638–639
      DSound_Stop_Sound(), 638
    globals, 634–635
    header file, 633
    types, 633–634
  tables
    CLUTs (color lookup tables), 136
    look-up tables, 678–679
    string tables, 107
    VTABLEs (Virtual() function Tables), 232
  taking turns (multiplayer games), 683
  tangents, 913
  templates, 352
  TerminateThread() function, 698
  terminating threads, 692, 697
    with messages, 698–701
    TerminateThread() function, 698
  testing game design, 16
  text
    ASCII character chart, 955–960
    fonts
      changing, 182
      creating, 183–184
      monospaced, 183
    message boxes
      MessageBox() function, 63–64
      sample program, 59–60
      sounds, 65–66
    printing
      DrawText() function, 137
      example, 140–141
      foreground/background colors, 139–140
      sample program, 141–143
      TextOut() function, 137
  text metrics, 204–205
  TEXTMETRIC structure, 204–205
  TextOut() function, 137
  threads, 51, 686, 711
    advantages, 687, 689
    creating, 689–691
    defined, 687
    DirectX, 709–710
    handles, closing, 691–692
    multiple objects, waiting for, 707–709
    multithreading, 51–53
    priority, 687
    sample programs, 693–696
    signaling, 702–704
    synchronizing, 704–707
    terminating, 692, 697
      with messages, 698–701
      TerminateThread() function, 698
  tile-based scrolling engines
    homogeneous tile engines, 489–494
    sparse bitmap tile engines, 494–495
  time-based modeling, 799–800, 871–873
  timers
    creating, 185
    destroying, 186
  timing, 184, 486–488
    low-level, 187–190
    time-based modeling, 799–800, 871–873
    timers
      creating, 185
      destroying, 186
    WM_TIMER message, 184–187
  tracing object contours, 749
  tracking algorithms
    literal vectoring, 717–718
    trajectory vectoring, 718–721
  tracks, collision avoidance, 749–750
  trajectory paths, 818–821
  transformations, 432
    matrices, 452–454
    rotation
      accuracy, 444
      points in 2D planes, 439–441
      polygons, 441–443
      trigonometry, 435–439
    scaling, 445–446
    translation, 433–434
  TranslateMessage() function, 85
  Translate_Polygon2D() function, 512
  translation, 433–434, 454
  traversing linked lists, 651–652
  trees, binary, 662–666
    building, 666–668
    orders, 662
    searching, 668–671
  trial-and-error pathfinding algorithms, 748–749
  triangles, 459. See also trigonometry
    clipping, 464
    decomposition, 470–471
    drawing, 461–464
      flat-bottom triangles, 467–470
      flat-top triangles, 465–467
    overdraw, 464
    right triangles, 912, 915
  triangulating quadrilaterals, 473–477
  trigonometry, 435–439, 911–912
    cosines, 913
    identities, 438, 914–915
    Pythagorean theorem, 913
    sines, 913
    tangents, 913
  triple buffering, 268, 312
  troubleshooting memory leaks, 942
  truth table (neurode network), 769
  tuning (fuzzifaction), 782
  turn-taking (multiplayer games), 683
  typecast errors, 909
  types, 503–505

U

  Unacquire() function, 553–554
  unacquiring keyboard devices, 553–554
  uncertainty logic. See fuzzy logic
  union operator, 774
  Unload_Bitmap_File() function, 351–352, 519
  unloading bitmaps, 351–352, 519
  Unlock() function, 277, 611
  unlocking
    DirectDraw surfaces, 277
    sound buffers, 611
  unrolling loops, 677–678
  unsignaled threads, 702–704
  UpdateWindow() function, 77
  updating windows, 77
  Usenet newsgroups, 951–952
  user input
    keyboard, 150
      ASCII codes, 151
      event handling, 151–158
      scan codes, 151
    mouse, 158–161
  utype parameter (MessageBox() function), 63

V

  ValidateRect() function, 131
  variables
    32-bit, 22
    creating, 930–931
    global, 22
    naming, 56
    referential, 929–930
  VC++ compiler. See C/C++ compiler
  vectors, 915–916
    addition, 918–919
    cross products, 921–923
    dot products, 919–921
    length, 916–917
    as linear combinations, 924
    lines
      clipping, 411–413, 419–427
      drawing, 175–177, 402–411
      intersection of, calculating, 413–418
    normalization, 917
    polygons, 181–182
      collision detection, 478–486
      convex vs. concave, 427
      data structures, 428–430
      drawing, 430–432
      filling, 458–459
      functions, 511–513
      local coordinates, 431
      rotating, 441–443
      scaling, 445–446
      world coordinates, 431
    position vectors, 923–924
    scalar multiplication, 917–918
    subtraction, 919
    tracking algorithms
      literal vectoring, 717–718
      trajectory vectoring, 718–721
    zero vectors, 923
  velocity, 591, 802–803
  video displays, 133–135
  video modes (DirectDraw)
    changing, 256–257
    resolutions, 255–256
    sample program, 257–258
    setting, 255
  video RAM (VRAM), 134
  virtual key codes, 154
  VLine() function, 516
  volume control, 612–613
  VRAM (video RAM), 134
  VTABLEs (virtual function tables), 232

W

  WaitForMultipleObjects() function, 703–704, 707
  WaitForSingleObject() function, 702–704
  WAIT_ABANDONED value
    WaitForMultipleObjects() function, 704
    WaitForSingleObject() function, 703
  Wait_Clock() function, 526
  WAIT_OBJECT_0 value
    WaitForMultipleObjects() function, 704
    WaitForSingleObject() function, 703
  WAIT_TIMEOUT value
    WaitForMultipleObjects() function, 704
    WaitForSingleObject() function, 703
  WAV files, 616–617
    loader, 616–622
    playing
      examples, 111–112
      PlaySound() function, 110–111
    reading, 617–622
    resource files, 109
    sample program, 112–114
    stopping, 112
  wave guide synthesis, 598–599
  WAVE keyword, 109
  wave table synthesis, 598
  WAVEFORMATEX structure, 608–609
  waveforms, 592–593
  waves (sound), 590–593
    amplitude, 592
    frequency, 592
    spectrum, 593
    velocity, 591
    waveforms, 592–593
  waypoint pathfinding, 750–753
  WA_ACTIVE flag, 144
  WA_CLICKACTIVE flag, 144
  WA_INACTIVE flag, 144
  Web sites
    Belm Design Group, 953
    Blues News, 952
    game programming resources, 949–950
      2D/3D engines, 950–951
      book reviews, 951
      download sites, 950
      magazines, 952
    Microsoft, 908, 951
    Xtreme Games LLC, 953
  Win-G, 11
  WINAPI declarator, 61
  windowed mode (DirectDraw), 250
  windows
    coordinates, 132
    creating, 75–77
    DirectDraw, 390–391
      8-bit windowed modes, 398–399
      client area, 395–397
      clipping, 397–398
      creating, 391–392
      drawing to, 392–395
    multiple, 90–92
    updating, 77
  Windows operating system
    controls, 190
      buttons, 191–194
      sending messages to, 195–197
    event handling, 77, 143
      event model, 53–54
      keyboard input, 150–158
      main event loops, 84–89
      mouse input, 158–161
      real-time event loops, 89–90
      window manipulation messages, see messages
      WinProc, 78–84
    historical overview
      Windows 1.0, 48
      Windows 2.0, 48
      Windows 3.x, 48–49
      Windows 95, 49–50
      Windows 98, 50
      Windows NT, 50
    Hungarian notation
      class naming, 57
      constant naming, 57
      function naming, 56
      parameter naming, 58
      prefix codes, 55–56
      type naming, 57
      variable naming, 56
    message boxes
      MessageBox() function, 63–64
      sample program, 59–60
      sounds, 65–66
    multitasking, 51–52
    multithreading, 51–53
    programs, see programs, 58
    scheduler, 51
    windows
      creating, 75–77
      multiple, 90–92
      updating, 77
    Windows classes, 66
      registering, 74
      style flags, 67–68
      WNDCLASS structure, 67
      WNDCLASSEX structure, 67–74
  WinMain() function, 45, 59
    parameters
      hinstance, 61
      hprevinstance, 61
      lpcmdline, 61
      ncmdshow, 61–62
    T3D Game Console, 207–210
  WinProc() function
    menus, 123–125
    message IDs, 79–80
    parameters, 79
    prototype, 78
    sample program, 80–84
  wireframe polygons. See polygons
  WM_ACTIVATE message, 79, 144–145
  WM_ACTIVATEAPP message, 144
  WM_CHAR message, 151–153
  WM_CLOSE message, 144–147
  WM_CREATE message, 79–80
  WM_DESTROY message, 79–80
  WM_KEYDOWN message, 80, 153–155
  WM_KEYUP message, 80, 154
  WM_LBUTTONDBLCLK message, 160
  WM_LBUTTONDOWN message, 160
  WM_LBUTTONUP message, 160
  WM_MBUTTONDBLCLK message, 160
  WM_MBUTTONDOWN message, 160
  WM_MBUTTONUP message, 160
  WM_MOUSEMOVE message, 79, 158, 160
  WM_MOVE message, 79, 144, 149–150
  WM_MOVING message, 144
  WM_PAINT message, 80, 128–133
  WM_QUIT messages, 80
  WM_RBUTTONDBLCLK message, 160
  WM_RBUTTONDOWN message, 160
  WM_RBUTTONUP message, 160
  WM_SIZE message, 80, 144, 147–148
  WM_SIZING message, 144
  WM_TIMER message, 80, 184–187
  WM_USER messages, 80
  WNDCLASSEX structure
    cbClsExtra field, 70
    cbSize field, 67
    cbWndExtra field, 70
    hbrBackground field, 72
    hCursor field, 71
    hInstance field, 70
    initializing, 74
    lpCursorName field, 71
    lpfnWndProc field, 68–69
    lpszClassName field, 73
    lpszMenuName field, 73
    style field, 67–68
  world coordinates, 431
  Wraith (Outpost game), 880–882
  Write_Error() function, 518
  Write_Primary cooperation level (DirectSound), 605
  writing
    pixels to screen, 293–298
    to secondary buffers, 610–611
  WS_BORDER value, 76
  WS_CAPTION value, 76
  WS_HSCROLL value, 77
  WS_ICONIC value, 76
  WS_MAXIMIZE value, 76
  WS_MAXIMIZEBOX value, 76
  WS_MINIMIZE value, 76
  WS_MINIMIZEBOX value, 76
  WS_OVERLAPPED value, 76
  WS_OVERLAPPEDWINDOW value, 76
  WS_POPUP value, 76
  WS_POPUPWINDOW value, 76
  WS_SIZEBOX value, 77
  WS_SYSMENU value, 76
  WS_VISIBLE value, 76
  WS_VSCROLL value, 77
  Wu, Xialon, 411

X–Y–Z

  x parameter (CreateWindowEx() function), 75
  X(8).8.8.8 bit encoding format, 300
  X.5.5.5 bit encoding format, 289
  Xtreme Games LLC Web site, 953
  y parameter (CreateWindowEx() function), 75
  Y-Intercept form, 416
  zero matrix, 449
  zero vectors, 923

Table of Contents

Copyright © Macmillan Computer Publishing, Inc.

Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.