 In episode 1.5, you're going to be learning how to create massive numbers like these. Now if you don't plan on having massive numbers, I would still watch all the way through because there's some helpful tips that will help you out throughout the entire series. Hello guys, Crypto Grunts here. Welcome back to another Unity idle game tutorial video. This is episode 1.5 and today we're going to be working with Break Infinity. If you enjoyed this video and if you learned something new, make sure you smash the like button, subscribe to my channel and consider turning on the notifications for future videos and live streams. Anyways, let's get on with it. So basically, if you haven't heard of Break Infinity, it's a third-party number class and is used for really large numbers. So with doubles, you can get to a limit of E308, which is 308 digits and that's in scientific notation, and Break Infinity.cs can get really high. Now, obviously if you got really advanced, you could learn to make your own, but they're pretty complex and there might be others out there. This is just the one I'm most familiar with. So this is the original GitHub. However, I'm going to be providing the scripts in the description below because I made some modifications that will be pretty important later on in the series. Okay, so once you have access to these two scripts here, and yes, you will need both of these. So they're pretty important. What you can do is copy this entire script. So this is the first one right here and it'll be in the first comment. So highlight all of it and copy it, control C and go to your scripts and create a new script called Big Double. Open that up, highlight all that and paste it and then save it. Okay, the next one, it's the shorter one. You want to highlight all of this, copy it and go to scripts, create a new C-sharp script and call this Big Double Editor. So this is basically used to display the values, your variables in your scripts right here in a pretty clean way. And you'll see this once we start adding these in. Cool. So we're all set for Big Double and using it as very self-explanatory. This is not mandatory. If you're not expecting bigger than e308 numbers or anything, or you're just not afraid of that at all, you don't really need to use this class at all. However, it could be handy if you're going to go big. So now all you got to do is import a certain namespace. So we're going to do using break infinity. So now you have access to the Big Double struct, which is a basically a class, but it's a special, but it's pretty different. So now we can just replace this double with a big double. So now this variable right here get really big. I can show you guys real quick. So what we can do here in this update method, we're basically just going to do data dot flasks. And we're basically are multiply this by 100. And we're going to print our data flasks in the console. Actually, I forgot to delete this from the last episode. So now this should multiply really fast. And this will update every frame. You can't multiply a number that's zero. We're going to set this data dot flasks. Actually, yeah, we're going to set it to one in here in the start method. And now it should multiply properly. There you go. Oh, you see, there you go. It's past e 308. And it'll just keep growing like that. So again, if you want big numbers like these, this would be a good one for you. Oh, yeah, there you go. It's growing. So now the thing here is that math is differently here. Basically, let's just create a double variable here. Let's just call this flasks double. Alrighty, so now if we set flasks equal to let's do to 10 to the power of 300, which is 1 e 100. So what we're going to do here is type big double dot pow, and we'll just do and we'll just do 10 to the power of 100. Actually, let's go big, let's do 55,000. Okay, so now the thing here is that this won't work for a double, a traditional double. So if you go to flasks double, and you do the exact same thing, big double dot pow, even something small like one to the power of two, it's not going to work. You cannot convert a big double to a target type double. So this is a method right here, like just like this right here. And it's returning a big double. So for this break infinity class that we added, basically it looks something like this. Okay, and then it just has its arguments in here. It looks just like that is we're returning a big double here. Now a solution to this is that you could cast it as a double like this where it's just where you put the variable type, and then wrap it with parentheses. However, if we did it to here with this really big number, we're going to get some issues because this number is way beyond the capacity for this double. And that will make it infinity, which is a big no, no. So in order to fix this, you want to do something called math. This is in the system. So once you add that, you need to add the system namespace like that. So you can use math for big doubles. You can use math F, which is for floats. And that's provided by unity. You can use that this math F for doubles and big doubles. So if we created a flow here, flash float, and we do data dot flash float, and we're going to set that equal to math, which is the double version, and you do one to the power of two, we're going to get the same issue here. And once again, you could solve this either by casting it to float. However, this can again cause issues in certain circumstances. And you can also use big double dot pow. So if you want more detailed information on using the math equations and stuff, I'd highly suggest you to check out this Reddit post here. All the links will be in the description below. I'm just going to delete all of this unnecessary stuff. Okay, so I ran it and I just noticed that infinity e 1664. So the reason why, first of all, it's displaying like this is because the class that I provided you guys, it automatically does scientific notation. And obviously we'll be able to change this in the future. But now the thing is that it's basically two variables. You have the mantisa and exponent, I'll teach you guys this once we start the scientific notation episode. But basically just know that infinity and 1664 here, there are two separate numbers. So the reason why this is infinity is because we're still using this math dot pow. And now this cannot handle such a massive number. So if we change this to big double dot pow instead, it should work just fine, because it's compatible with that. There you go. It looks great. But now if you were to go back to this math here and did, for example, one or 10 to the power of 20, it's going to do this just fine because it's not greater than e 308 1.79 e 308, which is doubles maximum limit. And see, it works just fine. So pretty much only went wrong when this was too big right here, this math dot pow, when this 10 to the power of 55,000, it's too big for math to handle. So if we take at the number class here, you can see as I was explaining earlier, there's mantisa and exponents, it's basically working in two different variables. Now, for new people, this may be really complicated and difficult to read. However, if you want to see all the features that are, you might as well check out some of the code. So like, for example, here, you can set you can set number equal to pi e 10. And you can check to see if a number is not a number, which is NAN, you can check to see if it's positive infinity, negative infinity, or just either or you can convert numbers to double to string, you can cast, you can do absolute. So it's the bars here, where basically you can just make a negative number positive. That's what absolute is. You can make a number negative. You can round up to the next whole number. You can round the number down ceiling where you round the number up. It's pretty much the same thing. You can truncate it, which is where you cut off the decimals. You can do add. So you can simply just do is data flash equals add big double dot add. And here you put a left and right. So let's just do data flash here. And let's add 10 to it. So what we'll do, it's going to, it's just going to be zero plus 10. And it was like 10. However, you can also just do plus equals 10, or you can do equals data flash plus 10, like that. They just provided that method for other uses. So then you also have to subtract, multiply, divide. Oh yeah, this is some of the stuff that I added here where you can cast it, which is why I show you earlier where you could do the like, for example, parentheses and floats. I added that. I'm not sure why it wasn't there originally, but it was, wasn't that hard to add? Yeah, these are all the operators that uses. You also have like the greater than greater than or equal than less than or all that stuff. You have max min. So basically you can check to see, take the maximum or the minimum of two numbers. You have log 10, which is very important for certain parts of the game. You also have like the power, which I used earlier, how, and yeah, the list just goes on. You also have like square roots, square roots, sine, cosine, tangent. Yeah, you got so much stuff here. So if you just want to take a look at that, make sure you do that. It may be a little difficult to read at first, but you, as long as you can read the method names here, they should, you should be able to understand what they actually do. All right, guys. So I know this was a pretty complicated episode for some people, but again, you don't have to use this. If you really want to go ahead, it may help you out in the future and would be nice to learn something new. If you take a look in this right here, but yeah, if you enjoyed this video, and if you learned something new, make sure you smash the like button, subscribe to my channel if you're new and turn on the bell for future notifications of videos and live streams. Anyways, have a great day and night, everyone. I'll catch you guys in the next one. Thank you guys for watching. Peace.