GTA V $ 2,147,483,647 Glitch Could Wipe Your Cash Away

Strazdas

Robots will replace your job
May 28, 2011
8,407
0
0
Lightknight said:
Remember when we were kids and they'd just cap the maximum dollar amount somewhere? Those were good days.
yeah, i remember the 999.999 limits in games when game woudl stop accumulating above that. those were good days indeed.
also iremember when somoen moded a game to make people gain enormous amoutns of EXP in a MMO with no level cap. result was so much health increase from leveling up that health became negative. NEGATIVE HEALTH. didnt make you immortal though as once you got hit it rilled back over into very large amount. still that was fun experience.

thiosk said:
I keep telling people that cookie clikcer [https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CC4QFjAA&url=http%3A%2F%2Forteil.dashnet.org%2Fcookieclicker%2F&ei=lfpKUvCWHPKgyAH-_YCADQ&usg=AFQjCNGg5L6LX4KNcMQQBn-_0C5CirMvmg&sig2=_Dp_UQxVX6Zb14-Nfygyaw&bvm=bv.53371865,d.aWc] is better.

Now you'll believe me.

It can handle trillions.

Millions of trillions.
Noooo! this is too addictive! posting links to cookie clicker shoudl be bannable offence. it ruins lives!
(i am of course joking).
 

Jamash

Top Todger
Jun 25, 2008
3,638
0
0
EightGaugeHippo said:
Can someone please explain how I can make enough money to break the game without cheating?
Insider trading on the stock market.

For example, in one of the random encounters where you help someone catch their flight, if you get them to the airport on time they'll give you a stock tip, which, if you invest all of your money on it will give you something like a 500% return.

Also Lester's assassination missions affect the stock market by lowering the prices of your target's company and raising the value of it's competitor, so if you invest your money wisely before those missions, you can make an absolute killing by selling the competitor's shares when they've gone up after the mission, then buying up all of the shares of the company who's CEO you've just killed at a vastly reduced price, then selling those again when the prices return to normal.

Then there's the BAWSAQ market which is influenced by the community (on both the 360 and PS3), who in the past week or so, have all made a concentrated effort to only buy Hawk and Liddle and Pi&#223wasser stocks, which has driven their prices up by an insane amount (e.g. H&L was $0.74 a share when GTA V launched, it's now over $15.00 a share).
With this community driven scheme, as well as everyone agreeing to put their money into specific companies in order to drive up their prices, they've also all agreed to sell their stocks at the same time, which will ensure everyone gets the maximum return but also crash market and make the prices plummet.

The key to making billions is to save all the money you make from heists and only invest it shares in companies which are scripted to increase through certain missions or activities.

The people who made so much money that they broke their game probably didn't do any of Lester's assassination missions or any of the stock market related random encounters until they'd beaten the game and had the maximum amount of capital to play the markets with, which can easily be multiplied by many hundreds with savvy stock trading and insider knowledge.
 

Pixelspeech

New member
Sep 30, 2013
73
0
0
shameduser said:
Well, I'd assume someone who works in QA would be familiar with similar bugs in other games and it's not unreasonable to assume that players could accumulate that much money. Maybe it was found late in development and a work around wasn't feasible so close to launch.

I was thinking about how you would get around this and maybe have a second variable that holds all money over the limit but then displaying the amount wouldn't be easy sense you can't just add the two together and display that. I'm not super familiar with programing so it could be really easy.
This is a very real possibility, yeah. I'd personally just put a limit to the amount of cash people can have in the game, since there is nothing you could spend this amount of cash on anyway.
 

Antari

Music Slave
Nov 4, 2009
2,246
0
0
This is final proof as to how much care and attention they are putting into game making these days. I haven't seen this sort of math bug since 1982 with MajorBBS' Galactic Empire. It is one of the oldest bugs on the block. And how did they miss it? They didn't even bother testing it. Or atleast whoever they had do the testing sure as hell wasn't a professional.
 

frobalt

New member
Jan 2, 2012
347
0
0
So Rockstar spent a ton of cash on making this game but didn't have a developer that knows what the limit to a 32-bit signed integer is?

It's a programming basic. All they needed to do was put a check in when increasing cash that will prevent it going over this limit.

The worst thing any programmer can do is say 'nah, the user won't do that, so no need to put a check on it or anything', because the user will invariably do that.
 

Retardinator

New member
Nov 2, 2009
582
0
0
And just a couple days ago I was reading about the year 2038 problem and the thought of this bug popping up in GTA hit me. Ridiculous.
 

Kinitawowi

New member
Nov 21, 2012
575
0
0
NLS said:
Why are people surprised? 2,147,483,647 is the highest you can go with a signed integer.
Hell they could almost try to make that a selling point for the next-gen version of GTAV "Now with support for a maximum amount of 9,223,372,036,854,775,807 $" since that's how high you can go with 64bit.

People will always say "oh why didn't they think of that", but did you know that a lot of computer clocks and systems will have major problems when time hits 19 January 2038 because of the exact same problem?
Yeah, but as soon as it tips over to -$9,223,372,036,854,775,808 somebody will hit that and start bitching "But why didn't you go 128-bit?! These programmers are cretins!"

They have to draw a line somewhere.
 

pandorum

New member
Mar 22, 2011
249
0
0
TizzytheTormentor said:
Highest I have now is 200 million on Franklin (thank you assassination missions) and am going around buying places because why not.

I don't think I will get 2 billion anytime soon (unless I am just too awesome online)

Just did another assassination mission and got a lot more money, but far from a billion yet, saving up for the movie theaters and the golf course, as well as the expensive planes and boats (those don't disappear right?)

I have a question, if I buy a plane and destroy it, will it be in my hangar again or is it gone for good?
Crashed mine found it in hanger after saving game.
 

Poetic Nova

Pulvis Et Umbra Sumus
Jan 24, 2012
1,974
0
0
Same glitch exists in the very first Borderlands game, the amount of money exceeds the 32 bit integer which means all is lost when you spend even one buck.

Could have been easily avoided with adding a money cap.
 
Mar 5, 2011
690
0
0
Pixelspeech said:
shameduser said:
Well, I'd assume someone who works in QA would be familiar with similar bugs in other games and it's not unreasonable to assume that players could accumulate that much money. Maybe it was found late in development and a work around wasn't feasible so close to launch.

I was thinking about how you would get around this and maybe have a second variable that holds all money over the limit but then displaying the amount wouldn't be easy sense you can't just add the two together and display that. I'm not super familiar with programing so it could be really easy.
This is a very real possibility, yeah. I'd personally just put a limit to the amount of cash people can have in the game, since there is nothing you could spend this amount of cash on anyway.
Maybe the extra money over something like two billion could go to an off shore account like in Payday 2. Kinda late too add a feature like that but maybe on PC, PS4 and Xbone versions.
 

4RT1LL3RY

New member
Oct 31, 2008
134
0
0
Still using 32-bit signed ints for money ugh. Heck, unsigned int would up it to 5.4 billion limit and negative amounts of money in game shouldn't happen. Developers need to splurge on 8-byte ints, aka long ints. 9,223,372,036,854,775,807 is a sufficiently large number with a small overhead that prevents the problem. Or use Doubles. Everything supports Double any ways and it has decimal places.
 

Buzz Killington_v1legacy

Likes Good Stories About Bridges
Aug 8, 2009
771
0
0
arc1991 said:
I'm no expert in binary department...but why will computer clocks and systems have major problems o_O it's just a number, 19/01/2038...

Brain. Hurts.
Unix and Unix-like systems store the time as a signed 32-bit integer counting the number of seconds since January 1st, 1970. The maximum positive number you can store in that format is 2,147,483,647...which runs out at 03:14:07 on January 19, 2038. At 03:14:08, any system still using a 32-bit integer will roll over into negative numbers, which the system will interpret as December 13th, 1901. Bad things will happen. Probably nothing catastrophic, but you could get things like your credit card company sending you nasty messages because you haven't made a payment in over a hundred years.

Newer systems use a 64-bit integer, which won't run out for several hundred billion years, but there's enough legacy code and hardware out there for 2038 to still be a problem.
 

TechNoFear

New member
Mar 22, 2009
446
0
0
NLS said:
9,223,372,036,854,775,807 $" since that's how high you can go with 64bit.
No, like the GTA coders you forgot to use the unsigned version....

The C99 standard defines the max size of a signed 64 bit int (LLONG_MAX) as 9223372036854775807 (or greater) and unsigned 64 bit int (ULLONG_MAX) is 18446744073709551615 (or greater).

However these values are up to the individual system implementation.

http://www.cplusplus.com/reference/climits/
 

TechNoFear

New member
Mar 22, 2009
446
0
0
frobalt said:
So Rockstar spent a ton of cash on making this game but didn't have a developer that knows what the limit to a 32-bit signed integer is?[/quo

It's a programming basic. All they needed to do was put a check in when increasing cash that will prevent it going over this limit.
Ummm...no, that won't work in C++ code.

The problem would not have been the actual variable holding the cash value, it would have been one of the thousands of functions / methods the variable was passed into and/or later returned from.

All a programmer would have to do is forget a 'u' (ie write the normal, used for 99.9% of numeric variables type 'int' instead of type 'uint').

When that function (where the coder wrote 'int' instead of 'uint') was called the value it was passed was changed from an unsigned to a signed (and your total cash became negative without anything being added or subtracted).

Non coders appear to think that this bug could occur in just one line of the code.

But in reality it can occur in thousands of lines of code, in the millions of lines of code that make up a game like GTA 5.

4RT1LL3RY said:
Developers need to splurge on 8-byte ints, aka long ints.
LOL! You just made the same mistakes!

You mean unsigned long int and long int is 4 bytes, not 8 bytes ('long long' is 64 bit).

Not to mention that 'int32', 'long', 'long int' and 'int' are all the same size (32 bit) in most C++ IDEs. (I have not used an IDE in the last decade where they were not.)
 

Steve the Pocket

New member
Mar 30, 2009
1,649
0
0
Gives whole new meaning to "breaking the bank"!

I don't understand why they used a signed integer. As far as I know, it's not possible for your cash to go into negatives naturally. You can go into debt, but it doesn't affect your cash-on-hand variable. $5 billion is a good round number for a cap. They could even have an achievement for it, maybe call it "The Richest Man Alive" or something.
 

frobalt

New member
Jan 2, 2012
347
0
0
TechNoFear said:
frobalt said:
So Rockstar spent a ton of cash on making this game but didn't have a developer that knows what the limit to a 32-bit signed integer is?[/quo

It's a programming basic. All they needed to do was put a check in when increasing cash that will prevent it going over this limit.
Ummm...no, that won't work in C++ code.

The problem would not have been the actual variable holding the cash value, it would have been one of the thousands of functions / methods the variable was passed into and/or later returned from.

All a programmer would have to do is forget a 'u' (ie write the normal, used for 99.9% of numeric variables type 'int' instead of type 'uint').

When that function (where the coder wrote 'int' instead of 'uint') was called the value it was passed was changed from an unsigned to a signed (and your total cash became negative without anything being added or subtracted).

Non coders appear to think that this bug could occur in just one line of the code.

But in reality it can occur in thousands of lines of code, in the millions of lines of code that make up a game like GTA 5.
I am a coder and I know how easily this could have been checked.

Cash is likely a global variable somewhere. Even if it's not, there's only going to be 1 instance of it in the system. Rather than change this function directly using a: money = newValue or money += amount sort of method, what they should have done is have a functions for various ways of updating cash and have the check in there.

Then, they could have used one of these functions to update cash.

I understand how this sort of error could be put in the code, but it's not even close to being a new error within the gaming world, so someone should have figured out a way to prevent it by now.

It's as simple as doing a:

UpdateCash(newValue)
{
if (currentCash < maximumCash)
currentCash = newValue;
}

and then only using this function to update. Or something similar.

Any company using a good programming practice wouldn't have a cash variable declared on start-up and then simply passed through to various methods as a reference for update, they'd store it globally somewhere. It's the smartest way of doing it.
 

MrGalactus

Elite Member
Sep 18, 2010
1,849
0
41
$1.6 billion
How the absolute fuck?

I've finished the game and lost money almost every time I've hit the stocks, including Tinkle. How, other than the stock market, can anyone make over the 20 million or so you end up with? I figured it was just a post-game-completion reward plateau kind of thing.