Yandere Simulator Complete Source Code Analysis - Code Review
Video Statistics and Information
Channel: dyc3
Views: 628,056
Rating: 4.8910766 out of 5
Keywords: Yandere Simulator, anime, game dev, game development, optimization, code, code review, C#, .NET, Unity, game engine, yandere sim, programming, indie game, software, yansim, reverse engineering, yandev, yandere dev, YandereDev, fps, framerate, performance, lovesick, drapeis, slow
Id: LleJbZ3FOPU
Channel Id: undefined
Length: 57min 2sec (3422 seconds)
Published: Thu Jul 09 2020
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
tldr; It's good to refactor your code so it scales with your project. But when is a good point to todo that.
Very educational video. For all the controversy Yandere Simulator gets, I think it’s a good case study of what happens when you commit to a game with a scope bigger than what you can handle. It’s not just the technical issues caused by inexperience, but how the developer has invested so much time into this game that he probably thinks giving up is no longer an option.
To be honest, I’m a bit concerned about the guy’s mental health because I can’t picture this game ever getting finished.
Enjoyed this analysis, I had shared it over at /r/programming. One of my main takeaways boils down to how you’ll never truly know what is causing your game (or program) to be slow unless you profile and benchmark. I liked how he examined the common assumptions on why the game was slow, debunked them, and offered feedback on how the game could be better maintained in the long run.
A while ago I saw this other "code analysis" video that was clearly made by a beginner programmer with a lot of attitude who ended up fixating on a big ugly if-else-tree and how the obvious improvement would be... a switch. And that this was basically the reason for low performance even though the profiler showed otherwise. The rest of the video was basically just playing into the drama surrounding this game.
Nice to see a proper analysis.
As someone who has spent 2 years on their game with at least 2 more to go... I don’t think there’s anything wrong with undertaking large projects as a single developer, as long as you’re prepared to refactor your code often. Some games just can’t be done quickly with a small team, and that’s fine, but you can’t pretend that the code you wrote on day one will work on day 1,000.
Also, this dude YandereDev has spent so much time creating optional features instead of actual gameplay goals for the player to achieve that I really can’t feel sorry for him. Outside looking in, I can see how some people might think that he’s extended the amount of time he needs to work on the game just to get a few more donations on Patreon.
The most glaring issue that I haven't seen anyone mention is that there are not enough optimizations. There is a big difference between performance slowdowns and optimizations (one is negative, the other positive). Notice that in the video none of the fixes make a huge impact on the performance. Even if all perf problems were fixed, almost all systems yandev uses are not optimized for his game. His game is very specific, and has conditions that most games don't have (e.g. 100s of NPCs). By using systems that are designed to be as general as possible, like A* and Unity's component/animation system, he loses out on all the optimizations and assumptions that could be made for his game (ofc assuming he was capable of doing them).
I'm putting my comment on here as well because god damn it, I put the work in and may as well farm some karma:
Slight nitpick: At 20:43 you say "One Instruction, one clock cycle". This is also a case of may be correct on old/embedded systems.
If we look at the instruction timings in this document on page 27, the SQRTSD ("Compute Square Root of Scalar Double-Precision Floating-Point Value", XMM names instruction names are a real mouthful) is 1 operation, that takes 24 cycles to complete and the result is available after 27 cycles.
So from a micro point of view, the squared magnitude is 24 cycles faster than the euclidean one. In practice, this only matters if you perform the operation millions of times, so the developers of Unity may care about it, but us mortals should rather focus on keeping it simple and understandable.
Because I enjoy doing that kind of stuff, I've gone and written out approximately how long each magnitude function takes. This calculation is of course wholly inaccurate when it comes to actual execution, it assumes that each instruction takes exactly as long as its throughput, no instructions are executed in parallel, etc, but it should be close enough.
If you actually want to base your code on this, measure if it actually matters first and don't complain if you didn't!
https://godbolt.org/z/jq74sn
As someone who actually likes the idea behind the game overall, it's a shame that it seems like it'll never be a fully realized idea. There's no way yandev will actually deliver this project due to his own issues, anyone else who attempts will either be bullied by yandev into ceasing development(YOU HAD SEVEN YEARS TO NOT GET THIS PROJECT SNIPED), or seem to actually dislike the foundational tropes and genres that the idea itself is built off. I hate seeing a unique project like this suffer due to these issues. Some people say yandev bit off more than he could chew, but nothing about the project actually seems... overly ambitions? Can anyone chime in on this specific point and clarify what might actually require so much time to develop in a game like this?
On one hand, the dev doesn't deserve your money, he has a lot of difficulty dealing with many aspects of game development and I doubt YanSim will ever come out.
On the other hand, the whole community built around harassing and hating him is frankly unsettling and pretty sad.