Easy way to format big numbers for idle / incremental games

5

Attached Files

The following files have been attached to this tutorial:

.c3p

Stats

1,520 visits, 1,967 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 24 Aug, 2020.

This is more like giving fish rather than teaching to fish BUT I had a hard time implementing this myself for my idle game so I wanted to share.

Download the sample project first:

.C3P

What this does is basically getting the number's first X digits depending on the number,

Then selecting the unit from the array based on how many zeroes does the number have.

If you want to implement this method in your own game, simply create a similar function and call that throughout your project.

Note that this method by no means lifts your variables' limits, they will still cause problems when they are over C3 bounds.

In order to implement the function in your game

Step1 : Create an array for different units

Step2 : Create a similar function like you've seen in the sample project before

Step3 : Call the function when you're changing the text values, setting the function parameter as the number you want to be "numberized". Note that this function should return text, therefore you can only use this to display your values.

The formulas I used to extract number of 0's and first X digits are inspired from this topic:

https://www.construct.net/en/forum/construct-2/how-do-i-18/work-big-numbers-100053

I hope this helps!

  • 4 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • I Cant Opent it , says need a Plugin

    • Should be fixed now, apparently I forgot an object in the project from a plugin that I tried before.

      • Good Job ! I never Tried this method , I usually to the same but with a different method

        if the number is between 999 and 999999 set text = "$ "&floor(Money/1000)&"K" and so on

        when it reaches Trillion I restart everything with a different triger variable with different names like Zillion , megazilion etc , but your method is better , what do I need to do if I want to increment the number? I tryed to fill with more arrays and didt work , Thanks

        • Thanks, if it did not work it could be because you've hit the number limit from Construct or you may have forgotten to increase Array size.

          If you want to change how many digits you want to show (before units like changing 1m to 1000k) you should play around with the denominator (1000 / 100 / 10 as default) in the formula AND change the "+3" value at the second part of the same formula.