My idle game's numbers stop growing, show NaN or turn into Infinity after a while
After a few days of play the score freezes, adding one makes no difference, or the screen shows a strange word instead of a number. Ordinary numbers have limits that idle games walk straight into. This entry shows a way to hold huge values, add them, and print them neatly.
Why this works
Splitting a value into a small part and a power of ten keeps the size unlimited for practical purposes, and ignoring a term that is far too small to matter keeps the sums cheap and stable.
When not to use it
Skip it if your numbers stay below a few trillion; ordinary numbers are exact there and simpler. Also skip it when every single unit must be counted exactly.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- A diagram of every state
- 54 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "My idle game's numbers stop growing, show NaN or turn into Infinity after a while" (read_entry idle-numbers-turn-into-infinity-or-stop-growing) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP