Code

Summary

Anyone who has performed a technical analysis of Yandere Simulator's current code has wasted their time.

The current code was never intended to be in the final retail version of the game.

The current code is temporary placeholder code that was written purely to provide a playable demo that lets people get an idea of what the final game is supposed to be like. The code was written very quickly so that I could upload videos to YouTube on a regular basis.

I explained all of this thoroughly in a video from 2018, and everyone seems to have forgotten about it: https://www.youtube.com/watch?v=8vT-97qiaNQ

My goal, since the beginning, has always been to hold a crowdfunding campaign and hire a programmer to replace me. I've been saying this for years.

(In the event that Yandere Simulator's current code is used as a base for the final game, all of the current code would, obviously, be refactored and optimized first.)

Details

Around 2015, when Yandere Simulator got popular on YouTube, I felt a lot of pressure to upload content as frequently as possible. I committed to a "new video every 2 weeks" upload schedule, which required me to hastily slap features into the game without regards for optimization or long-term maintainability. In order to maintain a steady upload schedule, Yandere Sim was developed almost exclusively in "crunch time" from 2015 to 2017. During this phase of the game's development, I wasn't trying to write clean or efficient code; I was prioritizing the act of putting cool new features into the game as quickly as possible, so that I could make frequent uploads to YouTube.

My plan, which has remained unchanged since the beginning of the game's development, was to produce a cool demo, hold a crowdfunding campaign, and use the money to hire a professional software engineer to completely replace me as Yandere Sim's lead programmer. I never intended for my code to be the game's final code; just the placeholder code that would be good enough to produce a playable demo that shows off most of the game's intended functionality. I explained this thoroughly in a November 2018 video titled What's Going On With Yandere Simulator's Development? (However, it seems that most people have forgotten or disregarded this video.)

To be honest, there is no point in analyzing code that was written under the circumstances described above. The game's current code was never meant to be final, just functional. It only needed to serve one simple purpose; allowing people to experience a playable demo so that they could make an informed decision about whether or not they'd like to support the crowdfunding campaign. Reviewing the code in its current state is about as meaningful as reviewing the earliest rough draft of a novel, instead of reviewing the final published work.

I'm fully aware of which scripts are sub-optimal, and I know exactly what would need to be done in order to improve them. However, I intend to stick with the original plan: hold a crowdfunding campaign, hire a programmer to replace me, and then go through a refactoring phase.

There are a lot of myths about Yandere Simulator's code. For example, a long chain of if-else statements can't possibly harm a game's framerate if it's in a function which only runs for one frame and never runs again. The majority of statements that people make about Yandere Simulator's code aren't actually valid or accurate in the first place. These inaccurate statements are allowed to run wild because most people don't know enough about computer code to realize that they aren't hearing true or valid statements.

The Unity profiler tells me that the CPU is spending an exceptionally long time on rendering, physics, pathfinding, and updating the UI. Even the game's most inefficient, sub-optimal scripts are barely putting a dent in the FPS; the other factors are far more important. In January, my average framerate was 30 FPS, but in May, my average framerate jumped up to 55 FPS. This was not achieved by converting if-else statements to switch statements, but by optimizing occlusion culling and removing unnecessary physics operations.

In the end, I severely regret my decision to commit to a "new video every 2 weeks" update schedule. In order to implement major features back-to-back on a tight deadline for multiple years, I had to make numerous sacrifices to the codebase's maintainability, and also in my personal life. Remaining in constant crunch time for a period of two years put me into a state of severe burnout, and had a tremendous impact on my physical and mental health. Because I have remained fully committed to Yandere Simulator since 2014, I have never truly had an opportunity to recover from that burnout, and remain in that state to this day.