How do I deal with large variables

Get help using Construct 2

Post » Sat May 20, 2017 7:00 am

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
B
16
S
2
Posts: 26
Reputation: 794

Post » Sat May 20, 2017 11:33 am

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.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Sat May 20, 2017 11:53 am

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
B
16
S
2
Posts: 26
Reputation: 794

Post » Sat May 20, 2017 12:01 pm

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.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Sat May 20, 2017 12:26 pm

Hmm yeah. I might have to stick with a 'MoneyThousand ' MoneyMillions' 'MoneyBillions' typw thing with multiple variables
B
16
S
2
Posts: 26
Reputation: 794

Post » Sat May 20, 2017 12:31 pm

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
B
16
S
2
Posts: 26
Reputation: 794

Post » Sat May 20, 2017 12:45 pm

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.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367


Return to How do I....?

Who is online

Users browsing this forum: AndreasR, Blendi1223, kellehk and 20 guests