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

Make Your IF NPCs Move

Add the gifts of motion and conversation to your characters.

Adding NPCs to your Inform adventures ( [Hack #88] ) can make your game come alive. Of course, the more vivacious your characters, the better the illusion of reality. What’s missing is movement and speech.

Designing a Mobile Character

Let’s add another nonplayer character with a bit more zip than our sedentary access controller; how about a fearsome security daemon to smack our little spy around? Since you’ve already cast a shrieking beast as the access controller, let’s go another direction with the security daemon:

Object pixie "security daemon"
  with name 'security' 'daemon' 'pixie' 'melodious' 'chimes' 'gossamer'
            'wings',
    describe
        "^A security daemon is here, buzzing angrily around you.",
    description
        "The tiny security daemon darts around on gossamer wings,
        leaving a trail of melodious chimes in her wake.",
    before [;
        Listen: "She makes a lovely little racket as she swoops about.";
    ],
  has animate female;

Note that the player can refer to the chimes and the wings; it’s bad form to mention something and then have the game spit out a message saying You can't see any such thing. when the player tries to interact with it. On the other hand, the chimes and wings aren’t separate objects here because this encourages players to interact with them more extensively than needed. Plus, now both listen to chimes and listen to daemon produce the same message without any extra code.

You’ve probably also noticed the describe line. This line prints if the player issues a look command while the daemon is in the room. Without it, the program prints a dull default such as You can also see a security daemon here..

Right now the security daemon doesn’t live anywhere in the game world; we’ll write some code to make her show up when we need her. You handle this in several ways. The crude method is to copy and paste pixie code to place pixie1, pixie2, pixie3, and so on in all the locations in which she’ll appear, perhaps using each_turn routines in each room to make her appear and disappear as needed. This is perhaps the least elegant way possible to move NPCs around; it’s also the method I usually employ. Let’s try something more elegant.

Moving the Daemon Around

Use a daemon block to move pixie around. (Did you wonder why we didn’t just call her daemon? Here’s your answer.) Add the following code to the pixie object:

number 0,
daemon [;
    if (player notin Quarantine) {
        self.number++;
        switch (self.number) {
            3: move self to location;
               print "^The security daemon zips in! If you can't
                   think of something fast you'll be ";
               if (Quarantine has visited) print "back ";
               "in quarantine before you can turn around.";
            4: "^With a sprightly jingling sound, the security daemon
               zaps you with paralyzing bolts!";
            5: self.number = 0; remove self;
               print "^With a mighty zap, the security daemon
               banishes you to...^";
               PlayerTo(Quarantine); rtrue;
        }
    }
],

The daemon block checks to see if the player character is in the Quarantine room (which we’ll implement in a moment). If not, it increments pixie’s number property. When that value reaches 3—giving the player a couple of turns to poke around without interference—the security daemon shows up. (A quickie if statement allows for a different message if you’ve been in quarantine before.) The player has a couple of turns to try to interact with the security daemon before she moves him to the quarantine area.

Let’s create that area now with a few exits:

Object Quarantine "Quarantine"
  has light,
  with
    description
        "You are inside a spherical prison of glowing mesh. It seems
        to have been designed with giant worms and other such monstrosities
        in mind, though, because the spaces in the mesh are more than
        large enough for you to pass through. Interesting-looking exits
        lead north, west, and up.",
    n_to Memory,
    w_to CD_Burner,
    u_to Graphics_Card,
    cant_go "There doesn't seem to be anything interesting in that
        direction.";

Object Memory "Memory Chip DIMM-2"
  has light,
  with
    description
        "(fill this in, reader!) Exits lead southwest and south.",
    sw_to CD_Burner,
    s_to Quarantine;

Object CD_Burner "CD Burner CDR-6"
  has light,
  with
    description
        "(fill this in, reader!) Exits lead northeast and east.",
    ne_to Memory,
    e_to Quarantine;

Object Graphics_Card "Graphics Card NV-144"
  has light,
  with
    description
        "(fill this in, reader!) An exit leads down.",
    d_to Quarantine,
    out_to Quarantine;

The player character now has some room to wander around. You still need to activate the daemon’s daemon for the chase to be on. Attempts to leave the wireless connection trigger the pursuit code. See the cant_go line in the Quarantine object? A cant_go routine runs whenever the player attempts to go in a direction the room doesn’t support. Usually, people use it for customized error messages, but you can run code there as well. Put this in the Wireless object:

cant_go [;
    StartDaemon(pixie);
    print "Before you can make a move, you hear a cascade of chimes
        and a tiny security daemon blasts you to bits! When you
        collect yourself, you find yourself in...^";
    PlayerTo(Quarantine); rtrue;
],

Perfect! Well, almost. The player character can still saunter out of the room, away from the daemon, and her messages will continue to print as if she were there. This can actually be desirable behavior because daemon code (and timers) can be attached to things that aren’t in the room: distant church clocks can chime, thieves can ransack the player character’s hotel room while he is out exploring the city, and so forth. Here you want the security daemon to follow the player character around instead, so insert this code before the switch statement in the daemon block:

if (self notin location && self.number > 3) {
    move self to location;
    print "^You hear a riot of tiny bells as the security
        daemon swoops in after you.^";
}

Let’s make sure this actually does the right thing. Here’s an excerpt from a sample transcript:

> z
Time passes.

The security daemon zips in! If you can't think of something fast you'll be
back in quarantine before you can turn around.

> sw

CD Burner CDR-6
(fill this in, reader!) Exits lead northeast and east.

You hear a riot of tiny bells as the security daemon swoops in after you.

With a sprightly jingling sound, the security daemon zaps you with
paralyzing bolts!

>

Obviously, there’s a puzzle to solve to convince the pixie to stop quarantining the player. If only you could reason with the pixie ... but that’s the stuff of [Hack #90] .