Can I change the integer limit?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MaaaxiKing

I am working on a Tycoon game and in such games, it is possible to earn a lot of money until more than decillion. The positive limit of the 64-bit integer is 9.223.372.036.854.775.807 and that is way too small. So can I go a different way or even change the limit which is what I prefer?

:bust_in_silhouette: Reply From: VarionDrakon

The only thing you can do is change the type of “bool” to " int " or something like that. How much the variable allows you to fit in itself, so much and can, no more. If the maximum number is exceeded, then the count starts from the minimum possible number in the variable or from zero.
Of course, there may be ways, but I have not yet met this…

:bust_in_silhouette: Reply From: Dave Galvin

A couple possibilities:

  1. Dollars works up through the end of the quadrillions. Use one var for dollars and another for quintillions.
  2. Round and change the unit. E.g., 7,341,345,663,167,842,342,654,571,001,453,251 could be represented as 7,341 nonillion dollars; possibly 7,341.345 under the hood. By the time you’re player is up in this range, they’re not likely to care about a measly quintillion or two.

It is done in the asset which was linked in the answer by jgodfrey.

MaaaxiKing | 2020-12-28 19:08

:bust_in_silhouette: Reply From: jgodfrey

You have a few choices:

  • If you’re using C#, you could use the Big Integer type

  • Maybe try this big number asset for gdscript (I’ve never used it)

  • Roll your own big int handler (probably a bad idea)

I’ve also seen the asset but the website looked unserious to me but now, after I’ve read the description, I think that this is exactly what I want. Thank you!

MaaaxiKing | 2020-12-28 16:31