How do I deal with large variables

  • Hello. I am currently making an incremental game and I seem to run into a problem when the numbers get quite large (10^18 or so) Just wondering if there's another way of going about this. Thanks

  • Well depending on what you want to do with so large numbers, but best way to store them would be in a text variable, because they can hold more characters then a number.

  • Ill give it a try.

    Just wondering if this is even something i should be having trouble with. An example of what im doing is along these lines

    Upgrade1Level>1000 - Set Upgrade1Multipier to 10^18.

    That seems to make the text that displays that number freeze

  • I am not sure how construct keep the numbers, but its probably as singed integer or long, which can hold numbers between –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, if you want anything larger than that you will have to keep it as a text(string) or somehow find a way to shorten it, because math operations with strings are rather hard.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hmm yeah. I might have to stick with a 'MoneyThousand ' MoneyMillions' 'MoneyBillions' typw thing with multiple variables

  • Also Ive noticed while running in debug that once the inspector displays the large variables as something like 9.999e+38, that's the moment it stop displaying the number during gameplay

  • Scale down the numbers would be the best solution here, 9.999e+38 is crazy large number it can also have effect on your performance because it will take lots of memory so save it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)