Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: heavygunner on September 16, 2019, 04:52:56 PM

Title: [SOLVED] Formatting "Big" Numbers in Idle Games
Post by: heavygunner on September 16, 2019, 04:52:56 PM
Hi !

Making an Text based Idle game. Now, I have to display some big numbers on UI.
(https://i.imgur.com/4WwlSpa.png)

Let's say Balance is something between 1 Million - 1 Billion. So, I divide that number by 1 Million. Then, store it on a float then convert to string and build string float+ Mn will show the Cash balance.

This is working Problem is, when it goes more big number, How to do that ?

I have to check it's max and min value. if it's in range then okey, If not? i am confused.

Thanks
Title: Re: Formatting "Big" Numbers in Idle Games
Post by: heavygunner on September 17, 2019, 02:35:07 AM
A silly mistake made my works mess. I just changed to Less Than from greater Than. it worked.
(https://i.gyazo.com/720169bbb4135d6cefa80d052f493a47.png)
Title: Re: Formatting "Big" Numbers in Idle Games
Post by: jeanfabre on September 17, 2019, 02:50:49 AM
Hi,

 first of all, I don't think that it make sense to work with such big numbers, the human mind will not be able to grasp it above a billion...


but here's how you can get it done:

you first check the range of the value

(https://i.imgur.com/SUwFHIS.png)

And then format it based on that range.

(https://i.imgur.com/W3WUbkr.gif)

repeat for how big your number can be.

Bye,

 Jean
Title: Re: [SOLVED] Formatting "Big" Numbers in Idle Games
Post by: jeanfabre on September 17, 2019, 02:52:24 AM
Hi,

 funny, we're on it together :)

 Don't do that everyframe, this is a total waiste of performances, do that only per request, when you know that the input has changed.

also, you can learn more about string formatting here. (https://stackoverflow.com/questions/11731996/string-format-numbers-thousands-123k-millions-123m-billions-123b)

Bye,

 Jean
Title: Re: [SOLVED] Formatting "Big" Numbers in Idle Games
Post by: djaydino on September 17, 2019, 08:34:11 AM
Hi.
I worked on an idle game before and i had it setup like this :

(i just created a quick fsm to show the system, this is not from the original game)
(https://i.imgur.com/jLrvPjd.png)

Recheck was send when a purchase is done.

But i believe that i did that also convert every frame as the value is constantly changing.
i will look if i can find the project back