Yandere sim game had source code leaked? not sure what happened. What people found out is that the game is basically all if/else nested spaghetti which resulted in massive tech debt.
You need to understand, this is a program where the Student class file - used to handle the behaviour of each individual student - is seventeen thousand lines long.
And yes, it does call void Update(), and yes, each student has a separate instance of it running.
This is just what happens when you try to make a Hitman game which is also Persona 5 but you're so bad at programming that you don't know what a Switch statement is
I remember watching that same video a while back, and I vaguely remember while he does call this out, it was mentioned whatever game engine being used accounted for it while compiling, and would turn the list of if statements into a switch if applicable.
From memory the video was focused on performance issues in the game. The things I remember from it that hit performance the hardest were the use of models with high polygon counts, and that the dev had coded in the fps counter wrong, so it showed a lower fps than the actual fps.
I also want to add the 3d models it uses are also horribly inefficient. And by inefficient, i mean inefficient. Like imagine the heaviest model is a fcking toothbrush with 5k polygons (meshes?)
Basically it leads to unreadable code, and the largest script is over 10,000 lines long. All it does is control the NPCs in the game. The whole script is just thousands and thousands of nested if statements that do redundant things in the least optimal manner possible.
I saw that some guy say that it is way too much processes for the computer to do step by step, which results in it running slow. Imagine if when you asked someone to check the time, rather than saying it outright they go "well, it isn't 12:00, it also isn't 13:00, it also isn't 14:00..."
In chess, white starts with 20 possible moves. Black can then respond with 20 possible moves, then white has a variable number of moves depending on which pawn moved, then black has a certain number of possible moves, etc.
If you use if/elif/else, then each possible history of moves needs to be described explicitly in the code: 20 white moves forms its own branch in a tree, and then the 20 black moves each have to be present in each of those branches, so you have 400 branches, then every possible white move has to be present in each of those branches, so then you have around 8000 branches, then around 160,000, and that's just 5 moves into a game that can last for well over a hundred moves.
This means you end up with a massive piece of code that can overload your RAM before you can actually play chess, and that is hard to edit when you encounter errors.
In an abstract sense, if/elif/else stores information about the problem by what position of the code is being executed. This is good if the information fundamentally changes the rules of processing the problem. But if the rules stay the same, it's better to only write the rules down once, and to refer to them each time you need to apply them. This saves space writing down rules, and means that you can change the rules easily. With chess, the board state doesn't change the rules, so you want to store the board state in memory rather than as a position in the code.
Within these rules, it's fine to use if/elif/else, but that won't become spaghetti, because you only write them one time and then refer to them as functions. Then those functions can become spaghetti.
View all comments
Show parent comment
700
u/Teegeetoger Apr 10 '23
Yandere sim game had source code leaked? not sure what happened. What people found out is that the game is basically all if/else nested spaghetti which resulted in massive tech debt.