Umm.. I think that I broke Chogath..
Pretty much the title.
https://cdn.discordapp.com/attachments/289937465333121034/316591083536777226/20170523_104303.jpg
Sorry about before, I had the wrong link x.x
Pretty much the title.
https://cdn.discordapp.com/attachments/289937465333121034/316591083536777226/20170523_104303.jpg
Sorry about before, I had the wrong link x.x
haha integer overflow baby
haha integer overflow baby
What exactly causes it anyways?
It is pretty technical, but long story short, an integer as a type in programming can only handle so much because it is a series of 32 1's and 0's with the left most of the 1's and 0's being used as an indicator for if it is negative or positive which effectively allows it to hold numbers ranging from -2147483648 to 2147483647. So adding 1 to the value when you have 2147483647 will have it be 2147483648 (which puts a 1 in the signed space, so it is now negative).
Should have used unsigned integers. XD
actually that wont work at all for HP math, which does have to go negative upon death.
(4 bit math for example)
Say you have 3 hp, which is 0011 you take 15 damage, which is 1111 (as an unsigned 4 bit number) result is -12, which you cannot represent with unsigned integers
-12 in a signed 4 bit number is 1100. Your SIGNED int will interpret this as 12 hp, because it takes the sign bit (currently 1) as a positive value.
Meaning your hp will go negative, but it can't, code puts in the 2's complement of -12 into registers, your unsigned int in code reads this as a positive value, you now died but actually have positive hp again.
It doesn't have to. Death could be triggered when damage taken >= current HP. You don't have to have unsigned at least. It'd just be a validation check more or less before damage gets applied.
Yes that would certainly work. Just explaining why it isnt as simple as changing the data type to unsigned
That is most certainly fair. Developer by trade so I tend to go into analysis mode a lot. :)
That is most certainly fair. Developer by trade so I tend to go into analysis mode a lot. :)
On the other hand, I can see why it's just not worthwhile to change the code to use unsigned integers, from a developer's perspective. Doing so after signed integers were already integrated into the code would most definitely cause a LOT of bugs, no matter how much they tried to prevent it. From death recap to people potentially living through things that should kill them. There's a lot of things that can go wrong. As a technicality, however, unsigned integers aren't impossible to use. As a plus to signed integers, however, you can make the users hp -9999999 and show up as 0, making it basically impossible for anything like healing out of death to occur. Makes for much simpler beginner friendly coding (and a lot fewer lines of code and exception handling).
It doesn't have to. Death could be triggered when damage taken >= current HP. You don't have to have unsigned at least. It'd just be a validation check more or less before damage gets applied.
If you want shields to not stop you from dying sure
actually that wont work at all for HP math, which does have to go negative upon death.
(4 bit math for example)
Say you have 3 hp, which is 0011 you take 15 damage, which is 1111 (as an unsigned 4 bit number) result is -12, which you cannot represent with unsigned integers
-12 in a signed 4 bit number is 1100. Your SIGNED int will interpret this as 12 hp, because it takes the sign bit (currently 1) as a positive value.
Meaning your hp will go negative, but it can't, code puts in the 2's complement of -12 into registers, your unsigned int in code reads this as a positive value, you now died but actually have positive hp again.
Can be worked around.
Make a boolean IsDead
If damage>= currentHP then boolean isDead=true, death is triggered, death timer begins
End of timer death timer thread, isDead=false, respawn is triggered. Though a boolean isn't necessary, it's handy.
NEEERRDD
jk good explanation fam
The last bit of a signed value is the sign bit. If it becomes 1, it becomes negative. An unsigned int can use the last bit as a positive value, and show a larger positive value than an unsigned int with the same number of bits.
In binary:
1-0-0-0 read as an UNSIGNED int is 8. 1-0-0-0 read as a SIGNED int is -8.
If you have a value which is supposed to be positive, say 0-0-1-1, and keep adding to it, eventually it will need to use the 4th bit so show the answer. If in your code you did not force the value to be unsigned, as in always positive, it will become negative once the value is so large it goes into the last bit.
[{quoted}](name=Yosuke Apperu,realm=NA,application-id=3ErqAdtq,discussion-id=WIkzxAON,comment-id=00010000,timestamp=2017-05-23T15:20:35.021+0000)
What exactly causes it anyways?
It's how things like health are programmed.
Your screenshot makes it apparent that numbers like damage, healing and health are programmed with 32 bit signed Integers.
32bit signed Integers have a limit of 2,147,483,647 and if they exceed that number they "overflow" which is what happened to you there.
this thread makes me laugh... not at the topic... but because this thread has the highest concentration of intelligent posts and arguments i have ever seen in 4 years on these forums.
this thread makes me laugh... not at the topic... but because this thread has the highest concentration of intelligent posts and arguments i have ever seen in 4 years on these forums.
I totally agree, though I actually really enjoy it :)
Vandril had a video where his health had become so high it reset to 0 he was playing vlad
Vandril had a video where his health had become so high it reset to 0 he was playing vlad
how is that even possible?
just with standart items? vlad doesnt have an infinite health stack mechanic.
Stoneplate stacking
Stoneplate stacking
the passive and active on the item are unique. was it stackable on the pbe at some point?
no just cd reset lets the effect stack.
Jesus.
if you think this is high, try it with a cinderhulk equipped lol
What's the problem? Everything looks normal.
what do you mean broke? that's a normal cho on solo queue
Ugh... just all around bad programming. You always wonder when you put a variable whether the client will try to break it. Then you place a limit.
to be fair to riot, when they made that code, no one had easy infinite health stacking or a practice tool
And this can't possibly happen in a real game, so not a real issue
It doesent matter, people can get enough health to get about 3k true damage, enough to one-shot most champions. Its just nobody plays cho except for the mains.
Fun Fact with gargoyle stoneplate you can have a permanent shaco clone.
wot
Shaco's clone gets the same passive effects from items as Shaco does.
ik that but does that mean shaco clone won't vanish with gargoyle?
shaco clone "vanishes" by taking 10,000 true damage at the end of the duration. so if it has more health than that at the end, it survives its own death
ic....
is that even remotely viable? To get it to work you'd have to clone while your stoneplate is active right? Since clone can't activate stoneplate on its own.
not to mention you need to have 5k hp on shaco and i am not sure it is for the best
It isn't. You can't control the clone at all almost, it just is tethered onto you and will attack whatever you right click.
It's not bad programming. HP has to go negative every time someone dies. It would actually be more spaghetti for them to try to use unsigned ints for HP math. With unsigned ints, every time someone dies, they would have to register that there was overflow error and the result should have been negative but cannot be represented with unsigned ints. Or verify that the result of any hp calculation wont be negative
Would you rather infinitely stacking hp in the billions sometimes overflowing into the sign bit and going negative (cannot ever happen in a real game)
OR
sometimes when you kill someone their HP goes to the positive result instead of the negative result because the signed ints cannot represent negative values. So they live with the positive version of their supposed to be negative hp, if they missed that the calculation resulted in a value you cannot represent in an unsigned int value
There are other fixes though. I have put into my own games a maximum hp possible, and basically forcing a roof onto hp. So you cannot stack so high it will overflow. But then every time you increase max hp you have to check if the result is over the roof and just assign the roof to your hp if it is over. Seemed to work for my stuff in Unity but it's far from a game of this scale (so any fuckin hack works good enough for me really)
Stop using "int". Just, no. Stop. Please.
Doesn't it just mean integer? Pretty sure in a lot of programming languages, "int" is used for some integer value.
ya I'm kind of confused by his comment too. "int" is the keyword for integer in C, C++, C#.. the only time I've had to use the entire word "Integer" is in java, android studio
Ugh... just all around bad programming. You always wonder when you put a variable whether the client will try to break it. Then you place a limit.
I mean, you shouldn't say crap as a non-programmer. This is an inherent limitation of HARDWARE, not software. Pretty much every computer (except trinary computers which basically see no use, and have their own limitations anyway) have that same issue built in.
I mean, you shouldn't say crap as a non-programmer. This is an inherent limitation of HARDWARE, not software. Pretty much every computer (except trinary computers which basically see no use, and have their own limitations anyway) have that same issue built in.
*roll eyes
I have a bachelors in Computer Science and 13 years in the field.
And yes the issue can be fixed in the coding (AKA software).... with a limit that is checked.
*roll eyes
I have a bachelors in Computer Science and 13 years in the field.
And yes the issue can be fixed in the coding (AKA software).... with a limit that is checked.
The manner of writing you used didn't indicate at all that you any experience in the field. Let alone 13 year+ a bachelor. In this day and age, however, I really do wonder who would hire people with only a bachelor? Not intel, hp, or any big company for that matter.
Nonetheless, what you say is true. You can make it check for a limit. Oftentimes, doing so is just ridiculous for values that won't be reallistically reached. It's just clunky coding that will slow threads down. How often are you going to check? Every single additional process added to the threads makes for more risk, slower running programs, and shivers potentially skipped threads.
32-bit programs op. Unless it has a hard cap, the only other way to "fix" that is to upgrade to 64-bit. Otherwise that's normal, it's not exactly broke. Just no longer able to handle the math.
Though curious how that happened with only 22 stacks and RoA(warmogs gives more hp). Because it's impossible to trigger with just that. Which leaves me to believe this is fabricated, or an old bug that was long patched.
Though curious how that happened with only 22 stacks and RoA(warmogs gives more hp). Because it's impossible to trigger with just that. Which leaves me to believe this is fabricated, or an old bug that was long patched.
Because you can reset the cool downs of items in practice tool, and gargoyle stone plate stacks with itself over and over again refreshing the buff. It's not really possible to be an old bug that was long since patched because gargoyle stone plate hasn't been out long lol
Notably it will never be an issue even in URF either that this could happen, as Stoneplate, even with the 80% item CDR of URF, can't overflow the needed CD.
This is exclusively a practice mode for fun thing to have infinite HP.