White Whale Harpooned

Hey. I finally fixed that bug. The “Final Boss of All Bugs” bug. The bug I called my “White Whale.”

The “Become unable to interact with objects or characters” bug.

Want to hear what was causing the problem? Click “Continue Reading.”

Very patient bug-testers discovered that the bug could occur by standing perfectly still at the start of the day and letting 6 hours and 42 minutes pass. The bug would always occur at exactly 1:42 PM.

You didn’t have to use any specific weapon. You didn’t have to kill any specific student. You didn’t have to accelerate time with the Pass Time feature or a photo of Senpai. In fact, you didn’t have to do anything. You just had to let 402 in-game minutes pass.

Armed with that knowledge, I started performing experiments.

  • Disable all students. Accelerate time by 25x. Wait until 1:42 PM.

Bug still happens. Alright, it has nothing to do with students.

  • Disable Yandere-chan’s script. Accelerate time by 25x. Wait until 1:42 PM.

Bug still happens. Alright, it has nothing to do with Yandere-chan.

  • Disable all “manager” objects. Accelerate time by 25x. Wait until 1:42 PM.

…oh? The bug didn’t happen that time.

Curious.

That means one of the managers is causing the bug.

There are around 25 “managers.” Each of them is responsible for managing a specific aspect of the game, such as students, weapons, schemes, etc. Disabling them 1-by-1 and waiting for the bug to happen would take forever. So instead, I disabled 5 at a time.

  • Disable StudentManager, WeaponManager, SchemeManager, CleaningManager, and PopulationManager. Accelerate time by 25x. Wait until 1:42 PM.

…oh? The bug didn’t happen that time.

That means one of those five manages is the culprit.

I had a theory. I presumed it was WeaponManager.

  • Disable the WeaponManager GameObject. Accelerate time by 25x. Wait until 1:42 PM.

Ohoho! The bug didn’t happen.

This means that WeaponManager is the culprit.

But, why? What is the script doing that is causing the bug?

…wait. IS it the script? Or is it the object itself?

  • Disable WeaponManagerScript. Accelerate time by 25x. Wait until 1:42 PM.

Huh. The bug still happened.

So, the bug is not happening due to anything that is occurring within the WeaponManager script. But, disabling the WeaponManager GameObject prevents the bug from happening.

What does this mean? Well…

All of the weapons at school are the “children” of WeaponManager.

WeaponManager is like a container that is holding all of the weapons in the school environment.

Disabling the WeaponManager GameObject disables all of the weapons at school.

So if WeaponManager itself isn’t the culprit…

…the true culprit is one of the weapons contained within WeaponManager.

But, how could one of the game’s weapon have the unique property of breaking all raycasts? And which one is it? Well, time to find out.

I started disabling weapons in groups of 5.

After I disabled a particular group of weapons, the bug instantly went away.

So, I knew that the true culprit was one of those weapons. I started disabling them one-by-one.

MagicalGirlWand? Nope, disabling it didn’t stop the bug.

FantasySword? Nope, disabling it didn’t stop the bug.

FragileKnife? Nope, disabling it didn’t stop the bug.

Dumbbell? Nope, disabling it didn’t stop the bug.

But…that means…by process of elimination…it’s the last weapon in this set…

It’s…

…the Baton that the Martial Arts Club uses when training with you?

Huh?

Well, this weapon does operate differently from all the others. Unlike the other weapons, this one cannot be picked up by the player, and exists as a non-interactive prop that is only meant to spawn in a character’s hand during the Martial Arts Club training minigame.

But…why does it break the game? What is it doing that would cause Unity to lose the ability to use raycasts?

Well, let’s just take a closer look at the object, and…

Oh.

Ohhhhh.

Ohhhhhhhhhh.

If you’ve ever messed around with a calculator out of curiosity, you might have tried typing in 9,999,999 x 9,999,999 just to see what the calculator would do if it was commanded to display a number larger than could fit on its display. And, if you did, you’d probably see some weird number appear like this: 9.999998e+13

“What the heck? There’s a letter in this number?” Yes, there is. On a calculator display, “e” stands for “exponent of 10”, and the number that comes afterward is the value of the exponent. For example, if a calculator was asked to display “25 trillion,” it would display “2.5e13” meaning “25 followed by thirteen zeroes.”

So, if a number within Unity is being displayed with an “e”…

…that means it’s larger than 9,999,999. Over 10 million.

As you can see in the screenshot above, the Baton’s “y” – its vertical position in space – is less than negative 2,147,483,648. That number exceeds the maximum integer that a 32-bit operating system is capable of performing calculations with.

No wonder the game couldn’t fire a raycast at the Baton. The Baton had reached a vertical position of more than 2,147,483,648 meters from the floor of the school.

Do you have any idea how much distance that is? That’s over 2,000,000 kilometers.

Jupiter has a diameter of 139,820 kilometers.

The Baton was more than 14 Jupiters away from Akademi.

But, how did it possibly get all the way out there? Wouldn’t it have to be traveling insanely fast to get that far away from the school?

Well, as a matter of fact…

If I reset the Baton’s position to 0, and then I advanced one frame, I observed that the Baton had already fallen 1,578.852 meters.

One frame is a 60th of a second. The Baton traveled 1.5km within a 60th of a second.

That’s 94,731,000 meters per second.

Light travels at about 300,000,000 meters per second.

The Baton was falling at almost a third of the speed of light.

It takes sunlight 8 minutes to travel from the sun to Earth.

It would take the Baton only 24 minutes to make the same trip.

So, why was it traveling that fast? It had no collider stopping it from colliding with the ground, so it actually fell through the floor at the beginning of the game, kept falling, and kept building up speed until it reached the maximum speed supported by the physics engine. At that speed, it took 402 in-game minutes to reach a vertical position so large that no 32-bit computer could possibly calculate it, causing Unity to fail whenever attempting to fire a raycast at it, resulting in a situation where Unity’s raycasting system completely broke and stopped reporting whether or not any raycast was hitting any non-static collider.

In summary?

You lost the ability to pick up objects because a baton fell through the floor, reached 1/3rd the speed of light, and traveled 14 Jupiters away from a high school.

Don’t worry, though, I fixed it. I told the Baton to not fall through the floor at the beginning of the day. So now everything is groovy.

I presume that this bug didn’t exist before the Baton was added to the game. If you find the build that was released before the Baton was added, you could probably pass 402 in-game minutes without seeing the “can’t pick up objects” bug occur. I wonder if anyone will care enough to test this hypothesis…

(Theoretically, you could re-create this bug by opening a fresh Unity project and letting a physics object fall for several hours until it reached such a ludicrous speed/distance that Unity’s ability to perform raycast calculations completely failed…)

The bug fix will be available in the next build. It will either be released today or tomorrow.

Thank you for following the harpooning of this white whale!

49 thoughts on “White Whale Harpooned

  1. I’m wondering :
    Is the Alphabetic Killing Challenge available in 1980’s Mode? Or is it only possible to do in YanChan’s Mode?

    • Yeah, you can play the ABC challenge in 1980s
      but the targets are not following the first letter of their names
      They’re followed by the student ids in 202X mode
      My English really sucks, hope you can understand what I mean

  2. that’s great that you were able to fix it! hopefully people who play the abc killer challenge and the genocide ending won’t run into this bug anymore

  3. Hahaha Dev!! You are the greatest Moby Dick to exist!. Your intelligence is over 9000 and I enjoyed reading how you discovered the issue and explained in great detail about your solution and the following conclusion. Congratulations!

  4. Hey yandere dev something is wrong with the find locker feature when I open it up it won’t let me go to the person I want can you take at look at it when you have time thanks.

  5. Here’s another error, discovered by a YouTuber. So, one of the updates is that the Yakuza will disappear and never be seen again once his brother is killed, right? Well, when the YouTuber tested it out, the Yakuza is still there, despite that his brother had died, you just can’t talk to him and doesn’t even speak anymore. I’m sure this isn’t supposed to happen. Could you fix this?

  6. You did so much work and put in so much time and effort to find out what the problem was, and I thank you for that. That was probably quite tedious for you, at least that would’ve been for me.

  7. Hi – I’m Alex.#4530 on Discord. I think I was unfairly banned today for a comment about this blog post along the lines of “Oh you just wanna be right, I thought what YanDev said was funny”, which I didn’t mean to cause any offence with; Is there a place where I can talk about this with somebody?

  8. that last part it made me laugh a bit lol especially “you lost the ability to pick up objects because a baton fell through the floor, reached 1 / 3rd the speed of light, and traveled 14 jupiters away from a high school.” and the baton image with the speed of light behind it and also the “i told the baton to stop falling through the floor sentence 😂😂😂

  9. This was beautiful. A hero’s journey. A saga. A tale to be told for centuries to come. I’m so glad I don’t have to worry about this bug anymore lol. Can’t believed it was fixed so quickly.

  10. Interesting. This is the kind of thing that should be made into an easter egg for the game because the story behind it is just too unique and interesting.

    Maybe make a second Baton as a normal weapon for the game and give it the title “1/3 light speed Baton” then maybe add a readable note or something (I forget if items in the game have descriptions built into them) as to describe the weapon. Something like “This is a legendary Baton that is said to have somehow caused reality itself to collapse due to it’s immense speed” or something along those lines.

    Of course make sure this one doesn’t actually fall through the world. But I’m not kidding. It’s these kinds on in jokes by developers that help give games a unique feel. Because they aren’t born simply from ideas but by coincidences that no one can plan for.

  11. Congrats on your haul! Also, this is up there on my favorite blog posts.

    Has anyone determined the build in which the baton was added? I have some old versions and would like to help test, since I didn’t have time to help until now.

  12. would you like to use my sound effect for poisoning someones bento
    if you don’t want to its fine
    if you want to listen to it here is the link!

  13. i know the final boss thing was a joke but why do i genuinely feel like something good is gonna happen to dev now that he’s defeated this bug

    • Several people have reported that bug, but I have never experienced it. There must be a very specific set of steps that results in the bug happening. If you can’t tell me those specific steps, I can’t investigate or fix the bug.

      • I’m assuming you’re absolutely sure that’s the ONLY cause of the bug? No other Objects from Managers taking a trip to Jupiter?

      • 2nd question,
        Was it falling visually? Or could we still see it but the game was processing it as falling?🤔🤔🤔🤔🤔

  14. I’m relieved to hear this was fixed and so quickly, which surprised me. Here I was thinking it’d take months if anyone even bothered to test things out, yet alone find out what was happening, but boy oh boy did it get squished quick. Now I can go back to playing and killing the whole school just for the heck of it.

    However, I really hope this story becomes something some day. I laughed quite a few times when reading what was going on and seeing the numbers, and a part of me hopes maybe an Easter egg or some sort of reference to it can be made one day for the players who ether heard of it, or experienced it. Perhaps like the Yandere-Punch Easter egg, but instead you smack people with the baton, and it sends students flying at 1/3rd the speed of light. (Or whatever high speed is manageable without breaking the game.)

    Ether way, for a “boss battle” of a bug that lasted in the game for years, it sure went down hard. I guess the bigger they are, the harder they fall, and I don’t think we’ll be forgetting this legendary battle anytime soon. Once again, thank you so much for taking this annoying obstacle down. ❤

  15. That was a real rollercoaster!

    I remember years ago hearing some game testers telling me a story about testing a game called Shadow Man. They managed to find a way out of the level, so that the character was falling perpetually through space. They left the game on overnight, just to see what would happen. They came back the next morning and the character had *stopped* falling…with debug information showing their position.

    “What’s this?”
    “It’s the coordinates of HELL!”

  16. I didn’t expect the updates to be so soon. I thought you went on vacation for at least 2 weeks. I’m glad that you found your Moby Dick (and also glad that I didn’t have to run the game again and wait for several hours without doing anything :)).

  17. It’s so ironic how a weapon that noone ever use could cause such a game-breaking bug. I’m glad that you fixed it

    • Well, it’s only used by the Martial Arts Club members for the mini game they offer, which is a practice of the fighting the delinquent mini game that usually displays when they pick a fight at you.

  18. Fun fact i did grab it one time i forgot how but its might after i did practice and then i picked and find out i could kill anyone so you can lol

  19. It’s time to refactor the code probably, since you “finished” the game once, and all systems are defined by now, you wouldn’t have to toss everything completely, just copy paste the behavior tree branch into sub script neatly wrapped to generalize them, they are the bulk of the code, which mean everything else should be gucci to re architecture. There is probably a volunteer happy to do it. Also do you have erased all my mention of that school game action button’s Tim Roger made a 7h hours long love letter to? I mean I would understand not spilling the bean right now (the tree trope is from there right).

    • It would be a bit more tricky than that. I’ll give an example.

      StudentScript contains 25,113 lines of code. It should be divided into multiple subscripts.

      However, there are many, many scripts that interact with StudentScript. If StudentScript is changed, all of the other scripts will refuse to compile, because they won’t be able to find the variables/functions they expect to see in StudentScript.

      This means that in order to refactor StudentScript, I would have to change several dozen other scripts as well. This would be almost guaranteed to result in numerous new bugs. It would probably require several weeks – or potentially months – to refactor a script such as StudentScript.

      There are only 3 scripts in the game that desperately need to be refactored (YandereScript, StudentScript, and StudentManagerScript) but the amount of time required to do so would not yield any meaningful improvements to the game.

      What kind of improvement do you expect out of refactoring a script? Better framerate, right? Well, one factor that has the biggest impact on the game’s framerate is rendering. My time would be better spent making rendering optimizations rather than code optimizations, since code optimization would make 1% difference but rendering optimizations would make 10% difference.

      To answer your other question: In the near future, I plan to make a lot of videos that I have been putting off for a long time.

      I was born stupid. However, I will not die hungry. Video games forever.

  20. I’m sure your usage of the metric system pleases many.

    Others not so much.
    I don’t care. I just don’t use it in English.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s