Ruining Baldi's Basics by dissecting Baldi's AI | Tech Rules

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

I really struggle to understand why this game achieved any level of popularity- I get the "joke" that it's a slightly eerie and poorly made game, but it isn't something I would have ever put any thought towards beyond a chuckle

πŸ‘οΈŽ︎ 200 πŸ‘€οΈŽ︎ u/WickerWight πŸ“…οΈŽ︎ Aug 01 2020 πŸ—«︎ replies

My 5 year old daughter LOVES this game, primarily because the youtubers play it so much. We have a baldi toy and play baldi in real life lol.

πŸ‘οΈŽ︎ 28 πŸ‘€οΈŽ︎ u/XtheXlanternX πŸ“…οΈŽ︎ Aug 01 2020 πŸ—«︎ replies

I made a game in the same small jam this appeared in (Meta Game Jam), and it was kinda mad seeing something relatively well known spring from it so directly - the 2 week jam version did the rounds. I don’t think it was as good as the jam-winning game (a hacking game of pasta puns) but damn, it was a catchy idea.

πŸ‘οΈŽ︎ 18 πŸ‘€οΈŽ︎ u/RadicalDog πŸ“…οΈŽ︎ Aug 02 2020 πŸ—«︎ replies
Captions
so it seems that i made a video that you guys really liked i mean really liked to be honest i liked it too it ended up being one of my favorite videos i've ever made and just by looking at the comments i can tell that you guys want more well i was listening so after decompiling five nights at freddy's one the natural next course of action is to decompile and completely reveal the secrets of baldi's basics in education and learning uh and five nights at freddy's 2 but that turned out to be kind of boring everyone kind of works the same i might come back to it as a sort of fnaf series decompile video because the following games aren't very complex either but that'll be a while unfortunately the process of decompiling the rest of the games is difficult enough that i'm currently relying on the help of some people much smarter than me for now though just humor me it may not seem at first like the ai of baldi's basics would be interesting but it's surprisingly complex for such a small game and i have a lot i want to show you still haven't clicked off yet great you won't be disappointed hopefully welcome to tech rules [Music] you know on the subject of baldy did you know that two out of three guys will experience some form of male pattern baldness by the time they're 35. that's why today's video is sponsored by keeps keeps is the best and most affordable way to keep your hair after all you don't want to end up bitter and angry like our hairless friend baldi for the record i didn't plan this the video topic and the sponsor just happened to line up but it's amazing nonetheless anyway it may be too late for baldi but it may not be too late for you usually you'd have to see a doctor to get a hair loss prescription but thanks to keeps all it takes is an online doctor's visit for a prescription of the only two fda approved hair loss products on the market which by the way keeps also offers generic versions of hair loss prevention has never been so cheap yet so convenient also keeps has more 5 star reviews than all of the competition and nearly 100 000 men trust keeps for their hair loss prevention medication so if you're noticing that you're losing your hair do something about it for a limited time go to keeps.com techrules or click the link in the description to receive fifty percent off your first order anyway on to the video so a few things before we start the game we're looking at is baldi's basics in education and learning or as it's now called baldi's basics classic in other words this is the game that was made for the metagame jam not baldi's basics plus yeah they're the same game kinda but from a programming and ai standpoint they're fundamentally different from the little i've successfully uncovered from baldi's basics plus most of its original programming has been completely overhauled so the code you'll find in this video is essentially obsolete i kinda prefer it that way actually i don't know how i would feel about tearing apart a new actively updated game especially one where there still might be secrets people haven't found a hint hint to be specific we're looking at version 1.4.3 the final version of baldi's basics classic that added in the changes and improvements from the birthday bash edition but nonetheless i'll do my best to point out interesting changes that have happened since the first version and finally i felt it was important to mention that i didn't actually decompile these games i'm looking at the already decompiled files courtesy of jumpman25 on itch.io so they have my thanks for saving me the headache apparently this version is a pain to decompile with all that out of the way let's dive in first things first let's take a look at the school from a bird's eye view as you may be able to see the only npc that is actually spawned in at the beginning of the game is baldi and this isn't even the real baldy so to speak the baldi that's nice to the player and the baldy that chases after them are actually entirely different npcs and they switch out when you're not looking i'm aware that sounds more like fan fiction than a technical explanation but i'm being serious this change is triggered by getting a question wrong in one of the math games which and this part's very important the game internally called spoop mode okay it's not important at all actually i just wanted a reason to mention that the game calls it spoop mode spoop mode is a really good name for it but there's something that you should keep in mind about spoop mode because spoop mode is unavoidable the second notebook onwards always has an impossible question 3 and there's no way to get it right when spoop mode occurs the nice baldi despawns and the main one spawns in over here along with all the other npcs as you can see he actually spawns in outside of the starting area which has an interesting side effect these doors are locked until the player collects two notebooks so if you intentionally get a question wrong in the first notebook baldi and friends are actually completely locked out and can't get to you until you grab the second notebook but once two notebooks are collected the game begins and now we can get into baldi's anger mechanic so you'll notice that baldi only moves whenever he slaps his ruler specifically whenever he slaps the ruler he moves 10 frames toward his destination whether that be a room a sound or the player his speed itself never changes but the frequency of his ruler slapping does normally he slaps the ruler every 3 seconds well i guess technically it'd be 3 seconds if it weren't for the fact that he doesn't spawn in until the player actually makes him angry see whenever you get an impossible question wrong it adds 1 to the amount of anger he has and anger functions as a sort of penalty to the three seconds he already has as far as how the penalty is applied i'll have to come back to that it's a little weird and having the information i'm going to give you later will help explain why but what's important is since there is one impossible question in every notebook after the first he'll gain one point of anger for every one of them you collect maxing out at six when you have all seven notebooks at six points of anger baldi will move around every 1.02 seconds give or take some unity math weirdness that's around only 34 percent of his base wait time looking at these numbers you can see why it's so hard to avoid him at the end of the game in fact baldy at max anger covers more ground than the player can at max running speed you literally cannot outrun him so if you're not fast enough to get away from him how can you be expected to finish the game well items for one thing but aside from that baldi isn't omniscient he doesn't always know where the player is in fact he won't even go after the player unless he's actually got them in his sights despite that he always seems to be one step ahead so he must have some way of tracking the player down a lot of you may already know what i'm about to say but he's only able to do this because of his incredible hearing let me back up a bit baldi's ai behaves in three different i guess the word would be phases his default phase is just wandering he chooses a random room or point in the hallways and heads toward it until he either reaches it or gets distracted once he reaches that destination he'll pick another one and start the wonder phase all over again the second phase as you might have guessed is the chase phase this phase occurs when baldi spots the player at which point he'll just head straight for them even if he loses eye contact he'll continue approaching the last place he saw the player in an attempt to see where they went the last one and the one that makes him so difficult to hide from is the hearing phase this phase triggers when baldi hears a noise that he believes belongs to the player depending on what the noise is and what he's doing at the time he may drop whatever he's doing and head exactly where the noise came from thankfully baldi's a bit scatterbrained and doing something to cause a phase change will result in him dropping whatever it was he was doing to change to that phase there is for the most part only one exception to this as long as baldi has his eyes on the player he will not exit chase phase ever that being said if the player turns a corner and then baldi immediately hears a noise somewhere else he'll give up the chase and move on to that noise he may have a good grasp of math but object permanence seems to be a problem subject for him now there are some nuances to these phases especially the hearing phase while baldi does hear essentially every noise the player makes he may ignore a noise if he's currently going after one he finds more important this is done through a sort of sound priority system now there was a lot of code to go through in a bunch of different places but i'm pretty sure i found every single sound that baldi can hear and their associated priorities as far as priority we can sort it into three different tiers the lowest tier would be the sound the player makes opening doors tier two is either the tape player or bad math depending on the version of the game and finally the highest tier is reserved for big events like being sent to detention using an alarm clock or reaching one of the school's exits in the finale most of these explain themselves essentially while baldi is tracking one of these sounds he will only listen for sounds that are on the same tier or higher as the one he's chasing right now he'll completely ignore sounds of a lower tier opening doors is ironically on the lowest tier despite the fact that it's easily the best sound he's able to hear but it makes sense considering how often he hears it for clarification he only pays attention to doors that the player opens not anyone else and he also can't hear doors the player has treated with wd squee the alarm clock sound makes him go to the alarm clock's location once it goes off around 30 seconds after placing it down and being sent to detention or hitting an exit makes him hear exactly where the player was teleported to apparently teleportation has some sort of quiet distinct sound to it i guess maybe it's like a dog whistle kind of deal i don't know that leaves these two weirdos let me just explain the reasoning for this the tape player used to be kinda bad originally it was just like any other sound baldy would hear it walk over to it and if you reach his destination uninterrupted he would enter wanderface but since it's only a tier 2 sound the only noise it would cause baldi to ignore is the sound of doors opening and that was only until he found the tape player that means that literally any other noise would cause him to lose interest and chase the new noise unfortunately the alarm clock didn't exist back then so this was all you had later on though this was changed so it's not a noise at all instead playing a tape in the tape player would force baldi to change to wonder phase immediately and also force him to ignore literally any kind of noise for 30 seconds it was definitely a welcome change also this isn't super important but the old tape player actually does have a slightly higher priority than bad math meaning it would technically be in its own tier between 2 and 3 if they were ever in the game at the same time but by the time the bad math sound got added in the tape player was already overhauled so this isn't a scenario that happens for all intents and purposes they make up the second tier in their respective versions oh right i guess i should go ahead and explain what bad math is well it's exactly what it sounds like from 1.3 onward whenever you get every single question wrong in one of the math games baldi says i hear math that bad that's not just an insult it's a warning when this happens he will hear exactly where you are and start heading right for you what that means for you is if you're trying to get every question wrong there's no point in squeakproofing the door to sneak in and grab the notebook he'll just hear your atrocious math and start heading for you anyway and that brings us back to the anger mechanic remember how i specifically mentioned that getting impossible questions wrong added to baldi's anchor tally getting possible questions wrong works a little differently here i'll just show you here's the equation for calculating baldi's slapping interval negative 3 times a which represents baldi's current anger tally divided by the solution to a plus 2 divided by 0.65 and then plus 3. yeah how about i just give you the cheat sheet while it's not particularly complex it's still by far the most complex calculation in this game related to ai behavior if you're wondering why it's not as simple as everything else well it used to be originally it just worked like this every missed question subtracts from the base interval by 0.135 times whichever question number you're on during the math game in other words missing question 1 subtracted 0.135 seconds question 2.27 seconds and question 3.405 seconds yes i know what milliseconds are but showing the numbers this way will make something much easier to explain in a bit remember the only question you have to miss is the third one meaning during optimal gameplay every notebook after the first one would only subtract .405 seconds and like i said the interval starts at three seconds so by the time all seven notebooks are collected baldi is moving once every 0.57 seconds however countless players predictably challenge themselves by trying to beat the game while getting every single question wrong this is where the problem lies getting all three questions wrong adds a whopping 0.81 second penalty to the interval do the math on each notebook and by the time you've reached the fourth one your penalty is higher than the initial three second interval that leads to this happening not only did that look really weird it was also a problem because 1.3 added an endless mode to the game where baldi's anger goes up on its own over time this admittedly strange looking anger overhaul essentially prevents the situation from happening while still allowing baldi to become basically impossible to avoid with similar anger levels that being said 1.3 also added another feature making an all-wrong answers run possible and even adding a secret ending for doing so because of that the math game was changed so that while getting an impossible answer wrong added one point to this overhauled anger mechanic getting a possible answer wrong didn't add any points of anger at all instead it added 0.25 seconds to a new mechanic called temporary anger temporary anger works very similar to the way the original anger worked it's a simple time penalty to baldi's current movement interval the difference is that temporary anger decreases over time at a rate of around 0.02 per second so while getting every question wrong does give him a substantial boost in speed he will gradually slow down to his usual speed over time usual for a normal run anyway and keep in mind that if you didn't do something about that hearing of his before opening the notebook he's gonna know exactly where you are and all that extra speed is gonna be heading straight for you all this makes for a pretty difficult but interesting challenge and that's pretty much everything for baldi well except for the slight changes to his behavior in endless mode to be brief his anger exponentially increases over time in endless mode and the math game is very different only one impossible question shows up in this mode and it's when you read the second notebook so that baldy can properly activate that being said there's no such thing as temporary anger in this mode every wrong question adds one point of anger at the same time though getting every question right actually decreases his anger by one point being able to do simple math is the key to getting high scores in this mode oh and also being good at the game i guess that's probably more important okay now that's a wrap for baldi i guess to wrap up i'll go over the rest of the characters although everything's pretty basic compared to baldi himself and if you haven't noticed yet i froze baldy for this footage he kept catching me by surprise while trying to record the other characters so he's in timeout now i gotta say i like things better this way though the teacher becomes the something i don't know playtime uses a wander system similar to baldi although she never targets any rooms she'll also chase after the player if she sees them but breaking her line of sight causes her to go back into wonder phase pretty much instantly that is a startlingly small attention span she actually goes a bit faster than normal while she chases the player though so that's interesting if she catches them the player has to play jump rope with her cut her jumper up in half or somehow get pushed away from the spot they're jumping in whichever method is used she'll leave them alone for 15 seconds afterward it's a bully doesn't activate until 60 to 120 seconds after he spawns in once activated he'll pick a random spot in the hallway which by the way also happens to be the spots that the ai likes to wander to and block the player's path if the player approaches them while an item is in their inventory they'll take the item and deactivate or if 180 seconds pass since he started blocking the hallway that'll also make him deactivate and by deactivate i mean he hangs out underneath the floor as a matter of fact that's the same place the exits hang out when they're not in use it's just a good hiding space i guess after another 60 to 120 seconds he'll pick another location and continue his dastardly schemes also it's worth noting that he won't pick a location that's too close to the player wouldn't want them getting stuck in the collision or anything got a sweep hangs out in his closet for 120 to 180 seconds once that time is up he starts sweeping to a random destination in the hallway any characters in his way will get swept up with him once he reaches his destination he'll just pick another one and start sweeping again once he's swept his way to five different destinations he heads back to his closet and waits another 120 to 180 seconds to do the whole thing again first prize is interesting being the only character with different sprites for different angles that may not seem like a big deal but the developer thought it was complicated enough to put it in its own script so i'm getting off topic similar to playtime he'll roam around the hallway and search for the player if he spots the player he'll start accelerating toward them in an attempt to hug them he won't stop when he catches them opting to instead push the player all the way to the end of the hall and his breaks are really bad it leads to these weird like tokyo drift situations if he somehow gets into a room unlike gotta sweep however first prize will only push the player not any of the npcs important note about both of these characters the player can't move while being pushed by gotta sweep or first prize in fact it seems to use the same code that bee soda uses when it pushes a character away no drinking drinks in the halls oh right the principle of the thing is actually one of the more interesting npcs of the bunch mainly because of the way he handles rule breaking as weird as it is to say he takes advantage of something called the guilt system the school has a small handful of rules the player isn't supposed to break breaking these rules will deem the player guilty and add a certain amount of guilt to them similar to baldi's temporary anger system the player's guilt depletes over time unlike temporary anger however guilt doesn't accumulate if the player does some sort of action that would make them more guilty than their current kill value their guilt will just snap to that number instead as a side effect of this the player can only be guilty of one crime that sorry one broken rule at a time here's how long guilt lasts for each rule running lasts 0.1 seconds using a b soda lasts 1 second being in the faculty room lasts until the player has been out of the room for one second and escaping detention lasts until the detention timer is up if the principal happens to look at a guilty player for at least half a second he'll tell the player what they're guilty of and chase them down as far as i know once the principal has decided to chase the player nothing will stop him he will catch them one way or another and once caught the player will be locked in detention for a certain amount of time depending on how many times they've been in there the first defense lasts for 15 seconds then 30 then 45 then 60 and every offense after that will last 99 seconds keep in mind that baldi will hear the player getting sent to detention so unless the tape is playing he's gonna start heading straight there this can be kind of beneficial though if the player has the keys to unlock the door and escape baldi will ignore the sounds of doors opening until he confirms that the player isn't in the room anymore oh and eating an energy bar used to be against the rules in an earlier version but it was replaced with the no bullying rule when the players in the bully's bullying range the bully himself will become guilty his bullying range by the way is more or less the same range that makes the bullies say that he's going to take your candidacy even after leaving the bullying range the bully's guilt will remain for about 10 seconds and if the principal sees a guilty bully he won't wait until half a second has passed he'll charge the bully immediately and prematurely disable him apparently he has zero tolerance for bullying and lastly we have arts and crafters whose ai is actually kind of unique he doesn't wander around like everyone else does instead he stays invisible most of the time until the player enters one of his many triggers scattered around the school this will cause crafters to head to a nearby location at the end of a nearby hall when he gets close enough to the point he's supposed to be he'll become visible as long as the player isn't too close once he reaches his destination he just kinda stares for a bit once the player leaves the trigger though he'll flee out of sight and turn invisible again shortly after that is pretty much all he does at least until later in the game once seven notebooks are collected he won't run away anymore instead he'll get mad staring at arts and crafters slowly increases his anger stare for one second and now you've got an angry sock puppet on your hands he'll charge the player at an alarming speed and once caught he'll teleport them to the beginning area along with baldi once this happens the player will have to react pretty quickly to avoid an instant game over this will only happen once per game though arts and crafters despawns after doing this there we go that explains the ai of every single character admittedly i wasn't really expecting anything interesting when i initially looked through this game i guess just like the game itself there's a lot more to it than meets the eye regardless i'm glad to be proven wrong these kind of videos are definitely a lot more exhausting than the average explanation videos i do but it's fine i really enjoy making mostly unknown mechanics like this more accessible to the average person i guess that's what tech rules is all about in a sense even if it does take me like a month to get that information together i guess i should thank you all for always being so patient and as always i hope to keep an eye out for more tech rules
Info
Channel: Tech Rules
Views: 1,351,818
Rating: 4.9595261 out of 5
Keywords: Baldy, Baldy's Basics, Horror, Strategy, Revealed, Decompile, Unity, Educational, Baldi's Basics Plus, Hacking, Modding, Datamine, Programming, Code
Id: KQ1Zg34MP9o
Channel Id: undefined
Length: 21min 43sec (1303 seconds)
Published: Fri Jul 31 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.