Xeger02: Grappling hooks (ver 1.5)
by Anthony Spataro <anthony@spataro.com>
(alternate e-mail: ads@netcom.com)

Short description:
  A QuakeC mod to add grappling hooks that use REAL PHYSICS.  Also:
  the ability to push people, super-high frog leaps that cost ammo, and
  a kamikaze feature for those times when you're surrounded by enemies.
  Includes (optionally) a new sound and a new .MDL for the hook.  Works for
  any OS, in multiplayer or single player.  This is release version 1.5 of
  the mod.  This mod only needs to be installed on the server.

Instructions

  For those of you who have never installed and run a QuakeC mod, here's
  how to do it...

First, make a subdirectory of your Quake directory called, for example,
GRAPPLE.
    C:\QUAKE>md grapple
Then, unzip the Grappling Hook .ZIP file into that directory
    C:\QUAKE>pkunzip c:\files\grappl12.zip grapple
Finally, run Quake with a command-line parameter of "-game <dir>" where dir
is the directory in which you put the Grappling Hook files.
    C:\QUAKE>quake -game grapple

Short revision history

v1.5 (28.01.97): Two releases on the 28th of the month--is this some kind of
  curse?!?  v1.5 is a major overhaul as far as the overall quality of the mod
  goes.  The behavior of the grappling hook has been changed--it now drags
  living people toward each other when one of them is hooked--and a number of
  new features have been added: conservation of momentum, frog leaps,
  kamikaze and an auto-bind command for people who don't know how to bind
  keys.  See the long description for details.  Also, see the new
  Acknowledgements section for info on contributors to the grappling hook
  idea.

v1.2 (28.12.96): Changed the physics model slightly, it's now actually a bit
  less realistic in some respects, but acts smoother and more lifelike.
  Added a five-hook limit to keep servers from freezing up.  The hook reels
  in slower now.  Changed the grappling hook model and sound to stock Quake
  resources, so only the server need have the mod installed.  The lines for
  the new resources have been commented out--I like the grappling hook model
  and sound much better, but we can't expect everybody to download and install
  the mod, can we?

v1.0 (24-12-96): Released the mod after extensive (hah!) testing.
    

Long description

    As of version 1.5, the mod incorporates features having nothing to do
with the grappling hook.  The extra features are: conservation of momentum,
frog leap, kamikaze and autobind.  Each feature has its own heading.

[Grappling hook: G / impulse 131]
    Alright, I know what you're asking: why bother to make a grappling hook
mod when there's already one available?  The answer, of course, is that I had
too much spare time on my hands.  No!  Wait!  That's not the right answer!
The answer is that the Morningstar grappling hook looks funny, and it doesn't
act like a real grappling hook.  The morningstar pulls you straight toward
itself, which anybody who's been through high school physics can tell you is
unrealistic.  To the physicist, a Quake player swinging from a grappling hook
is a case of simple harmonic motion--in particular, pendulum motion.  With
this model in mind I set out to make the world's most realistic grappling
hook--until I discovered that Quake has no trig functions.  And the physics
code isn't accessible from Quake C.  And the physics model isn't realistic,
anyway.  So I scrapped the original project, and set out to make a grappling
hook that was fun to play with.  The first version was very simple, but had
some pretty silly problems.  Over the next week I refined the model the hook
uses to simulate SHM, taking frequent breaks to lug my computer over to my
friend's house for playtesting, until I had something I thought was worthy of
release.  This is what you get.

    Using the grappling hook in gameplay is pretty easy.  Bind impulse 131
to some key (I suggest 'g') and use it to fire a grappling hook.  The hook
will open and embed itself in the first surface it hits.

    If the hook deploys into a wall or other stationary object, it will start
to reel in the length of ultra-thin monomolecular line that attaches you to
the grappling hook.  (The line is so thin, it's transparent.  That's why you
can't see it!)  When the hook has reeled in enough line it stops, leaving
you dangling from the remaining line.  You have some freedom of movement, but
not much.  If you're swinging too wildly, you can dampen the motion somewhat
by pressing movement keys in the opposite direction of your travel.

    If the hook deploys into a *person*, well, it's an entirely different
matter.  They get hit for some small, insignificant amount of damage.  Then
the real fun starts.  The two of you are dragged toward each other, but the
poor hooked person gets dragged much harder.  Once you've hooked somebody
you can drag him around like a dog on a leash--just don't let him get too
close, 'cause he's bound to be mad!

    You aren't limited to one grappling hook at a time.  You can let fly with
up to five concurrently, which lets you play Tarzan and safely descend from
great heights, but doesn't let you crash the server or kill someone with
grappling hooks.

[Conservation of momentum: (no key)]
    I had a long, drawn-out physics tutorial involving Arnold Schwarzenegger
and a computer nerd that I was going to use to explain conservation of
momentum, but I decided this isn't physics class.  Suffice it to say that
conservation of momentum is a physicist's way of saying "when you push
something, it moves."  So you can now slowly push people in Quake by nuzzling
up against them.  The faster you are moving, the harder you push them.  So if
you hit them while swinging from a grappling hook, you can knock 'em pretty
hard!

[Frog leap: F / impulse 132]
    The frog leap key lets you jump really high, but you lose some ammo every
time you use it.  It's very helpful if you're stuck somewhere you don't want
to be, but use it with caution!  Since you can't really move while you are
soaring through the air, you're a sitting duck for several seconds.  And if
you're not careful, you'll burn all your ammo and end up leaping through the
air like the majestic gazelle, hacking and slashing with your axe.  The
amount of ammo you lose depends on what weapon you are using (rockets are
heavier than shells, for example, so you lose less rockets than shells.)

[Kamikaze: K / impulse 133]
    Have you ever been in a room with 12 other people, each one armed with
a rocket launcher and shooting at someone else, and known you were about to
die?  Well, thanks to the kamikaze key, you can go out with a bang!  Each
Quake player now comes with several kilograms of plastic explosive taped to
his torso.  When you kamikaze, you do a massive amount of damage to those
around you, but (and this is a big "but") you also get -5 frags! I don't
intend for kamikaze to be used just to spite people or deprive them of kills.
Rather, I think of it as a tool to let you take advantage of those situations
where the firefight is so intense and in such close quarters that everybody
is going to die anyway.  Whenever you use it, you need to make sure that you
are going to kill at least 6 people, or it just isn't worth it!  To keep
people from going hog-wild, you need to have positive frags to use kamikaze.

[Autobind: H / impulse 160]
    This is a new feature I hope to include with every one of my mods from
now on.  The question I'm asked most while running a listen server is "how
do I shoot grappling hooks?" (or, more often, "how do I fly?" because all
those people swooping through the air sure do look like they're flying.)
Every time someone asks this, I need to lead them through the process of
binding a key, and many of them don't even know how to get to the console.
So rather than repeat those instructions over and over again, I added an
impulse command that binds all of the special features *and* gives help
showing which keys do what.  Whenever someone enters the server, the
autobind impulse is automatically bound to the H key.  That way, when
somebody asks me how to shoot grappling hooks, I just tell them to press
H!


Acknowledgements

Thanks go out to Evan Carter for persuading me to release this mod to the
public in the first place, and for forcing me through the more unpleasant
aspects of the release (such as writing documentation and uploading the
file!)  And for moral support. ;)

A big thanks to Eric Wescott for suggesting conservation of momentum as well
as unknowingly providing me with the idea for the push-me-pull-you behavior
exhibited when grappling other players.

Thanks also to "Mike," the enigmatically named author of the Morningstar mod.
This grappling hook is obviously not a copy of the morningstar, and it's
diverged so far from its original form so as to be a completely new device,
but without a look at his code I never would have fixed a bug with hook
positioning.


Niggly Technical Information

    The source is included so you can change things to suit your preferences.
You might want to make the line reel in slower, or change the maximum amount
of grappling hooks to one.

    I'd appreciate any feedback.  How do you like the mod?  What would you
like to see changed?  If you think you've got a better model for the
grappling hook or some sounds to contribute, that's great too.  And if you've
got a nice addition to the mod, by all means tell me about it so I can add
it!  See the beginning of the file for information on contacting me.

DISCLAIMER:
    In the fantastically unlikely event that this code makes your computer
explode, kills your pets or causes your girlfriend to leave you, you're out
of luck.  I hereby disclaim myself of any damages incurred from the use of
this product, from the files in this product, or from the archive in which
this product is packaged.  By using this product, you acknowledge that you
will not hold me liable for any such damages.  If you do not agree to these
terms, delete the product from your hard drive.
