Show an income per second that does not jump around or turn negative when you spend
The little number next to the gold counter should tell the player how fast the city earns. If it is computed from the balance it falls below zero whenever they buy something, and if it looks at one second only it twitches. Here is how to read the speed from what was earned.
Why this works
The rate players want is how fast things arrive, and that is not the same as how the balance changes, because buying lowers the balance without lowering earnings. So count only what was received, and average it over a short stretch so payments that come in lumps do not make the number twitch.
When not to use it
Not needed when income is perfectly steady, where one fixed number can be shown. It is also misleading for games where the player cares about the net result after upkeep, which does need the balance change. Show both if you have costs.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 15 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 an income per second that does not jump around or turn negative when you spend" (read_entry income-per-second-display) 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