I am currently working on creating an idle game. I am having some troubles though when it comes to large numbers. What I am trying to avoid is having numbers like 1,000,000,000,000 display instead have 1.11 e6 or 1k, 1m, 1b, etc. I currently am trying to do this in blueprints. I have searched on the internet and did some research and the best thing I could come up with is this line of code:
I then just keep doing this line of code for every new value (1,000-10,000-100,000-etc). This seems very inefficient and doesn’t seem to be the best way. I thought about resetting the value to 1 every time it hit these marks but not sure how that would best work. Any help on this would be great or just some insight before I start down this rabbit hole. I am currently at e13 and it still seems to work perfectly. but just feels like there is a better way. I am currently using UE5.4. Thanks in advance for all the help!
Make Blueprint functions library.
Create there PURE function that has number and exponent as variables
calculate value inside function
Then use that pure function as input.
Trying to make this automatic, using MAP variable that holds number of zeros (for eg kilo - 3 zeros). It is (will be) nice to use. But code gets complicated. So give me some more time.
I think/hope this works correctly:
Make function library, and create this one in. Make it PURE.
In map you declare NUMBER of ZEROS, not multiplier. However make sure it gets it correctly.
Also whole code assumes that this map is sorted by number of zeros.
ps.
It does not divide value by base 10 exp, so a bit altering is required.
pps.
You can declare that EXP_MAP variable in separate EXP_MAP function in function library. Make it pure, then use everywhere THAT function like you would use normal variables. This way you have exp and names declared in single place. Easier to keep track, i foresee very long table with numbers of zeros
So after being on break and being able to just spend tons of time on it, I was able to find a way to make this work using exponents.(IE 1.23E4) I had to delve into loge nodes with a power nodes but was able to figure it out. Now for the K, mil, bil, tril, etc that’s another story but for now it works perfect and I thank you for all your time and help. Also I didn’t want to just leave you hanging on my progress.