Work out what the base made while the player was away, across an upgrade
When someone returns after hours, the game must say what piled up. The rate changed halfway through because an upgrade finished, and the storage filled up before the end. One multiplication cannot do that, and rounding at each step loses pieces. This entry shows how to walk the stretches in order and round only once.
Why this works
Away time is not one stretch but several, because the rate and the room both change when an upgrade lands. Walking the stretches in order is the only way to be right, and rounding once at the end avoids losing a little piece at every step.
When not to use it
Skip it when nothing can change while the player is away, or when the game wants a flat cap on what an absence can earn to reward regular play. Then one simple multiplication, with a ceiling, is easier and fairer.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 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 "Work out what the base made while the player was away, across an upgrade" (read_entry production-while-away-when-a-building-finishes-on-the-way) 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