• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Handling Big Numbers



Hello reader, I am currently making an incremental idle game with Game Maker Pro (Mac) I have come upon a problem where once a value reaches 2 billion or so, the object that is assigned to draw the value on screen gives us a negative number. For example, if your money is at 3 billion, it will show up that you have -1.4312235 billion money. I went to debug mode to see if it was a problem with the actual value, but it would show up as 3 billion perfectly fine there. I don't know if it is a drawing problem or a scripting problem, but I need help to continue developing my game.

I've also downloaded GM-GMP from http://www.maartenbaert.be/game-maker-dlls/gm-gmp/ . I don't have much of an idea on how to use it, so any help on this would be appreciated.


this is your problem, a real value in game maker is a signed 32 bit integer, the limit is just over 2 billion. There area a couple ways to handle this, such as the int64() function which will bring your limit to something like 9,223,372,036,854,775,807 (don't quote me on that, I jsut did a quick gogole search) . Very useful information can be found in this post which lists the limits and issues with using int64. There are many ways to handle the issue, but this is one of the easier.


The number 2,147,483,647 (or hexadecimal 7FFF,FFFF16) is the maximum positive value for a 32-bit signed binary integer in computing. It is therefore the maximum value for variables declared as integers (e.g., as int ) in many programming languages, and the maximum possible score, money, etc. for many video games.


You could split the number into parts. For example, you could separate the billions and the ones into two separate variables.

if money_ones>=1000000000
if ones<0

when drawing the money, you can draw:

string_format(money_billions,0,0)+string_replace_all(string_format(money_ones,9,0)," ","0")