The double-damage glitch
Guides
/
The double-damage glitch
Updated 5 years ago by Anthonya

Q: Why this guide? ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ A: This is the first game I speedrun seriously. At least, I'll be able from now on to tell that I've done serious speedrunning at some point in my life.

Q: What's the double-damage glitch? ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ A: Double-damage is a glitch that makes the game spawn two damage tiles instead of just one. That means two hits on the boss every 3.33 seconds instead of just one. In theory, you could spawn three or more, but getting two is hard enough already.

Q: How does it work? ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ A: Well, the basic idea is to 1) let the boss toss a coin and get the damage tile to appear on that tile, and 2) collect the tile at most 5 frames (1 frame = 1/30 sec, so 5 frames = 0.166s) before the coin touches the ground. No matter if you get hit as long as these two steps are followed. Of course, step 1 is completely RNG ; there is (almost!) no way to control where the tile appears. Although 0.166s seems like a small window, it's actually not that bad, because, by the time you realize that you have a chance of getting the glitch, you've (in my experience) already left the tile, and, by the time you come back to collect the tile, you're inside the 5-frame window.

Q: How long does the glitch last? ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ A: It depends. The first three times I got the glitch, it only lasted one phase. As soon as the next phase started (i.e., as soon as the boss' health bar started decreasing), that's it. Back to glitchless, which sucks.

However, earlier today, I managed to actually get the glitch to last from one phase to the next. I unfortunately wasn't recording that one time, so I can't show how I did it, and I can't replay it to look at how to do it. If you look at the speedrun linked below and watch the part from 1:44 to 1:56, you will notice that, at the end of the phase, two tiles appeared. Because I didn't know what to do at the time, I just collected the tiles, and, on the next phase, I was back to normal --one tile. But earlier today, I did something different. I'm not sure exactly what I did, but I think it involved either getting the tile after the next phase started, or getting the tile before the phase started, but at most 3.33 seconds before it started. The 3.33 seconds are important because 3.33 seconds is the delay between when you get a tile and when the next one appears.

I'm going to have to look some more at the game's code to see how to reproduce that.

Q: Is there any way of increasing the chances to get this glitch? ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ A: Yes. Since the moment you collect a tile determines when the next one appears (with a delay of about 3.33 seconds), it would be possible to make sure that the moment you collect the tile is 3.33 seconds away from a possibility of getting the glitch. But even there, there are 8*5=40 tiles to stand in. So, in your best attempt, you still have a 2.5% chance of getting the glitch to work each time you attempt it. So, if you attempt the glitch, say, 6 times in a run, you have a 14.1% chance (about once every 7 runs) of getting it at least once during the run. That is, with perfect reflexes and perfect execution (and I'm not there yet at all!). Besides, because of what we explained in the last question, the sooner you get the glitch, the better.

There might even be another way to increase that to 2.6% (well, 2.5625% actually) or even 2.625% per attempt depending on some timing, but I don't think anybody should even care about that. That would make a good difference too though.

Q: What causes this glitch? ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ A: Kindly enough, Bridgs, the developer of Just One Boss, made the game's code available on GitHub (click here). I've looked through it for a couple of hours to understand the code's structure (which, in my opinion, has both technically amazing design and terrible structure quality, lol), and here's why this glitch happens.

Lines 631 to 637 represent the code that is executed for the damage ("magic") tile every frame. Essentially, the code means this:

Every frame:

  • if the tile is occupied by a coin, then: -- remove the tile, and -- request another tile in 10 frames

Now, the code that starts at line 639 ("on_hurt") is executed when the tile gets touched by the player. If you look at line 641, you will notice that "frames_to_death" (which represents the number of frames before the tile gets removed) is set to 6. And at line 756, we also request another tile in 100 frames (3.33s), to simplify. To sum up:

When the tile is touched by player:

  • remove the tile in 6 frames, and
  • if the boss is not dead, then: -- request another tile in 100 frames

So then, the question is, what happens if you get the tile 5 frames or less before the coin begins occupying the spot the tile is on? Since you touched the tile, the game will request another tile that will appear in 3.33 seconds. But, when the coin lands on the ground, since the 6 frames haven't elapsed yet, the tile hasn't been removed, so the game will also think that a coin occupies the spot the tile is on, so it will also request another tile in 10 frames (0.33s). That's where the glitch comes from.

Is this explanation true? Consider this speedrun : If you look at 1:31 (YouTube video time, not in-game time), you will see that I get the tile exactly one frame before the coin lands on the ground, which is the last possible frame to do the glitch. As expected, the grey box (which starts appearing 10 frames before the tile actually appears) appears immediately. And, at the beginning of second 1:35 (indeed about 3.3 seconds later), a second tile appears.