Guild Gold cap?

General Discussion
if there is one, what is it?
if i recall it is the same as the player gold cap which is 1 million gold.
Actually i think player cap is 999,999... why they dont give the extra 1 gold i will never understand
09/22/2011 05:13 PMPosted by Bakkafgar
Actually i think player cap is 999,999... why they dont give the extra 1 gold i will never understand


I think it was a programming reason, or something.
I'm sure Google will tell all.
09/22/2011 05:13 PMPosted by Bakkafgar
Actually i think player cap is 999,999... why they dont give the extra 1 gold i will never understand


That extra one copper would force them to allow another digit in the int. Rather than 6 spaces, the integer would have to hold data for 7. It's an efficiency thing.
09/22/2011 05:14 PMPosted by Karat
Actually i think player cap is 999,999... why they dont give the extra 1 gold i will never understand


That extra one copper would force them to allow another digit in the int. Rather than 6 spaces, the integer would have to hold data for 7. It's an efficiency thing.


I love you. <3
Guild gold cap, not the player.
The guild gold cap is 999,999g 99s 99c which is the same as the character's gold cap.
I don't think the Gold Cap is in place to save memory/storage room. I'm sure it's just arbitrary. The compiler is allocating more than enough for space to hold over 999,999.9999.

In Binary you can see there is no extra bit need to go from 999,999 to 1,000,000.
11110100001000111111 - 999,999
11110100001001000000 - 1,000,000

Assuming TotalPlayerGold is stored in one variable and not 3 separate like PlayerGold, PlayerSilver and PlayerCopper an Int32 will allocate more than enough room to not need to cap the gold at 999,999.9999. If stored as seperate Int's this is even less of a problem.

Int32 should hold a range of 2^32 or 4,294,967,296.
With the sign bit taken into account it's max is 2,147,483,647 and it's min is -2,147,483,648.

An Int64 is Signed: From −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, from −(2^63) to 2^63 − 1

I don't really know how the data for PlayerGold is stored.

But even as a floating point variable it has a massive range.

wiki:
On a typical computer system, a 'double precision' (64-bit) binary floating-point number has a coefficient of 53 bits (one of which is implied), an exponent of 11 bits, and one sign bit. Positive floating-point numbers in this format have an approximate range of 10−308 to 10308, because the range of the exponent is [−1022,1023] and 308 is approximately log10(21023). The complete range of the format is from about −10308 through +10308 (see IEEE 754).

Just some thoughts. Any computer geeks out there that have some insight?
Kez is correct. Gold is stored as an integer number of coppers (and is formatted into gold silver etc only for display). Anything over 214k gold = 2^31-1 copper (the pre-Cata gold cap) required them to move to a 64-bit storage type. Choosing to make it 1M gold - 1c is just either a humorous or historical reference to the fact that hard caps are usually 1 less than a big round number.

Now that they have made it a 64-bit type, they could make it anything up to about 100 trillion gold before they would need to expand it again, but they could arbitrarily raise it as required to any value up to that with no technical difference.
Actually i think player cap is 999,999... why they dont give the extra 1 gold i will never understand


I think it was a programming reason, or something.
I'm sure Google will tell all.


Don't think it could be a programming reason. 999,999g comes out to just under 10b copper. Since the old limit was MAX_INT (assuming 32 bit int). This one seems designed more for human readability reasons or something, as that's nowhere near the max copper for a 64 bit quantity.

Another possibility is they didn't make your copper a 64 bit quantity itself, but if they had a flags 32 bit field next to it with a handful of unused bits so they combined the 2 fields into 1 field, and for your copper just mask out the high 28-29 bits (since this new cap only needs 3 bits more, 2 if they stopped using a signed quantity (which they'd need to do for this sort of approach).

It's just hard to predict, but this constraint feels like a policy constraint (1m or so is enough) rather than any computational constraint based on the data type used to store the copper.

Join the Conversation

Return to Forum