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

Add a Vehicle to Unreal Tournament 2004

Add a new object type to an existing game, for standalone play or as part of new content.

Earlier, we created and imported a car model into UnrealEd to use in Unreal Tournament 2004 ( [Hack #82] ). Now it’s time to take that model (the 1969 Plymouth Barracuda from Clone Bandits, http://www.demiurgestudios.com/CloneBandits/) and turn it into an Actor that can be placed in a map, driven around, and used in game types such as Onslaught. The obvious next step is to enhance the ‘Cuda by adding nitrous-style speed boosts ( [Hack #84] ).

Tip

You can download the source code mentioned in this hack as well as the art packages necessary to use this example from http://www.demiurgestudios.com/CudaExample/.

Creating a Class for the ‘Cuda

To make the ‘Cuda its own object or Actor in the world of Unreal, you need to create a class for it in UnrealScript. UnrealScript is a full-featured programming language “created to provide the development team and the third-party Unreal developers with a powerful, built-in programming language that maps naturally onto the needs and nuances of game programming.”[18] You can find many UnrealScript references on the Web. Two good ones are http://udn.epicgames.com/Two/UnrealScriptReference and http://udn.epicgames.com/Two/MyFirstCode.

To create a new class, you first need to create a new UnrealScript package. From your Unreal Tournament 2004 directory (generally C:\UT2004), create a new directory. The name of this directory will be the name of your package; for this example, let’s call it CudaExample. In the CudaExample directory, create a subdirectory called Classes, and in Classes, create a text file called CudaCar.uc.

You can use any text editor to create and edit this file. Notepad will work, but you might consider an editor geared toward editing code. Microsoft Visual Studio works well, especially since it can do syntax highlighting on UnrealScript files if you tell it to treat them like C++ files. You might also consider using the Epic’s free Unreal Development Environment (UDE).

Tip

At the time of writing, UDE was still in beta and lacked its own web site. Find a download by performing a quick web search.

Once you’ve created CudaCar.uc, open it up, and declare the CudaCar class like so:

class CudaCar extends ONSRV;

This line means that your CudaCar example is based on the ONSRV class, the preexisting Scorpion vehicle in Unreal Tournament 2004. For now, the example car will behave and look exactly like the Scorpion. Later, you’ll make your class use the ‘Cuda model, but that’s the only line you need to define the class.

For the CudaCar example to work, you also need a factory to produce instances of your CudaCar. Vehicle factories create vehicles at the beginning of a game and when old vehicles are destroyed. In the same way you created CudaCar.uc, create CudaCarFactory.uc as follows:

class CudaCarFactory extends ONSVehicleFactory;

defaultproperties
{
    // mesh for factory (only seen in the Editor)
    VehicleClass=Class'CudaExample.CudaCar'

    // type of vehicle this factory spawns
    Mesh=SkeletalMesh'CloneBanditsVehicles_K.HotRod'
}

Now open up UT2004.ini in the System subdirectory of your UT2004 directory. Search for the text EditPackages, and add the line:

               EditPackages=CudaExample

to the bottom of the list. Now you can compile the CudaExample package.

Open a command prompt in the System subdirectory, and type ucc make. This command compiles any package in the EditPackages list that doesn’t have a *.u UnrealScript package file. If everything works, you’ll end up with a new CudaExample.u file. If you make changes to CudaCar.uc (or any other UnrealScript file in your package), you can recompile your code by deleting the existing CudaExample.u file and running ucc make again.

Making Your Car Use the ‘Cuda Model

Now you have two cars that act exactly the same. Let’s justify this work by making the new car class use the ‘Cuda model. Edit the defaultproperties of the CudaCar to add the following to your CudaCar.uc file:

defaultproperties
{
    // Barracuda Mesh
    Mesh=SkeletalMesh'CloneBanditsVehicles_K.HotRod'

    // Don't use team skins
    RedSkin=None
    BlueSkin=None

    // Weapon
    DriverWeapons(0)=(WeaponBone="gunRTmount")

    // Vehicle Name
    VehicleNameString="Barracuda"
    VehiclePositionString="in a Barracuda"

    // Driver Position
    DrivePos=(X=0.0,Y=-30.0,Z=35.0)

    // Lights
    HeadlightProjectorOffset=(X=139,Y=0,Z=6)     // headlight projector
    HeadlightCoronaOffset(0)=(X=135,Y=44,Z=0)    // headlights
    HeadlightCoronaOffset(1)=(X=135,Y=-44,Z=0)
    HeadlightCoronaOffset(2)=(X=10,Y=33.5,Z=40)  // roof lights
    HeadlightCoronaOffset(3)=(X=12,Y=25,Z=42)
    HeadlightCoronaOffset(4)=(X=11,Y=14.5,Z=40)
    BrakeLightOffset(0)=(X=-134,Y=39,Z=6)        // tail lights
    BrakeLightOffset(1)=(X=-134,Y=-39,Z=6)

    // Wheel and wheel bones info

    // right rear tire
    Begin Object Class=SVehicleWheel Name=RRWheel
        bPoweredWheel=True
        bHandbrakeWheel=True
        BoneName="tire02"
        BoneRollAxis=AXIS_Y
        BoneOffset=(Y=20.000000)
        WheelRadius=24.2000000
    End Object
    Wheels(0)=SVehicleWheel'RRWheel'

    // left rear tire
    Begin Object Class=SVehicleWheel Name=LRWheel
        bPoweredWheel=True
        bHandbrakeWheel=True
        BoneName="tire04"
        BoneRollAxis=AXIS_Y
        BoneOffset=(Y=-20.000000)
        WheelRadius=24.200000
    End Object
    Wheels(1)=SVehicleWheel'LRWheel'

    // right front tire
    Begin Object Class=SVehicleWheel Name=RFWheel
        bPoweredWheel=True
        SteerType=VST_Steered
        BoneName="tire"
        BoneRollAxis=AXIS_Y
        BoneOffset=(Y=20.000000)
        WheelRadius=20.000000
    End Object
    Wheels(2)=SVehicleWheel'RFWheel'

    // left front tire
    Begin Object Class=SVehicleWheel Name=LFWheel
        bPoweredWheel=True
        SteerType=VST_Steered
        BoneName="tire03"
        BoneRollAxis=AXIS_Y
        BoneOffset=(Y=-20.000000)
        WheelRadius=20.000000
    End Object
    Wheels(3)=SVehicleWheel'LFWheel'
}

The Mesh=SkeletalMesh'CloneBanditsVehicles_K.HotRod' line sets the mesh of the vehicle to that of your ‘Cuda model instead of the Scorpion model. Given that you’ve changed models, you need to change a few other things, too. First off, you need to prevent the red and blue team skins from applying to this model, because those textures are entirely different. Do this by setting the RedSkin and BlueSkin to NONE. Next, given that all the bone names are different, you need to reassign things to use valid bone names. The gun, for example, attaches to the bone named gunRTmount. The same reassignment goes for the wheels, done with the Wheels array at the bottom of defaultproperties.

Tip

Due to the way UnrealScript handles subobjects in defaultproperties, you have to assign all the relevant wheel properties, even if they didn’t change from the parent object.

It is helpful to change several other properties such as the name of the vehicle (VehicleNameString and VehiclePositionString) and where the driver sits (DrivePos). Consider also adjusting the position of the headlights, taillights, and headlight projector in the Lights block in defaultproperties. The CudaCar will still work without these changes, but these adjustments are more aesthetically pleasing. Finally, the Scorpion blades will not exist on the CudaCar, because there are no blades on the ‘Cuda model. However, the blades will still make noise.

Placing Your Car in a Map to Test

Now that you’ve created your own class and set it to use the new model, use UnrealEd to place the car in a map. Run UnrealEd by typing UnrealEd at a command prompt in the System directory, double-clicking on the UnrealEd icon, or selecting UnrealEd from the start menu. Once in UnrealEd, open up any Onslaught map. (These maps all start with ONS- and work with the vehicle-focused Onslaught game in Unreal Tournament 2004.) Open the Actor Classes browser, and select CudaCarFactory, as shown in Figure 7-10.

Selecting the factory to place

Figure 7-10. Selecting the factory to place

Right-click somewhere on the terrain in the map, and select Add CudaCarFactory Here, as seen in Figure 7-11.

Placing the car factory on a map

Figure 7-11. Placing the car factory on a map

This action places a factory for your new car class in the map. At this point, save your map. Go to the file menu and select Save As.... Now, enter your map name, making sure to start it with the prefix ONS- (for example, ONS-CudaExample), and click Save.

Now your map will appear in the map list in Unreal Tournament 2004 when you select the Onslaught game type from either the Host Game or Instant Action main menu options. You can also test your map by clicking the Play Map! button in UnrealEd to launch the map. Once in the map, make your way to where you placed the car, get in, and drive! You should look as cool as Figure 7-12.

Driving away in the ‘Cuda model

Figure 7-12. Driving away in the ‘Cuda model