Friday, June 22, 2007

HOWTO: Speed Hacking

Brought to you by Felipe :)

Here are some tips that will allow you to get the most of your tank's speed without having to depend on the high speed flag. You can optionally add quick turn to your tank, as well. Even without extreme speed, and handful of servers may kick you. Most won't at the time of this post. A few more servers may kick you for extreme speed. Nevertheless, you will enjoy always being able to chase down other tanks...

Open LocalPlayer.cxx in /src/bzflag/ of the extracted source. With your favorite text editor, find the following lines:

if (flag == Flags::Velocity) {
fracOfMaxSpeed *= BZDB.eval(StateDatabase::BZDB_VELOCITYAD);

Look at the first line. Remove the "== Flags::Velocity" so that this section reads like this:

if (flag) {
fracOfMaxSpeed *= BZDB.eval(StateDatabase::BZDB_VELOCITYAD);

This will give you high speed regardless of flag save Thief and Burrow. Additionally, you will see further down these lines:

} else if ((flag == Flags::Burrow) && (getPosition()[2] <>
fracOfMaxSpeed *= BZDB.eval(StateDatabase::BZDB_BURROWSPEEDAD);

You can change "BZDB_BURROWSPEEDAD" to BZDB_VELOCITYAD" so that the lines read like this:

} else if ((flag == Flags::Burrow) && (getPosition()[2] <>
fracOfMaxSpeed *= BZDB.eval(StateDatabase::BZDB_VELOCITYAD);

This will give you high speed with Burrow. You can also play around some of these variables. For example, I substituted "BZDB_BURROWSPEEDAD" and "BZDB_VELOCITYAD" with "BZDB_THIEFVELAD" so that I could drive at the speed of Thief on my own server. Some servers will undoubtedly kick you for driving too fast when you drive at Thief speed without Thief... but then, some won't :)

For EXTREME speed, find the following lines:

// can't go faster forward than at top speed, and backward at half speed if (fracOfMaxSpeed > 1.0f) fracOfMaxSpeed = 1.0f;
else if (fracOfMaxSpeed < -0.5f) fracOfMaxSpeed = -0.5f;

Change the numbers so that the lines read like this:

// can't go faster forward than at top speed, and backward at half speed if (fracOfMaxSpeed > 0.0f) fracOfMaxSpeed = 9.0f;
else if (fracOfMaxSpeed < fracofmaxspeed =" -9.0f;">

Again, play around with the numbers to find a speed that you like. Naturally, you will stick out like a sore thumb when you drive so unbelievably faster than everyone else. Hehehe...

For the original instructions, see Felipe's comments to Flying Without Wings & Extended Jumping. When you're finished, save the file, compile your new client, and ...

Have fun!

Related Post:
HOWTO: Quick Turn Always

1 Comments:

Blogger ThomasP said...

Very nice work.

9/16/2010 2:55 PM  

Post a Comment

<< Home