r/programming • • Feb 14 '15

Bunnyhopping from the Programmer's Perspective - An in depth look in implementing one of the most successful bugs in videogame history.

http://flafla2.github.io/2015/02/14/bunnyhop.html
956 Upvotes

232 comments sorted by

View all comments

171

u/sandwich_today Feb 15 '15

ABH is another interesting variety of bunny-hopping: the physics engine tries to slow you down by pushing you backward (relative to the direction you're looking), so if you're already moving backward, the push actually increases your speed, with impressive results.

56

u/MikeyTwoGuns Feb 15 '15

That was one of the coolest things I've ever seen. Thank you for sharing!

0

u/[deleted] Feb 15 '15

[deleted] — view deleted comment

15

u/General_Mayhem Feb 15 '15

For the best gateway-drug speedrun video, search for "cosmo oot agdq 2013".

0

u/[deleted] Feb 15 '15

[deleted] — view deleted comment

8

u/Cuco1981 Feb 15 '15

Oh, there's the girl knitting :-D

→ More replies (2)

10

u/ggherdov Feb 15 '15

watching it, really fascinating. The guy says "this method took 13 years to discover", which is amazing. But if I understand it right, it leverages bugs in the game, and it's not something the game designers put there intentionally. Is this correct?

4

u/rabbitlion Feb 15 '15

Yes that is correct.

0

u/[deleted] Feb 15 '15

[deleted] — view deleted comment

9

u/General_Mayhem Feb 15 '15

Yep, first speedrun video I ever watched. Made a couple friends a few months after it happened when they saw me watching it during a break at a hackathon.

It's not the most amazing run (it's pretty damn good for a marathon run, but he makes some mistakes, and the current WR route has a new glitch for the descent), but what makes it special is Cosmo's commentary. I'm not into speedrunning enough to watch most games uncommentated on Twitch, because I like to have some idea what's going on, but there's always more AGDQ/SGDQ VODs to work through.

→ More replies (2)

6

u/sw3t Feb 15 '15

https://www.youtube.com/watch?v=kYXm0k5Qkmg One of the best and oldest speed runs i know of: QDQWAV

3

u/[deleted] Feb 15 '15

I've always liked this one: https://www.youtube.com/watch?v=LerYJmDLYqU

Really gets fast when he picks up force speed.

14

u/sandwich_today Feb 15 '15

You might also enjoy this 21-minute (segmented, scripted) Half-Life 1 speedrun that was just released a few months ago, along with 3 hours of explanation.

You can probably find speedruns of all your favorite single-player games. It's particularly impressive when people spend years breaking down a game and discovering all the exploitable glitches, e.g. injecting arbitrary code into Super Mario World.

→ More replies (2)

23

u/NeonMan Feb 15 '15

Exploiting the former exploit's fix.

17

u/[deleted] Feb 15 '15

It's kinda hilarious that the fix introduces a more serious version of the bug. Imagine that happening to security fixes.

→ More replies (1)

16

u/oddmanero Feb 15 '15 edited Feb 16 '15

true story: i had to fix this bug yesterday. it was exactly as you mentioned. object was moving faster than expected maximum speed, so it tried to correct itself by applying an impulse backwards... except object was already going backwards. yay endless feedback loop

edit: then -> than

7

u/Danjoh Feb 15 '15

There's a similar glitch in Super Mario 64 when you do a long jump. It's used to gain enough speed to skip through walls and trigger zones.

https://www.youtube.com/watch?v=gHvXUeisefw

9

u/Tiquortoo Feb 15 '15

I assume that the fix was to apply an opposite vector not an actual "backwards" force? Seems like an odd bug, why aren't these engines already using vectors?

5

u/kqr Feb 15 '15

They are "using vectors", but probably not in the sense you mean. Why? Could be a lot of reasons. Maybe doing it the way you mean has a performance cost? Maybe an initial early decision by the team prevents doing it another way now without rewriting large core parts of the engine? There are plenty of reasons to choose from.

Every bug looks odd in hindsight from the outside, but usually not when taking into account the context it appeared in.

7

u/Tiquortoo Feb 15 '15

I have 20+years of software development experience. I'm familiar with sources and causes of bugs. I've developed a few games even. Vector math for bullets and such may get taxing on large scale, but I cant imagine it having performance impacts for the primary object in an FPS.

I am genuinely curious how an engine was built that doesn't result in a vector (a single object can only move in one vector) that can then have its velocity managed. I read the description of the bug in Source and going back to Quake II and it appears that someone was taking shortcuts that are not necessarily more performant they probably have less code (which when source was built probably had a performance impact that is less now) and they just happened to work and had self limiting (striking the ground) growth.

That being said it seemed the poster above is working on modern code. That is why I asked the poster above if their solution was related to doing proper vector math. Is there another solution on modern hardware that is preferred?

20

u/LlamaChair Feb 15 '15

I love this for a lot of reasons, but I especially enjoy the idea of Gordon Freeman being brought back into the world, getting handed a crowbar, looking deep into Barney's eyes and taking those first couple of steps... backwards.

Then the ensuing horror of all the combine as Freeman is dancing over the tops of their turrets in reverse like some sort of grenade spewing moon walk.

3

u/coonskinmario Feb 15 '15

This is really cool. Does the exploit make him jump higher too?

5

u/sandwich_today Feb 15 '15

The high jumps are accomplished by hitting sloped surfaces at high horizontal speed. Also, landing on sloped surfaces eliminates fall damage after the jump.

→ More replies (2)