Table of Contents for
Gaming Hacks

Version ebook / Retour

Cover image for bash Cookbook, 2nd Edition Gaming Hacks by Simon Carless Published by O'Reilly Media, Inc., 2004
  1. Cover
  2. Gaming Hacks
  3. Credits
  4. Contributors
  5. Acknowledgments
  6. Foreword
  7. Preface
  8. How to Use This Book
  9. How This Book Is Organized
  10. Conventions Used in This Book
  11. Using Code Examples
  12. Comments and Questions
  13. Got a Hack?
  14. 1. Playing Classic Games
  15. Legal Emulation
  16. Play Commodore 64 Games Without the C-64
  17. Play Atari ROMs Without the Atari
  18. Use Atari Paddles with Your PC
  19. Run Homebrew Games on the Atari 2600
  20. Create Your Own Atari 2600 Homebrew Games
  21. Play Classic PC Graphic Adventures
  22. Play Old Games Through DOSBox
  23. Play Reissued All-in-One Joystick Games
  24. Play Arcade Games Without the Arcade
  25. Add and Manipulate a MAME Frontend
  26. Keep Your ROMs Tidy and Organized
  27. Learn Game-Specific MAME Controls
  28. Filter Inappropriate MAME ROMs
  29. Autoboot into MAME Heaven
  30. Play Emulated Arcade Games Online
  31. Play Classic Pinball Without the Table
  32. Emulate the SNES on the Dreamcast
  33. 2. Playing Portably
  34. Play Games on Your iPod
  35. Mod Your Game Boy
  36. Take and Print Photos with Your Game Boy
  37. Compose Music on Your Game Boy
  38. Explore the GP32 Handheld Gaming System
  39. Take Your Console with You
  40. Explore the Bandai WonderSwan
  41. Play Real Games on Your PDA
  42. Install a PlayStation 2 in Your Car
  43. 3. Playing Well with Others
  44. Practice Proper MMORPG Etiquette
  45. Understand MMORPG Lingo
  46. Grind Without Going Crazy
  47. Make a Profit in Vana’diel
  48. Write MMORPG Macros
  49. Build an Effective Group
  50. Catch Half-Life FPS Cheaters Redhanded
  51. 4. Playing with Hardware
  52. Build a Quiet, Killer Gaming Rig
  53. Find and Configure the Best FPS Peripherals
  54. Adapt Old Video Game Controllers to the PC
  55. Choose the Right Audio/Video Receiver
  56. Place Your Speakers Properly
  57. Connect Your Console to Your Home Theater
  58. Tune Console Video Output
  59. Tune Your TV for Console Video
  60. PC Audio Hacking
  61. Optimize PC Video Performance
  62. Build a Dedicated Multimedia PC
  63. Use a Multimedia Projector for Gaming
  64. 5. Playing with Console and Arcade Hardware
  65. Play LAN-Only Console Games Online
  66. Hack the Nuon DVD Player/Gaming System
  67. Play Import Games on American Consoles
  68. Find a Hackable Dreamcast
  69. Play Movies and Music on Your Dreamcast
  70. Hack the Dreamcast Visual Memory Unit
  71. Unblur Your Dreamcast Video
  72. Use Your Dreamcast Online
  73. Host Dreamcast Games Online
  74. Burn Dreamcast-Compatible Discs on Your PC
  75. Burn Dreamcast Homebrew Discs
  76. Buy Your Own Arcade Hardware
  77. Configure Your Arcade Controls, Connectors, and Cartridges
  78. Reorient and Align Your Arcade Monitor
  79. Buy Cart-Based JAMMA Boards
  80. Programming Music for the Nintendo Entertainment System
  81. 6. Playing Around the Game Engine
  82. Explore Machinima
  83. Choose a Machinima Engine
  84. Film Your First Machinima Movie
  85. Improve Your Camera Control
  86. Record Game Footage to Video
  87. Speedrun Your Way Through Metroid Prime
  88. Sequence-Break Quake
  89. Run Classic Game ROM Translations
  90. Change Games with ROM Hacks
  91. Apply ROM Hacks and Patches
  92. Create PS2 Cheat Codes
  93. Hack Xbox Game Saves
  94. Cheat on Other Consoles
  95. Modify PC Game Saves and Settings
  96. Buff Your Saved Characters
  97. Create Console Game Levels
  98. 7. Playing Your Own Games
  99. Adventure Game Studio Editing Tips
  100. Create and Play Pinball Tables
  101. Put Your Face in DOOM
  102. Create a Vehicle Model for Unreal Tournament 2004
  103. Add a Vehicle to Unreal Tournament 2004
  104. Modify the Behavior of a UT2004 Model
  105. Download, Compile, and Create an Inform Adventure
  106. Decorate Your IF Rooms
  107. Add Puzzles to Your IF Games
  108. Add Nonplayer Characters to IF Adventures
  109. Make Your IF NPCs Move
  110. Make Your IF NPCs Talk
  111. Create Your Own Animations
  112. Add Interactivity to Your Animations
  113. Write a Game in an Afternoon
  114. 8. Playing Everything Else
  115. Tweak Your Tactics for FPS Glory
  116. Beat Any Shoot-Em-Up
  117. Drive a Physics-Crazed Motorcycle
  118. Play Japanese Games Without Speaking Japanese
  119. Back Up, Modify, and Restore PlayStation Saved Games
  120. Access Your Console’s Memory Card Offline
  121. Overclock Your Console
  122. Index
  123. Colophon

Create a Vehicle Model for Unreal Tournament 2004

Make and import game-suitable 3D artwork.

If you’re hacking new behavior into your favorite game, you’ll eventually need to build, beg, borrow, or steal some new art. Tweaking the gravity and weapon damage ranges can only take you so far. Creating your own artwork is the best approach, but you’ll need a modicum of talent and some experience with a graphics program such as Maya PLE, which comes with UT2004.

Tip

Maya PLE comes with many tutorials, and they appear when you run it the first time. It’s worth your while to read through them.

With that knowledge in mind, there are some specific steps to understand when creating art for a game. Let’s walk through the creation of the ‘Cuda (a 1969 Plymouth Barracuda) from our UT2004 Clone Bandits modification (http://www.demiurgestudios.com/CloneBandits/). Figure 7-5 shows the modeled image.

The ‘Cuda model

Figure 7-5. The ‘Cuda model

Modeling Considerations

There are a few things to keep in mind at the modeling stage. The ‘Cuda’s nose points in the positive Z direction, with the center of its chassis (as opposed to, say, the bottom of its wheels) at the origin. Originally, I placed it higher, with the bottom of the chassis at the origin, but eventually lowered it to help characters exit the vehicle in predictable ways.

You don’t have to combine the meshes that make up a vehicle before exporting it to Unreal. For example, the chassis and wheels of the ‘Cuda are separate meshes bound to the same skeleton. This allows more flexibility when assigning bone influences; you can do them one part at a time.

When you complete the model, pull off the guns from the main chassis, move their roots to the origin, skin them, and export them to Unreal separately. I found exporting them out into new Maya files made this process cleaner.

Creating Skeletons

The skeleton for the ‘Cuda is fairly simple. There are joints that represent each wheel and joints that define the gun attach points. Each joint is a child of the root, located at the bottom center of the chassis. Figure 7-6 shows the details.

The skeleton of the model

Figure 7-6. The skeleton of the model

Be aware of the joint orientation. In general, modelers need to orient their joints along the world axes. This applies doubly to the root and wheel joints. Slight offsets in joint orientation can cause strange-looking rotations in Unreal. You can see a joint’s orientation by choosing Object (instead of World) in the Move tool and then selecting the joint.

The gun joints are a special case. All joints in the gun skeletons are rotated such that their positive X axis points along the barrel of the gun, and the positive Z points up. This also applies to the joints that define gun attach points.

We used Smooth Bind to link the skeleton to the mesh. However, you want the vehicle to be rigid, because, generally speaking, cars don’t bend. In the Component Editor, assign all the mesh’s vertices to one bone or another. For example, only the front-right wheel bone should affect all vertices in the front-right wheel.

Exporting with ActorX

You’ll need the ActorX plug-in to export your vehicle to an Unreal-friendly format. This plug-in is freely available from the Unreal Developers Network (http://udn.epicgames.com/Two/ActorX) for both Maya and 3D Studio Max. The same site has installation instructions.

Once you’ve installed the plug-in, fire it up to see the ActorX options. Persistent settings and persistent paths are handy. Under Skin Export, checking “all skin-type” exports all skinned items, which is convenient if there is only one skinned mesh in the Maya file. Automatic triangulate is also useful, though you will usually find that Maya’s Triangulate function yields better results.

The ActorX plug-in exports two types of files, those that contain mesh and skeleton information (.PSK) and those that contain animation data (.PSA). We’ll create .PSK files because the game code will animate the ‘Cuda’s wheels procedurally.

To export the mesh, choose an output folder and a name for the file (in .PSK format), then hit the Save mesh/refpose button.

A Brief Introduction to UnrealEd

UnrealEd is a powerful and complex tool that allows you to edit, import, and create content for Unreal Tournament 2004. As we can discuss only the tip of the iceberg here, I encourage you to learn more about the editor by consulting the extensive Unreal Developers Network documentation (http://udn.epicgames.com/Engine/WebHome).

Unreal stores its content in package files. Different types of packages exist for different types of data. We will be dealing specifically with texture (.UTX) and animation (.UKX) packages.

Importing Textures

In UnrealEd, use the Texture Browser to create and edit texture packages. Open it by choosing View/Show Texture Browser in the top pull-down menu. In the Texture Browser, click File/Import . . . and navigate to your texture files, which are all 24-bit Targa files. Select all the textures and click Open. (UnEdit supports importing multiple files at once.) This brings up the Import Texture dialog.

You need to give your new package a name, then further organize your textures into groups. The Options defaults will work fine for textures that have no alpha channels. Check Alpha if a texture has smooth gradients in the alpha channel, or Masked if the alpha channel values are simply black and white, with no gray values.

Importing Meshes

Just as you created your texture package using the Texture Browser, you will import your mesh and edit it with the Animation Browser. Since you have the Texture Browser already open, click the tab at the top labeled Animations.

In the Animation Browser, click File/Mesh import, and navigate to the directory containing your new .PSK file. Use the Import Mesh/Animation dialog to name the new animation package. Remember to check Assume Maya coordinates so that your mesh comes in with the correct rotation.

Assigning Textures

Now you have to assign textures. This requires the following steps:

  1. Highlight the desired texture over in the Texture Browser by clicking it.

  2. Back in the Animation Browser, click to open the Skin array in the Mesh tab to the right.

  3. Clicking Material shows the list of materials assigned to the mesh. Click the text in the first material slot to select that slot, then hit Use to assign the selected texture to this slot.

  4. Repeat for each slot.

Assigning Collision Boxes

The Unreal vehicle code handles collision for the wheels, but you need to give the chassis a collision volume. In the Animation Browser, open the Collision section under the Mesh tab on the right (above the Skin array). In the CollisionBoxes slot, click the ... text on the right, then hit the Add button that appears. This brings up several new fields.

The first three of these fields (bBlockKarma, bBlockNonZeroExtent, and bBlockZeroExtent) describe types of collision operations. You’ll want the box to collide with all three, so in each slot, replace the 0 (false) with 1 (true). The new collision box needs to attach to a bone, so type rootcar, representing the car model’s main bone, in the BoneName field.

Next, let’s give the collision box some dimensions. Click open the Radii section, and type 100 in the X, Y, and Z fields. Now to see the new collision box, select View/Collision from the top menu. PRESTO! Suddenly there’s a big purple box, as shown in Figure 7-7.

The purple collision box

Figure 7-7. The purple collision box

Now it’s just a matter of adjusting the Radii and offset values to make the collision box fit tightly. In the mod, we ended up adding another box to the front to clean up collisions with the ground. The final product looks like Figure 7-8.

The expanded collision boxes

Figure 7-8. The expanded collision boxes

“Rigidizing” the Mesh

In Maya, each vertex is influenced by only one bone. This isn’t only visually correct, as a metal car is indeed rigid, but also allows a big performance increase in Unreal. This eliminates the hassle of constantly calculating the location of each vertex as determined by the combined effect of multiple bones. You explicitly tell the Unreal Engine to take advantage of simplified skin by “rigidizing” the mesh.

Open the LOD (Level of Detail) section in the Mesh tab. Click open the LODLevels array. By default, a mesh has four LOD levels, 0 through 3. You probably don’t need that many. The vehicles that come with Unreal Tournament 2004 have only three levels. For simplicity, let’s delete all but the first; click each level and hit the Delete button that appears.

Click open the remaining LOD level and open the Rigidize option. Clicking MeshSectionMethod brings up an arrow to the right, which in turn opens a drop-down menu. Select MSM_RigidOnly. Finalize the choice by selecting Mesh/Redigest Lod from the menu at the top of the Animation Browser. Go to wireframe view (View/Wireframe) to verify that each vertex has only one bone influence by checking that the wireframe is red instead of the default yellow. If a section had vertices with multiple influences, it would still be yellow. Figure 7-9 shows a happy red wireframe.

The wireframe view of vertex influence

Figure 7-9. The wireframe view of vertex influence

The Rest of the Story

Now that you’ve imported the ‘Cuda into Unreal, what happens next? You need to repeat the previous steps for the guns, though you won’t need collision boxes because guns don’t collide. At this point, the artwork is done, and programming work begins. A new vehicle in Unreal requires a new class ( [Hack #83] ) and, possibly, some new behavior ( [Hack #84] ).