Lost Marbles

Found the bug preventing the 9b shot... whoops

10 months ago | [YT] | 212



@fearedjames

For those who don't understand code. I have no idea what the context is, but basically, this code handles charged shots, I presume activated in a batch that sets off all available shots. The code gathers a list of all available marbles, then one by one fires them based on how much they have managed to charge up shots. The problem is, in C#, there is no handler for integer overflows as there is in a language like Python. So here he has called the value, that is presumably stored as an undetermined type value (ie a var) and executed it as a 32bit integer, which has a max value of 2.1 billion or so. Doing this would make the value fire as infinite, which would not properly apply math values and probably just throw an error on his background debug console. Either that or it would only read the first 32 bits of data, which most likely are basically 0, although I'm pretty sure C# shouldn't do this. Basically, the bug is the (int) in the at the end. Theres multiple solutions ofc for this, the easiest being just calling the number as a long, which is a 64 bit integer, which has a max value of 9,223,372,036,854,775,807, and I imagine if 9 billion was higher than expected, the long should be virtually impossible to reach.

10 months ago (edited) | 25  

@trilecolorracing_TLCR

Uh… this is the first time you shared a behind the scenes (code revealed)… so funny…

10 months ago | 30

@ManipulAltercarity

Cyan would've won that game, but the bug said NO and just poofed that hard-worked 9B. Shame.

10 months ago | 9

@The_Untitled_Knight

Cool I wasn’t sure how you were making it and was assuming you were using a physics engine wut variables but no your coding it all…Nice

9 months ago | 1

@Julio_cube

I'm not a programmer so idk what is this

9 months ago | 1

@ManuelMayorga-kc5sm

no en igles

10 months ago | 1

@bencarelvin

This maybe can be fixed on

9 months ago | 0

@MrLandShark55_55

Well don't fix it, or the rest of the script will stop working entirely.

10 months ago | 8  

@Vrooto

touch it and the entire thing will stop working.

10 months ago | 1

@aefad

When in overflow

10 months ago | 1

@deltamico

Why not iterate directly over marbles without creating a new list though

10 months ago | 3

@modulusshift

Uh, is it the int typing? So the max is INTMAX or like 2 billion or so?

10 months ago | 5

@Kolby_6310

I think that 9B ball was going to be a trillion ball

10 months ago | 1

@JustinSniff

i dont understand code so i would know what that meant

10 months ago (edited) | 1

@Mr_Fluffy_Paws

Which coding language is this?

10 months ago | 2