What's up with the Pokémon BDSP calculator? - Reverse engineering and code review

Поділитися
Вставка
  • Опубліковано 24 лис 2024

КОМЕНТАРІ • 720

  • @EmpyreanRagnarok
    @EmpyreanRagnarok 2 роки тому +1593

    "We all know what language the pokemon games were programmed in."
    "Japanese."
    "Unity."
    "Oh right."

    • @Brahvim
      @Brahvim 2 роки тому +86

      ...more like C#, but Unity as a Game Engine existing on many platforms, ..uhh, yeah.

    • @bigpharts
      @bigpharts Рік тому +13

      Had the exact same thought xD

    • @KonekoArvi
      @KonekoArvi Рік тому +19

      Had the same thought.. And I'm a programmer. I am ashamed of myself... LOL

  • @WannabeMarysue
    @WannabeMarysue 2 роки тому +5351

    no, that's just how math works in germany

    • @rubengoldman5830
      @rubengoldman5830 2 роки тому +168

      incredible username

    • @kingbaku5092
      @kingbaku5092 2 роки тому +19

      Dopio

    • @gerbentime4175
      @gerbentime4175 2 роки тому +112

      It's how math works in the entirety of Europe.
      Source: I'm Dutch.

    • @princier_7215
      @princier_7215 2 роки тому +43

      @@gerbentime4175 I can confirm
      Source: I'm british

    • @Qvartz_Lite
      @Qvartz_Lite 2 роки тому +21

      BMW owners: "Makes sense"

  • @birdofclay9581
    @birdofclay9581 2 роки тому +2694

    The worst part: Based on what I remember and what I could find about it, the calculator did actually function correctly in all regional versions of Diamond, Pearl and Platinum.

    • @ClassicBentobox
      @ClassicBentobox 2 роки тому +974

      That was back when you were required to release finished games though.

    • @goldenhate6649
      @goldenhate6649 2 роки тому +182

      @@bigbadgammagnome Or in the case of tons of titles now, never gets fixed because they can't be bothered because they made their money and the game was 'good' enough that the whales will just buy the next one.

    • @ClassicBentobox
      @ClassicBentobox 2 роки тому +133

      @@bigbadgammagnome
      I think for me, it’s about priority. I don’t care about an exploit like Backwards Long Jump in Mario 64, because the game is complete as a package with or without that.
      But BDSP in its vanilla form doesn’t have proper music. It’s missing important parts of the complete package. That’s where it’s an issue.
      The big issue is really that a day will come when the servers offering the patches will go down. And thus some games will live incomplete in their original form. It’s short sighted.

    • @sarowie
      @sarowie 2 роки тому +6

      I know expensive software that has problems from this very problem class and the bugs remain for over a decade. Note the plural. The most stupid thing is, that the software "sometimes" uses comma and "sometimes" dot as canonical decimal separator and "sometimes" it accepts both and autoconvertes.

    • @D0Samp
      @D0Samp 2 роки тому +21

      In particular, if the original source was written in C, localization was a feature that was likely either unused and/or not implemented in the standard C library or DS system code (neither has facilities for decimal floating point numbers either), so code similar to this never came even close to assuming to see decimal commas.

  • @58209
    @58209 2 роки тому +961

    thank you so much for including manual captions. youtube's auto captions would have absolutely mangled this script.

    • @Linventor
      @Linventor 2 роки тому +78

      Yes.
      It's one of those things that doesn't often get much attention, but including captioning is always appreciated.

    • @competitively3315
      @competitively3315 2 роки тому +89

      Any UA-camr who makes manual captions are based.

    • @Koutsie
      @Koutsie 2 роки тому +7

      +1 !

    • @Nightcaat
      @Nightcaat 2 роки тому +11

      +1 for manual captions 🧡

    • @reidleblanc3140
      @reidleblanc3140 2 роки тому +15

      I've had to unsub from people who keep captions off, upload auto captions months after posting, etc... I need them

  • @DarthAnimal
    @DarthAnimal 2 роки тому +439

    This is why I feel so stupid as a programmer sometimes. Not because my code doesnt work, its never a big bug that destroys it, its always something dumb like miss parsing a decimal symbol

    • @neoqwerty
      @neoqwerty 2 роки тому +33

      I'm just a minecraft datapack maker and I SWEAR commas are 94% of the reason why my stuff fails (with 3% being "it's not supported on your version, goober, you were using the latest release's docs and asked the game about a non-existent function")
      At this point I've gone past feeling stupid and I swear the commas are my archnemesis.

    • @fatsu
      @fatsu 2 роки тому +2

      @@neoqwerty what about the other 3%?

    • @lord_khufu
      @lord_khufu 2 роки тому +3

      @@neoqwerty yeah those damn json and their stupid commas lol

    • @jek__
      @jek__ 2 роки тому +3

      @@fatsu Thats the space for problems we know must be there but we havent encountered yet

    • @kyucumbear
      @kyucumbear 2 роки тому +1

      @@jek__ Or the problems we have encountered and can pinpoint to a specific location but don't know why they happen. I hate those.

  • @KrakatonMain
    @KrakatonMain 2 роки тому +595

    Meanwhile, I have finally learned of the term "nerd sniping" and my god if this is not dangerous af for someone like me. I'm gonna have to be careful from now on

    • @wackyanimations3326
      @wackyanimations3326 2 роки тому +7

      wtf is nerd sniping

    • @masonbarber871
      @masonbarber871 2 роки тому +41

      @@wackyanimations3326 look up XKCD comic 356

    • @jek__
      @jek__ 2 роки тому +2

      Isnt "nerd sniping" the same as "starting an interesting conversation"? Like whats the issue here, that if you start an interesting conversation with someone unaware while theyre standing in the middle of a road they might get hit by a car? lol

    • @incognitoburrito6020
      @incognitoburrito6020 Рік тому +13

      @@jek__ No, nerd sniping is coming across a problem or question so interesting that you're compelled to suddenly stop what you're doing and drop everything to work on it--potentially to your detriment. I guess a conversation could nerd snipe you, but that hook could come from anywhere really.
      In the xkcd comic it comes from (you can pause when he brings up nerd sniping), the guy in the hat is holding up a sign that has a simple-looking (but actually very complicated) electrical problem on it, and the physicist crossing the road gets so distracted trying to solve it that they stop and get hit by a truck.

  • @watsonwrote
    @watsonwrote 2 роки тому +1089

    My phone language is in French which uses the comma as a decimal instead of period, and I have ran into some weird issues on apps and websites that expect a period but the phone forces a comma. Makes me wonder how many other systems only function within the culture they were designed in

    • @ambozz3726
      @ambozz3726 2 роки тому +8

      French Canadian would not have these issues, I presume.

    • @Nuvcore
      @Nuvcore 2 роки тому +30

      @@ambozz3726 French Canadian is wierd. We use commas for decimals, but it's definitely not everyone who does so. But technically, it should be commas, so we should have that issue.

    • @velvetbutterfly
      @velvetbutterfly 2 роки тому +16

      English in Canada use periods or full stops as decimal points. And unlike Americans we don't use commas to denote new scales of numbers. Like, "1 000 000" is written without commas or any marks

    • @goldenhate6649
      @goldenhate6649 2 роки тому +25

      @@velvetbutterfly Though that does depend on whos doing the writing. Officially, we use commas. Unofficially, we are way to lazy to actual write them unless numbers get huge.

    • @prowhiskey2678
      @prowhiskey2678 2 роки тому +37

      As a programmer I am pretty confident 95+% of ict systems only work in their designed locale.
      So many things can go wrong, but mainly:
      - wrong translation. translation whose text does not fit in the designed space
      - number formatting
      - currency conversion
      - imperial/metric units
      - and most importantly timezones

  • @endlesswanderer1753
    @endlesswanderer1753 2 роки тому +161

    Back when I worked in QA, we would be given a stack of different region carts/a spindle of different region discs. These days, I figure you just flip back and forth through the regions on the Switch itself. Now, most people who QA aren't as anal as I or some of the others who worked with me were. We would sit there and prod something for hours trying to see if it could bend or crack. A tiny little calculator app that doesn't really matter? You'd think even the most dedicated QA tester wouldn't mess with it.
    ...but if you were in the game long enough, you'd know this was a common issue between regions due to the decimal point difference. The first thing you'd check wouldn't be '2+2? 4? Alright, it works.' No, it would be popping in that EU-GER cart then dividing something.
    Now, one thing I keep seeing people repeating is 'how didn't anyone at ILCA catch this?' The truth is, they probably did. Then the dev team labeled that shit as having least priority and never fixed it before shipping. Every game I worked on had major problems labeled as none issues and ignored until it bit them in the ass. The dev management treated us QA as the enemy almost. I straight up got told to my face 'Stop trying to ruin MY game!" by multiple dipshit managers over the years. And when you look through the comments here, it's no wonder QA testers don't last long. Dudes like me who worked QA over a decade were mostly psychos who hated ourselves enough to sit through getting shit on by the dev team, getting shit on by fans, getting shit on by reviewers, and not even being paid or credited like we worked on the game. Oh, and guess what? When layoffs came by, it was QA that was first to go a lot of the time. If you managed to survive your first game launch, you were likely to be let go at the end of it anyway cause you're disposable and some bright-eyed kid will gladly get paid worse than you to do your job and two other people's. Cause working in games is your dream, isn't it? You should feel lucky to do it.

    • @klobiforpresident2254
      @klobiforpresident2254 2 роки тому +17

      At my company we've recently slipped into an odd situation involving QA. The devs and QA/QC work together just fine (oddly enough). This time it's release management saying that if we schedule a hotfix window after a new update (for any one of our twenty to thirty big software packages) that's a defeatist attitude. In truth QA isn't magic and our software vendors simply don't have the manpower to work out all the bugs the testers and users will find before a release. Sometimes the issues are minor - "if we do things from this menu the application freezes for a minute but we can do it from the other menu and it goes just fine" - other times they're mayor - "whenever we process a customer onboarding form database errors happen".
      To see devs, operations, and QA/QC team up against release management is a sight to behold.

    • @chainswordcs
      @chainswordcs Рік тому +2

      well said

    • @sharpieman2035
      @sharpieman2035 Рік тому +9

      I don’t even work in game dev but I work on an understaffed team with many high priority bugs, and I can confirm that if we have a user report a bug like this we would mark it as low priority and probably never get around to fixing it.

    • @baddragonite
      @baddragonite Рік тому

      Sorry it sounds like you had such a rough experience

  • @AGoodWobble
    @AGoodWobble 2 роки тому +173

    This reminds me of a really unfortunate week at my previous job as live-ops programmer at an indie game company. I needed to update our Unity version to function with several new plugins we planned to use for a game that I was supporting (side note: the game was made a couple years before I joined, and the developer went on temporary leave but then just never returned, so I was just solo supporting the project with no guidance from any devs who actually worked on the game). We QA'd without issue, but after the update the game started to crash for a small number of users, and we started to receive negative reviews almost daily. I spent nearly a week testing, reading error logs, adding and removing plugins, and could not for the life of me find the issue. Then, as the reviews rolled in, I was going over them and I realized that the negative reviews were written almost entirely in russian, french, spanish, and other such languages.
    I switched my device language, but the bug still didn't occur. Samsung has this amazing thing called "remote test lab" where you can test physical phones in different regions, and I used that to test our game on some Russian phones--lo and behold, a reproduction of the dreaded bug! Best feeling as a dev is finally getting a reproduction on a bug.
    As it turned out, updating Unity updated the version of C# .Net that Unity ran on, and .Net updated their spec for their `Single.Parse` function, which reads reads text into a number. Instead of using the build locale for `Single.Parse` by default, it would now use the device locale. So, when parsing some level data at runtime, it was throwing an error when parsing data formatted like "123,456.78" but only for people whose device locale was in certain regions (i.e. people who were in Canada but wrote French reviews weren't getting the error!). All I had to do was add a single `CultureInfo.InvariantCulture` to the `String.Parse` line of code, and everything was fixed.

    • @AGoodWobble
      @AGoodWobble 2 роки тому +13

      Just watched the video-quelle suprise-it's the dot Net parser that caused the issue haha

    • @HappyBeezerStudios
      @HappyBeezerStudios 2 роки тому +15

      I assume it was indeed set by device locale and not device language, because those can differ.
      I'm in Germany, and my phone is set to "English (Germany)" (for the simple reason that app translations often don't work right and it is easier to find documentation and support) So all the text is in English, the number and date formats are as in German, and the locale is set to Germany. In a similar way I use youtube with language set to English, but region to Germany.

    • @AGoodWobble
      @AGoodWobble 2 роки тому +8

      @@HappyBeezerStudios Yep, we added testing several device locales to our full QA process afterwards!

  • @dameatofdavoid32
    @dameatofdavoid32 2 роки тому +325

    Honestly didn’t even know that the calculator was broken outside of the US and Japan but it makes a lot of sense why it was broken

    • @snintendog
      @snintendog 2 роки тому +19

      Europe Ruins Everything by not following basic standards part 761

    • @AliceErishech
      @AliceErishech 2 роки тому +36

      @@snintendog How did they even end up using a comma as a decimal point anyways? I mean it's literally called a decimal POINT. Commas are blatantly not points. That's just as stupid as us Americans sticking adamantly to our imperial measurements.

    • @chlorobyte_projects
      @chlorobyte_projects 2 роки тому +15

      @@AliceErishech As a fellow programmer in Europe, I personally see the , as cursed and use . as much as I can.

    • @anda3487
      @anda3487 2 роки тому +95

      @@AliceErishech Surprise: its not called decimal point in german, but literally just comma. Its annoying that we dont have a unified system - But your reasoning isnt good lmao

    • @snintendog
      @snintendog 2 роки тому +5

      @@AliceErishech Imperial Measurements are slowly falling away in the US in a lot of engineering and architecture so it's not as stubborn as you think. But as for the comma crap all I can see is the Need to be different all programing follow the UK Us Asian math system and it's literally 4th world countries that are doing this so why are we capitulating to them? (4th world country a country that Willingly gimps itself.)

  • @hershmysson
    @hershmysson Рік тому +13

    omg I always say that BDSP always looks like it is "baby's first unity project" but holy moly it's actually true, it baffles me how they couldn't go for the Let's go engine, if that game was made to the same level of care as the lets go games it would be so incredibly memorable.

  • @Zakar0
    @Zakar0 2 роки тому +1844

    I'm not sure whether to be impressed or disgusted that a coding program sold for less than 20 dollars can automatically detect and warn about an issue that evaded the coder, UI dev, and beta tester(s) (though those were probably 0, or 1 for JP and 1 for EN only). Like, that borders on impressive just how overlooked it was.

    • @Gold_Yoshi
      @Gold_Yoshi 2 роки тому +224

      Maybe only the EN and JP testers were the only one who tested the calculators, the rest may have decided "Oh! A calculator *1+1*. Well, it works! Time to never use this again, not that it matters! I trust that GameFreak (Edit: ILCA developed this rather than GameFreak, my bad) can build a basic calculator."

    • @KojoGotMojo
      @KojoGotMojo 2 роки тому +59

      The biggest ever franchise in the world missed all of this and its only getting worse

    • @shinydragon69
      @shinydragon69 2 роки тому +108

      @@Gold_Yoshi Game Freak deserves all the hate, but BDSP was developed by ILCA, not Game Freak.

    • @Epsilonsama
      @Epsilonsama 2 роки тому +49

      @@Gold_Yoshi The plugin is usually used by professionals developing stuff in Unity but ILCA were new as hell to coding and probably did not get that.

    • @KojoGotMojo
      @KojoGotMojo 2 роки тому +21

      @shinydragon69 but game freak hired them to do their job, I blame gamefreak for giving them a task that couldn't be handle

  • @PointsofData
    @PointsofData 2 роки тому +225

    When I first heard of the comma vs period issue with the calculator I was hoping someone would be enough of a nerd to dig through the files and figure out what was going on. Thanks!

    • @HappyBeezerStudios
      @HappyBeezerStudios 2 роки тому +2

      The issue is even better when we look at how Excel parses numbers. In my locale commas are used as decimal separators and full stops are treated as seperators for dates. So if I copypaste a value like 23.07 it automatically assumes I mean 23rd of July in the current year and writes a value of 44765 into the cell (but displayed as 23.07. 2022). Because Excel does dates in days since the 0th Jan. 1900 and 23.07.2022 is 44765 days after then.
      And there is no way to disable this "feature", it always does it. So the only way to properly input 23.07 as number with decimal separator would be by manually typing in each digit or by formatting the cell as text (which turns it into a text string instead of a numeric vaule and causes the issue of not being able to do calculations with it).
      You can guess how troublesome it is to transfer large arrays of data between values with decimal points and decimal commas.

    • @1014p
      @1014p Рік тому

      @@HappyBeezerStudiosEasy solution, stop using the period and comma incorrectly. There is zero good reasons to not make the change. Easy way to break a machine over there seems to be passing commonly formatted numbers.

  • @Winasaurus
    @Winasaurus 2 роки тому +17

    I practice nerd sniping in work. It's the easiest way to get the more senior members of the team busy for a couple hours. "Hmm, it's weird that we have to do this manually, surely it wouldn't be too hard to at least automate ______, right?", then I can just do my work at my pace while he spends the next 5 hours in python debugging loops to automate a process that takes maybe 12 seconds.

  • @nadiaholmquist
    @nadiaholmquist 2 роки тому +53

    Ah yes, locale dependent number parsing issues strike again.
    You'd be surprised how common this is. A year or so ago I reported a bug to Apple causing some UI elements to go missing on macOS with the framework we were using - the culprit was that any SVG image containing a decimal point would fail to parse in locales that use commas, because whoever wrote the parser for those in the OS forgot to specify the locale when parsing the numbers in the file.

  • @cd7677
    @cd7677 2 роки тому +103

    Man i love how casually programmer guys talk about using like 12 programs consecutively to see raw text and read it

    • @Cerberus1746
      @Cerberus1746 2 роки тому +11

      It's even better when they use a single one, one that they made. Or trying to understand how things work by just the raw binary memory dump. I did that once or twice and it's almost a couple hours to just figure out a single variable and make sure it's not a lie

    • @CrimsonAkato
      @CrimsonAkato 2 роки тому +10

      not a programmer but this can be said about anything, for me it's with modding games and extracting 3D assets just casually using like 10 different programs to convert from 1 file apply fixes convert again transfer it's information convert to another then get a 2nd model from the fane I wanna mods copy that information place on the previous model do sone more jumping around between multiple programs and shove it into the game
      only for it to look horrible cuz u forget to add the diffusion materials shading and normal mappings xD . the amount of stuff I had to study and learn from mostly tutorials and reading years worth of forum pages xD . oh boi

    • @ninaadadhvaryu1603
      @ninaadadhvaryu1603 11 місяців тому +1

      When he said "developed by NSA" I paused and said what the actual fuck

  • @someone.8878
    @someone.8878 2 роки тому +96

    imagine the broken calculator becoming an all-new arbitary code execution glitch

    • @Brahvim
      @Brahvim 2 роки тому +2

      Yeah! And it'd never happen because modern technology is strong!

    • @mariocamspam72
      @mariocamspam72 2 роки тому +26

      Sadly the Switch has memory guards and rw protection and all, so no SNES-esque consequenceless access violations :(

    • @klobiforpresident2254
      @klobiforpresident2254 2 роки тому +8

      @@mariocamspam72
      Speaking of access violations, didn't the original Crash Bandicoot override system memory? The past was, as the kids say, a whack place.

    • @null418
      @null418 Рік тому

      @@klobiforpresident2254 how

  • @evanbelcher
    @evanbelcher 2 роки тому +14

    I'm mostly just surprised that they wrote this code by hand. I'm sure there's some open source code that handles all of this perfectly.

  • @MrCheeze
    @MrCheeze 2 роки тому +66

    Not a crossover I expected, but one I'm very glad to see.
    It makes a lot of sense that the extra zeroes are caused by repeatedly divided by 10 and taking the lowest digit.

  • @competitively3315
    @competitively3315 2 роки тому +98

    I didn’t know the calculator wasn’t correct. That’s absolutely hilarious lmao

  • @Primu
    @Primu 2 роки тому +19

    Knew as soon as you mentioned "region" that it'd be a locale issue with period/comma. Every newbie programmer's nightmare, surprised to see such an issue in such a highly regarded franchise though, I guess an extremely small portion of their budget is going to developers lol

  • @renakunisaki
    @renakunisaki 2 роки тому +1637

    Literally a CS101 project and they managed to do it this badly in a game from the highest grossing franchise ever.

    • @leohuangchunwang
      @leohuangchunwang 2 роки тому +158

      @Lind Morn Gamefreak didn't even make this game, it was outsourced to a different company...
      Though honestly I wouldn't blame the devs for failing to catch the bug - the fact that the decimal point can be something other than a dot is not exactly a well-known fact outside of the countries that do use a comma, and I'm pretty sure any CS101 version of such a program would have far worse bugs (especially around floats) than this

    • @maverillion4610
      @maverillion4610 2 роки тому +59

      Look, no, this is the easiest project possible stop defending it. If there were bugs or would’ve been in implementing it into the poketech or the actual UI not it’s functionality. If someone cannot code a calculator’s functionality then go back to school cause you learn that in coding camp from middle school, this is just much more variable management, it’s also in C# one of the easier languages to use.
      I’ll nerd out a little as a cs grad. So for something like this program you don’t even need to pay $20 for a program, there are many packages and apis that will do it for you for free. Even if you don’t want to use those, since there are only 2 different types of numbering systems , and . You can write 2 methods let’s call printdot and printcomma, do all the original math normally, pass the answer into those methods depending on your region selected, and reconfigure the , into .. Now a issue that people might say is oh what if put the number in using . easy, write a third method called readdot and send it into the normal calc. The bigger thing people will bring up is, “they don’t have the time” no, they do, writing these 3, no 2 methods will take maybe 30 minutes at most, basically if they hired an extra highschool intern. So yeah, no excuses

    • @liam4736
      @liam4736 2 роки тому +68

      The code is fine except for a single fuckup that they missed. This is more of a QA issue than a coding one.

    • @alarii2582
      @alarii2582 2 роки тому +29

      @Lind Morn The Pokemon Company (The company that actually owns the rights to Pokemon) is owned 50% by Nintendo and 50% by GameFreak. They have access to more then enough money to actually make a good game if they wanted to.

    • @TempoKong
      @TempoKong 2 роки тому +19

      @@maverillion4610 my brother in christ, this bug could be easily resolved if they actually had time to test the game and every single thing in it, which take more than 30 minutes

  • @syntheticsaturn
    @syntheticsaturn 2 роки тому +7

    from bulbapedia:
    "In Pokémon Brilliant Diamond and Shining Pearl, [the calculator] has been reported to exhibit wonky behavior."

  • @97MiloProductions
    @97MiloProductions 2 роки тому +50

    damn, i guess that was an oversight for different regions, still within the realm of buggy pokemon features, if im not mistaken both sword and shield and BDSP had their intended shiny increasing odd methods completely broken or coded in but not called, i sort of rememer reading that when they released

    • @TheRedSmarty
      @TheRedSmarty 2 роки тому +25

      Sword and Shield's worked properly. It was just that no one understood how it was supposed to work.
      Increased Shiny odds for battling a certain number of that species were only applied to a small amount of that species rather than all, so everyone thought it was bugged and basically worthless but no: it was applied specifically to Pokémon with a brilliant aura, which also became more common in the same way, which was intended.

    • @MyGawd-
      @MyGawd- 2 роки тому +7

      Sword and Shield worked properly, people assumed incorrectly when the game dropped

    • @chainswordcs
      @chainswordcs Рік тому +1

      the shiny chance increase mechanics were bugged (seemingly not functioning fully as intended) in Let's Go Pikachu and Eevee. I can't do a deep dive, but a youtuber named jrose (iirc) covered the topic in a Shiny Living-Dex Challenge video.
      (Edit 1: it was actually Johnstone who made that video)
      And with Sword / Shield. Via datamining, I think it was concluded that the shiny pokemon with square-like shiny particles (a new variant) were intended to be rarer. But due to oversights, they were by far more common than the other type of particles. Don't quote me on that too hard, I forget the exact details, plus it was a while ago so that game received numerous updates.
      That info would've been datamined probably by someone like SciresM (Michael), Kaphotics, OatmealDome, or ShinyQuagsire. But I'm not certain who it was to discover that.
      Edit 2: Also, that would've been tweeted by one of them on Twitter. Not a formal blog post or something. I'm pretty sure it was discovered around launch, before the first DLC released (or was announced)

    • @mbcodes18
      @mbcodes18 Рік тому

      ​@@chainswordcsThe chances for the sparkles are (by intention) different depending on how you get the shiny. Sword's shinies are completely functional as intended.

  • @pfqniet
    @pfqniet 2 роки тому +23

    Thank you for indulging the nerd snipe and sharing your results, you've saved me from diving into this myself! Funny how something we consider so simple as a calculator is actually far more complicated than expected!

  • @whynotanyting
    @whynotanyting 2 роки тому +9

    I want more videos like this, explaining exactly step-by-step what went wrong in the logic of the code

  • @christophsiebert1213
    @christophsiebert1213 2 роки тому +13

    I thank you for this video. I use the exact same approach since february to do various unity reverse engineering projects and data mining. And I didn't know that I could also parse and use the header file in ghidra. This would have made so many things so much easier. Until now, I had to manually rename function parameters and figure out when a field of the current class instance was referenced.
    Great content, keep it up, and leave some of those information in the videos to maybe help others that stumble over your content. Have a great day :)

  • @jmv333
    @jmv333 2 роки тому +10

    Cannot believe how fast your turnaround on a video like this! Overjoyed to get to watch a new video of yours like always :)

  • @RETIREglitch
    @RETIREglitch 2 роки тому +30

    Great work! You probably already figured it out but... The repeated question marks occur when the displayed string is longer than the max displayable characters. Trying to perform maths on a value already above the 10 digit limit sets it to 0, hence some extra weirdness that was noted in the original video. This is all based on NDS research but I would assume it carries over to the unity remake, as it looks like identical behaviour and the devs reused a lot of the logic present in the NDS games.

    • @RETIREglitch
      @RETIREglitch 2 роки тому +7

      One thing that did spark my interest in the original video was that for some people instead of repeated question marks it made the calculator disfunctional. In the original game, while not possible, if you could parse a very large integer into the calculator field you could overflow into the max_display and when that occurs it wouldn't update the calculator anymore due to some checks failing. I seriously doubt that would be possible as this is ofc C#... But interesting that it looks like the same behaviour.

  • @peardude8979
    @peardude8979 2 роки тому +3

    I am very happy UA-cam recommended this to me, this is a great video! Learning about how games can be reversed engineered almost makes me want to try it, but I'm terrible at reading code so I'll stick to dumping games and getting their music files instead.

  • @anselmschueler
    @anselmschueler 2 роки тому +65

    OK, I’m at 9:17 currently and I’m *betting* this has something to do with the fact that German uses the comma (,) as the decimal separator. Some locale-dependent parsing or formatting function is getting called and it’s not outputting what the rest of the code expects.
    EDIT: I was right, but wow, I’m surprised this code doesn’t crash

  • @alexanderdejesus4986
    @alexanderdejesus4986 Рік тому +2

    Excited for the pokemon crystal ranking coming out

  • @TheOfficalAndI
    @TheOfficalAndI 2 роки тому +19

    That's the quality I expect from 'modern' pokemon releases.
    What I am way more surprised about is how relatively easily you were able to actually get a chunk of extracted Code out of the game, in readable format :O

    • @velvetbutterfly
      @velvetbutterfly 2 роки тому +4

      But it wasn't made by gamefreak, it was made by an outside party with a better track record

    • @KStarPR
      @KStarPR 2 роки тому +2

      @@velvetbutterfly Ironically though that outside company with a better track record absolutely mangled the code & logic of GameFreak. BDSP and HOME have so many problems due to ILCA screwing up how Pokémon data is written and stored.
      You'd think they'd get help from GameFreak or at least study stuff from fans given that we can generate entire Pokémon from scratch in 3rd party programs.

    • @chrismanuel9768
      @chrismanuel9768 2 роки тому

      Company they outsourced to sucks.

  • @duck_corp
    @duck_corp 2 роки тому +6

    Excellent video! You did a great job explaining everything to be understandable without overly bloating the details.

  • @Stingpie
    @Stingpie 2 роки тому +163

    I cannot imagine the thought process behind this code. Why didn't they just turn the number into a string to send to sendnumimage? It would've been simpler, faster, and less buggy. This was either programmed by somebody who didn't know how to iterate over a string, or is some weird hold over from the GBA.

    • @HenryLoenwind
      @HenryLoenwind 2 роки тому +53

      I guess they ran into some edge cases (e.g. integer part longer than 10 digits) and couldn't come up with a way to handle those in a sensible way.

    • @mariotheundying
      @mariotheundying 2 роки тому +17

      DS*

    • @samuelthecamel
      @samuelthecamel 2 роки тому +4

      @@HenryLoenwind then just render 10 digits starting from the left side if the string is longer than 10 digits, and check if the number's value is too high to display. Then write some code to remove the 0s at the end if there's a decimal point. Problem solved

    • @X-3K
      @X-3K 2 роки тому +19

      he got paid per line

    • @urkerab
      @urkerab 2 роки тому +15

      I imagine that there was no thought process behind this code; not only should the developer not have used the default culture, they should not have used the default format either, since they already knew how many digits they wanted. And they definitely should not have required so many conversions just for one number display routine.

  • @spirttomb
    @spirttomb 2 роки тому +2

    I highly appreciate you not treating me like I'm stupid! This topic is so interesting. Great video!

  • @Swagpion
    @Swagpion Рік тому +3

    I find commans being used for thousands and periods for deciamals to be more consistent with language. Commas are used for short stops, while periods are used for long ones.

  • @RJP0409
    @RJP0409 2 роки тому +11

    A new piman video is always sure to be quality content

  • @Meta_data
    @Meta_data 2 роки тому +7

    Seriously, well done on this video! Greatly informative and entertaining.

  • @BenightedAlizar
    @BenightedAlizar 2 роки тому +3

    Funny to see pros making a similar mistake to what I did before!
    I had to replace "ToString();" with "ToString(System.Globalization.CultureInfo.InvariantCulture);" in some of my code to make the commas/dots not change.
    Lucky that I was using two computers with different locales, otherwise I would have missed the bug.

  • @scraps7624
    @scraps7624 2 роки тому +5

    Your work is just incredible, just mind blowing stuff

  • @krumplin8992
    @krumplin8992 Рік тому +3

    Something a modder said was that the entire backend code of BDSP was simply copy pasted from the DS games. This means that some things broke like the calculator because of the new regional functionality of C# but also that glitches from the DS games (suction cups fishing for instance) are still there. The lack of care is pretty disappointing

  • @floramew
    @floramew 2 роки тому +6

    Hah, saw that prior video too. I barely understand either the math or the coding, but it's fun to watch these kinds of videos regardless.

  • @Brettlaken
    @Brettlaken Рік тому +1

    I'm more impressed that this thing still gives the right answer sometimes.
    Aside from the locale thing it looks like they treated C# like assembly.
    Impressive how much you can overcomplicate a calculator.

  • @seeibe
    @seeibe 11 місяців тому

    After seeing some content mills recycle your ideas into trash, I'm really reminded how outstanding your content is. Not only is there real substance, but the presentation and editing is top notch.

  • @ThatOneGuy8305
    @ThatOneGuy8305 2 роки тому +2

    It's incredible that I know nothing about game dev, have never used unity, and haven't looked at C++ code in five years and I knew the second you mentioned the problem was with certain regions that it was comma-related. Such a remarkably obvious oversight and the fact that nobody ever thought about it prior to release is jarring.

  • @crides0
    @crides0 2 роки тому +15

    So in order to display a number as images they formatted it, parsed it, and then custom formatted it.. Why???

    • @Known_as_The_Ghost
      @Known_as_The_Ghost 2 роки тому +2

      Maybe the guy who was working on it was like,
      "I get paid by the hour." lol

    • @HenryLoenwind
      @HenryLoenwind 2 роки тому +8

      It's called "Lego Programming". People, who don't have experience in programming as a hobby, get trained at some college/university/etc. They learn to combine a number of building blocks in a way that satisfies the requirements of their courses, but gain no deeper insight. When confronted with real-life problems that have not been constructed by a teacher to be solvable with the blocks that got taught earlier, they have no idea how to handle that. So they add those building blocks together until the code works in the limited number of test cases they can think of.

  • @ProfessorRex
    @ProfessorRex 2 роки тому +3

    I really enjoyed this video and dive into some of the broken code in the Pokémon games! There’s plenty of it & I’d love to see more some day!
    Thank you for making this video :D
    Keep up the astounding work!

  • @normalichu
    @normalichu 2 роки тому

    This reminds me that a game dev youtuber I follow had a similar problem.
    On one cutscene, the characters would teleport to coordinate "1.000", which worked well on some PC's, but caused the player to end out of bounds on other cases.
    It was due to the country you had your PC set on.
    Very interesting, honestly. This video goes more in depth, which is something I, as a junior programmer, find very nice.

  • @Sukadia
    @Sukadia 2 роки тому

    the recommendation algorithm was good today. very satisfying being able to see this video just a day or two after matt's!

  • @blikthepro972
    @blikthepro972 2 роки тому +3

    this is an example of why overcomplicating something can result to chaos

  • @TheManOfPeace999
    @TheManOfPeace999 2 роки тому

    Didn't even realize you were they guy that did the SMO videos. Fantastic content

  • @julius4858
    @julius4858 2 роки тому +1

    Amazing, would love to see more of this stuff

  • @xDakem
    @xDakem Рік тому +1

    That's why I'm subbed to this channel.

  • @muesli2kanal585
    @muesli2kanal585 2 роки тому

    i thought i get bored as hell, but even me as a programmer must say you made a intressting vid, nice work!

  • @sagacious03
    @sagacious03 2 роки тому

    Okay analysis video! Thanks for uploading!
    Looking forward to the Crystal-based video! Thanks for uploading!

  • @chanm01
    @chanm01 2 роки тому

    Oh dude, you're the ranking the trainers guy? I'm glad you're still doing well. Hope I come across another one of your videos some day!

  • @MrSpontanicus
    @MrSpontanicus 2 роки тому

    Wow, great video.
    When I watched Matt's original video, I thought the problem is probably somehow related to the calculator parsing the locale dependent string representation of the number and then searching for a "." character specifically to split the number into an integer and decimal part. But I had no idea why it would do that instead of just displaying the string directly and after watching your video I still have no idea :D

  • @depotheose7890
    @depotheose7890 2 роки тому +76

    as a german i see nothing wrong with that calculator. that's just how math works over here

  • @apdj94
    @apdj94 2 роки тому +1

    Changing the operator mid calculation is the same way a lot of built in calculator apps work. You could reasonably call that a feature rather than a bug.

  • @aneeshsrinivas9088
    @aneeshsrinivas9088 Рік тому +1

    Imagine submitting a sequence from this broken calculator to the OEIS, or online encyclopedia of integer sequences.

  • @IAmNotASandwich453
    @IAmNotASandwich453 2 роки тому +1

    Dang, havent even really started the Video yet but that infinite resistor grid nerd sniped me. 😂

  • @562.anthony2
    @562.anthony2 2 роки тому +1

    Lmao that intro, if you have your camera towards your dude like that while climbing a ladder it gets creepy like that too 😂

  • @RonGrethel
    @RonGrethel Рік тому

    I went to a coding boot camp and got a job as a programmer about a year and a half ago. Your videos are making me better at my job😅

  • @lukehaws4423
    @lukehaws4423 2 роки тому

    Truly impressed with this video, great content and you deserve more subscribers and likes. Commenting for the algorithm, good luck with your channel

  • @Anime__Knight
    @Anime__Knight 2 роки тому +1

    Now that I've fooled you with the cartoon creatures, let's talk about computer science.

  • @fuuryuuSKK
    @fuuryuuSKK Рік тому

    Reminds me of a bugreport I saw a couple years back, where in the minecraft mod Astral Sorcery, a turkish player either got a crash or was missing an item. The culprit was that the upper/lowercase conversion functions in java are, again, locale specific with most regions having I/i paired, but turkish has I/ı and İ/i, which caused the failure.

  • @supremeoverlordkrenner6160
    @supremeoverlordkrenner6160 2 роки тому +11

    I get that it was open sourced and released to the public and all that, but the fact that he just casually boots up the NSA DEVELOPED DECOMPILATION TOOL was hilarious

    • @Dontrel3030
      @Dontrel3030 2 роки тому +2

      It's so funny that the only times I've ever heard this amazing tool mentioned were by youtubers who wanted to do something weird in a Nintendo game. The other time was Paper Mario, now it's pokémon.

    • @TheMike0088
      @TheMike0088 2 роки тому +3

      True, but I also think its hilarious that the NSA DEVELOPED DECOMPILATION TOOL has cute little pixelart dragon animations.

  • @PunishedFelix
    @PunishedFelix 2 роки тому +1

    Man I love bugs like these they're so annoying but funny when you find them!

  • @HECKATE
    @HECKATE 2 роки тому +5

    wasn't expecting Neon White to pop up as the example of a C# game to reverse engineer, but I'm glad to see it get mentioned since I spent a good load of time poking through it in dnSpyEx :)

  • @yoshyfoods
    @yoshyfoods 2 роки тому +1

    I just now learned of this game being a unity engine based game. Honestly I cannot say I expected it to be one, but honestly I’m not suprised

  • @thetruemystic_
    @thetruemystic_ 2 роки тому +1

    Genuinely had no idea pokemon was made in unity
    Can't believe errors like this slipped through

  • @Patashu
    @Patashu 2 роки тому +7

    You could make a whole series out of decompiling Pokémon bugs

  • @cleverman383
    @cleverman383 2 роки тому +1

    As soon as you typed 1.2.3 * 2 and got 2 4 6, I realized the issue immediately

  • @tanglelover
    @tanglelover 2 роки тому

    We have multiple shared recommended videos. Nice.
    Anyways, excellent video!

  • @Jurarigo
    @Jurarigo 2 роки тому +5

    Within the first minute, I knew exactly what happened. It actually happened to me in a mod from Vampire The Masquerade Redemption. The mod included a launcher that let you set some percentages of gameplay elements and they completely broke in my spanish PC.
    So the aesop is: pay attention to the goddamn locale when you're coding an app that is meant to be globally distributed.

  • @Glory2Snowstar
    @Glory2Snowstar 2 роки тому +1

    I think that videos showcasing BD/SP’s absolute mess of game design + coding is a genre that needs more appreciation. Love the in-depth explanations and ESPECIALLY the hand-written captions, MUCH appreciated!

  • @hiperion_1416
    @hiperion_1416 2 роки тому

    Going to save this, a little ago I gave up on a RE project because I couldn't use the header on ghidra

  • @evanhorn1909
    @evanhorn1909 2 роки тому

    the song in the second half is called Dragon's Den (From "Pokémon Gold & Silver") by DJMykah

  • @ArcaneEther
    @ArcaneEther 2 роки тому +1

    By extension, this explains the ScarVi bugs a bit. The games are just pumped out too quickly without sufficient bug checking.

  • @MishaKochubey
    @MishaKochubey Рік тому

    Great video, great channel. Subscribed!

  • @MaxOakland
    @MaxOakland 2 роки тому

    This is crazy. I didn’t know any of this was possible

  • @TheHuesSciTech
    @TheHuesSciTech 2 роки тому

    The funny thing is that the way SetNumImage is coded is an amazing portrait of a confused dev who is sort of reimplementing the modulo operator from scratch, rather just using the modulo operator. So even though that function is "correct" as far as I can tell, it could have been so much shorter and simpler:
    private void SetNumImage(UInt64 num, int digit, int dispIndex) {
    for (int place = 0; place < digit; place++) {
    var placeIndex = dispIndex + place;
    numImage[placeIndex].enabled = true;
    numImage[placeIndex].sprite = (CalcCode)(num % 10);
    num /= 10;
    }
    }

  • @Brahvim
    @Brahvim 2 роки тому

    UA-cam fetched me the perfect video today, I assume!

  • @NekiCat
    @NekiCat 2 роки тому +62

    Seems unbelievable they made such a simple mistake. That's probably somewhere near the top of a "falsehoods programmers believe in" list. Highly recommend reading through those, by the way.

    • @sarowie
      @sarowie 2 роки тому +1

      The professional cad software Altium Designer has this issue all over the place and that for over a decade.
      So... I don't mind it in a pokemon game.

    • @HenryLoenwind
      @HenryLoenwind 2 роки тому +4

      I would put this onto the list "things programmers micro-manage in a completely convoluted way". Instead of writing a format string for format() that matches their limited display space (which is exactly what format() was made for), they mix 3 different ways of handling a number. Although, the list "what happens when programmers combine alternative ways to do things instead of sticking to one of them" also is a good candidate.

  • @RGC_animation
    @RGC_animation 2 роки тому

    "If language is anything that uses a comma for a decimal place, assume that the comma is a dot."
    Fixed all of the problems!

  • @jmtradacc
    @jmtradacc 2 роки тому

    Babe, wake up. A new vídeo released

  • @Bobbias
    @Bobbias 2 роки тому +28

    This could have been avoided several different ways. There should be no reason to convert it to a string at all, but if they're going to do it, they should at least search for the localized decimal separator (you can query your locale to find out which separator is valid) rather than hardcode a specific character :/

  • @togden88
    @togden88 2 роки тому +1

    That suppressed laugh at 3:40 haha

  • @Known_as_The_Ghost
    @Known_as_The_Ghost 2 роки тому

    And then pimanrules fixes all of the bugs in the calculator, puts the script back into the cartridge, and has a working calculator!

  • @Wizzkidwas
    @Wizzkidwas 2 роки тому +1

    I'm quite proud I figured this one out on my own, shows my degree wasn't completely worthless lmao

  • @aurastrike
    @aurastrike 2 роки тому +1

    Man he confirmed he's doing Crystal for the ranking series! I hope you eventually earn enough from UA-cam that you can purchase a good computer specifically to run the simulations. That would be awesome for speeding things up!

  • @eideticex
    @eideticex 2 роки тому +1

    On one hand, I really don't blame them too much for failing to grasp localization as that is a genuinely hard thing to wrap your head around. On the other hand I am dumbfounded by the fact they used strings to store numeric values.

  • @FTGTrains
    @FTGTrains Рік тому

    I will say I understood nothing about what you were saying but I did watch the whole video

  • @HHHjb_
    @HHHjb_ Рік тому

    Nice upload schedule

  • @danielvan12
    @danielvan12 2 роки тому

    I’m glad to know that I’m not the only one who always has an Hbomb vid and that fastpass video glued to their recommendeds

  • @amberlee4536
    @amberlee4536 Рік тому +1

    "if anyone asks I got this legally, here is proof I own the games"
    Classic.

  • @invertedmind8937
    @invertedmind8937 2 роки тому

    it’s wild to me that you can just… do this. the tools are out there

  • @melody3741
    @melody3741 2 роки тому +1

    This issue highlights a massive issue with modern games - people still expect the same price for graphics that are orders of magnitude more detailed. All of that cost has to come from somewhere and it is most often small details.

  • @DigitalStarry
    @DigitalStarry 2 роки тому +5

    I started teaching myself programming three months ago and built a calculator on my own after the first month. My calculator had less bugs than this lol

    • @klobiforpresident2254
      @klobiforpresident2254 2 роки тому

      Just out of curiosity, how did you build yours? I think we've all done this as a freshman course / simple challenge when starting on our own, but the answers can vary, so I'm interested.

    • @DigitalStarry
      @DigitalStarry 2 роки тому

      @@klobiforpresident2254 I built it in Javascript. I would link to it but its in my github with personal info attached. I used objects to store the different values and operations, switch statements to get the computer to run the right calculation, if statement to check for empty fields or dividing by zero (which gives an error message unlike this calculator).

    • @underrated1524
      @underrated1524 Рік тому

      In GameFreak's defense, you probably didn't try to localize your calculator. Localization is where everything fell apart for the BDSP calculator.