I’m making a clicker/card game, I’d like it to go on basically forever (like Cookie Clicker) until you reach “infinity” (the number that is more than what you’ve coded to exist.)
Is there a way to make numbers surpass the integer?
I believe in GDev it’s somewhere around 9 quintillion (64 bit integer)?
I think it’d be possible to create a number system where each 3 digits are stored in a variable and displayed in this order: quintillion, quadrillion, billion, million, thousand, hundred.
My question is the following:
What would the best way to work with this method be? Or are there other methods, or maybe an extension I can install? Also, how would I make that work with adding higher numbers? For example, if I have a card that gives me 1 sextillion, (number 3 0s after 1 quintillion) how do I add that to my number, especially if it’s a number like 1,020,020,020,020…? For this I’d have to remake the variables listed above (quintillion, quadrillion, billion, million, thousand, hundred) for each card, (I’d use a group of course) and do NOT get me started on CONVERTING the numbers.
Any ideas? ?
How do I add this to my game with the zip/json?
I’ve never added anything externally.
Open project manager on the left
Click + next to extensions
In new window click import extension or something like that
Thanks, I’ll try using it now!
I’ll let you know if it works!
I can’t quite figure out how to use it.
Is it any different from regular extensions?
I can’t find any conditions or actions.
I never used it i just know it exist
But on github there is how to use it section in description
It seems to work pretty well but not for my intended purpose using it.
It keeps doing this, if you can’t seem to count, that’s fine, this is technically 1e+21, it always appears after 100 quintillion.
I’m not sure why exactly it’s doing this, though.
Edit:
I have to forcefully make it work, and when it does, the number switches from 1000Qi to 1Sx and back when I click.
@ZeroX4 (Wasn’t sure if this notified you or not.)
I’m kinda dumb for this, but the maximum GDevelop can handle is a 64 bit integer limit, like I said when I first made the post.
So I’m surprised it can even go to 100Qi.
Is there any other method I could make myself?
I have no idea
And i never did even try to have longer numbers when i could have shorter
IDK why you need it
BUT i always did wonder why in games everything gives you 100 or 200 or 1000 after killing something
Then i saw a game where after killing enemy you got 2 or 5 and it did look SO POOR
BUT i also noticed a lot of games faked their score
When i started to use cheat engine and i was unable to find address of score or money because they used most important rule of development
It does not matter how you did it it only matters what user will see
A LOT of games had it like this
You kill enemy you see 200 or 500 points fly up or even 1000 5000 and so go on
I discovered it was not 200 500 1000 and 5000 it ACTUALLY was 2 5 10 and 50
They faked last two zeros
I saw them they was there but it was nothing else than
Change ScoreText set to ScoreVar + “00”
Imagine that
SO how about you use same logic?
Do you really need game to know you have 10000000000Q?
OR you would be fine with game displaying 10000000000Q but in reality it would be
Change Text set to 10000000000+“Q”
All you would need to have is your number and var for counting how many digits it should display
And depending on that number display different thing on the end
Where number itself would not exceed like i think 10 digits or so
It is a bit of work to set it up
But now we will know do you really need it or you just want it but can live without it
Well it’s a clicker game, I need it to be a relatively long playtime, and considering it will have tons of boosts and stuff you will NEED the large numbers, but I don’t want a fake display I want it to count up like an actual number, no fake zeroes. One, ten, one hundred, one thousand, ect.
Maybe someone else would know a solution.
I do want to go with the solution I said when I first made the post, but I don’t know if it’d be practical, and I don’t know how I would manage multiplying and stuff like that.
I suggest you reconsider and start using roundTo()
Because going for such accuracy is just stupid
You don’t need more than 2 or at worst 4 integer digits
You are going way overboard with your idea and is causing you just problems
How would I use roundTo() for this?
If someone has 100 and they magically gain 10000000000 or something like that, I want them to be able to get rid of the 10000000000 and still see the 100.
If you think accuracy is stupid, I guess I’m stupid.
I’m a perfectionist, and I LOVE games, I will try my best to develop the game I WANT, not another person.
I want answers, not a dismissal.
I don’t understand clicker games. They’re not my thing. If the number goes by number and letters at some point then the exact number seems unimportant. I’m guessing you could have 1 number that goes from 0 to 999 and another number that tracks the letter suffix. Either through an array or a formula.
For very large numbers there seems to be atleast 2 approachs. Javascript has a function or type for large numbers although you would also need a script or functions because the normal math functions wouldn’t work.
Another way seems to be treating the number as text. IDK how to handle math with strings that are too large to convert to numbers. I guess you can use individual characters or groups and somehow add them or whatever.
This all seems complex. I suggest you search the web for solutions. Even if they aren’t for GD, they should help.
Did you ever adjusted collision mask?
I have seen ppl doing this with collision masks
Red is collision mask
Where this is enough
Where even this would be enough if you want to go for some extra detail
But for sure NOT 1st one
That is stupid and going overboard and i am perfectionist myself i do not allow something to just be in my games other than being perfect
But in some cases same as here it is going way overboard
BTW that is just example image above
I seen ppl do it with WAY MORE complex shapes for example xmas tree
This will not make game better but you struggle with dev process a lot longer for no actual benefit
BUT we all should judge it ourselves i simply judge it as being stupid
You may find it being some high quality attention to detail
You are trying to force yourself into giving VERY LONG number as it would be
I say you should not cause my 1st rule in game making is
It does not matter how you did it but what player see
So roundTo could be used if you divide your number by 1+ as many 0 as number had
For example you have number 123456 so 6 digits
You divide it by 1 000 000 so 1 and 6 zeros
And now you have 0,123456
You could use roundTo if you want to cut out some places in decimal
YET you could simply while printing it to text remove dot/comma from 0,123456 and get 0123456
So you would need to remove 0 from string now
Now after you do that you can even divide it by some number
You are not locked to calculating exact number
For example now you gain add 789 to it and you will get 789123456
Now imagine you have both decimal and integer displaying as one long string of numbers
And player sees what you want to see
While you are not doing it the way you wanted to do
Actually i would move it all to decimal by dividing it constantly by 1+as many zeros as digits it should display
This way you would not have error of big number
And NOW roundTo would have a lot more sense
Cause you could have text variable
Which you have on end of your number
And depending on how many digits your number have
1 - change roundTo to what decimal place
2 - change what that variable would display for example M T Q or whatever NOT AFFECTING that number
It will still count up as it should just in a different way
Instead of integer you will operate on decimal
Do you think any player care is it one or another
Or do they care what they see?
Choice is yours
So you want me to put all of the numbers as a decimal?
Can you have an infinite number of decimal houses?
If I get what you’re saying, you’re recommending me use a text variable to add the end to the number, and then use roundTo to round the number and remove the period.
roundTo will not remove period
roundTo is there to display cut out numbers from right side
Where maybe more sense would be to use SubStr()
And simply get only portion of text itself
Since rounding will change last digit in some cases
You need 2 things
And how you gonna do it is up to you
1 - is cut out part of string
2 - is remove what you don’t want to see such as 0.
1 - would be done either by roundTo or SubStr() depending how you wanna do it
Cause roundTo(NUMBER , 3)
Would change 0,11111 to 0,111
But 0,55555 to 0,556
Cause it rounds it up assuming you have half of number already it will go up
Imagine you have countdown timer
Rounding minutes by seconds would result in having 2 when you have 1:40 (mm:ss) for example
But 1 when you have 1:10
2 - is how you gonna remove 0, you could do it with SubStr() and FindStr()
You could search for , and from that position +1 display rest of string
Or display only part of it
Where you could also replace it with StrFind() StrAt() and printing actual result to text object instead of manipulating actual value
Look this sound like rocket science but once you start doing it it will be very easy to just copy paste from one place to another
And only edit value of spaces you either want to show or hide
It is like you never had smartphone and i am trying to explain to you how to download some game from google play
You need to do it yourself to understand it is not complicated while it does sound complicated
Look i made calculator
https://zerox4.itch.io/calculator-zero
You can see what kind of equation i made you can try it yourself
But as you see on bottom you have result with roundTo(Number , 2)
So it shows only 2 decimal characters
If you hit equal = button it will display on top all decimal characters
BUT they are displaying same exact number variable
Just top text object is displaying it as it is untouched
While bottom text object is displaying it with expression roundTo(number,2)
And since your problem is centered around displaying large numbers
Your only concern should be length and not what is displayed
From my standpoint you should do not care if your number is 12345,67891011121314
As long as you can remove , from that string
Since that will display what you want
And numbers are numbers there is no magic here
Adding 1000 to 1000 is same as adding 0,1000 to 0,1000
As long as you can remove from string 0,
And you should only care if what player will see is what you want him to see and not what exactly it is
So if after some length of number you get E+
Move your number to decimal and have long decimal instead which will not display E+ but allow you to shove in there whole train of digits
While being able to shove into it whatever you want as suffix
Like do you think in my calculator you see how many vars displayed in text object?
1? maybe 2?
How about 5?
I did fake display of what i want by changing each var to whatever i want when i want it to show
For example press this button
It will automatically create parenthesis in around current number
BUT like you see in my text object expression
These are just variables Calc.ParenthesesL and R
Which i either set to “” ""which means nothing or to “(” “)”
You see what i want you to see where i did it the way i was able to do it
Good explanation.
I’ll try making it infinite.
Here’s the breakdown of what I’m planning on doing:
Remove the period from the text in the decimal.
Make the number go up by the smallest decimal house when clicking (E.g: you have “0.12345” it goes up by 0.00001).
once the decimal reaches 1 from 0.999…, it is divided by 10 and an extra decimal house is added.
I’ll be counting the number of decimal houses based on the amount of times the number has reached 1 or more.
I just realize that is also stupid
Why to divide it when you could not?
BTW just to be clear i am in perfect right to call it stupid
Because i did exact same thing and i went trough with it
And i regret every single second i went trough for trying to do some things the way they are instead of making it any way possible
Accuracy is not stupid
But if you believe that when in mario game mario pick up coin and you should delete coin to make it disappear
Then that approach for me is stupid
Cause now your mario dies and how you gonna respawn your coins?
You gonna make event for every single coin
Create coin at X1 Y2
Create coin at X323 Y40 and so go on?
Where 1st you need to check if each coin exist or was deleted before recreating them?
No you fake the effect
When mario is in collision with coin you change its opacity to 0
And allow this event to run only if coin opacity is 255 so fully visible
So now when mario dies and you need to respawn coins all you need is one single action
Change coin opacity set to 255
So let me repeat
Going for ultra accuracy is stupid cause other than doing it the way it is you are gaining nothing other than loosing time and brain cells
Now back to your problem
I just had this crazy idea why to divide anything?
What would be your max amount of digits you prefer to have?
10? 20? 30?
I do not ask how many at a time
So your display does not show 0 1 2 3 4 5 6 7 8 9 10
But for example how big number you would want to have?
Like you could have 0 1 2 3 4 M?
Cause you could totally shove that all into decimal
Never go into integer and have easier life just by using SubStr()
FOR EXAMPLE
Maximum number your game could have is 9 9 9 9 9 9 9 9 9 9 ← 10 digits
So when you start with 0 and you want to add 20 to it
You simply add 0,0 0 0 0 0 0 0 0 2 0
And now you can delete via SubStr() 0,0 0 0 0 0 0 0 0
To display only 20
Where what i would actually do is combine my idea with Keith idea from above
You DO NOT need to display something as it is
Have separate variables to display each section of this number
0,0 0 0 0 0 0 0 0 2 0
And you could have it totally end with M or Q or T or whatever you want
Where you would change text object to specific var IF (by using StrAt()) would not = 0
Which is 100% doable
And you would fake exactly what you want while not having problem with large numbers
Where let’s take a moment and think about what exactly you want
CAUSE if you get 1 000 000 in your game and you want to display 1M instead
Then ONLY reason to have track of your actual score is when you can subtract from it NOT whole amount of score
For example if you could subtract from it 512 then i would see it perfectly fine to keep track of your actual score
Where if it either can grow up or be set to 0
Keith solution is all you need
Cause it makes no sense to keep track of something you have no control over
I am not 100% sure what is your goal cause idk what would be possible in your game
But i am 100% sure you should rethink what exactly you need before you start getting into it
Cause right now i feel like you want to do something just because you want to do it where you don’t really need to do it
Trust me it is better to waste time thinking than waste time doing something that you will later need to adjust
I think I have an idea.
I could use an array, or a structure (not sure which one), to show each digit, and if one digit reaches double-digits, transfer the digit to the next child, and if the child doesn’t exist, create it.
My only problem is showing each child in order, in the text.