Show the progress of a generator that finishes many times per second
Early in an idle game a generator takes ten seconds and its bar fills nicely. Later it finishes ten times a second, and the bar flickers madly or counts wrongly. Here is how to count finished rounds correctly, including an unexpected rounding trap, and when to stop drawing a bar and show a rate.
Why this works
A bar only informs when the eye can follow one round. Counting rounds from the total time passed, instead of adding up frames, keeps the income exact however the screen stutters, and a rate reads better once rounds are too quick to see.
When not to use it
Keep the filling bar when rounds are slow and the wait itself is the point, such as a long craft the player plans around. A rate display hides the one thing they need there: how long until it is done.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 19 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 "Show the progress of a generator that finishes many times per second" (read_entry idle-progress-bar-for-cycles-shorter-than-a-frame) 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