Getting started
Learning paths through this topic
My idle game pays out wrong after the player has been away
Players close the app, come back later and expect fair earnings. Too generous and the game is trivial; set the phone clock backwards and forwards and it breaks. Here is the small calculation your AI should use for the away time, and what it must remember between visits.
My idle game numbers stop growing or turn into Infinity
After enough hours the score stops moving, small gains vanish or the display shows a word instead of a number. Ordinary numbers in the code simply run out of room. Here is a different way to store huge values and how to print them so the player can read them.
The buy-max button in my idle game buys one too many or one too few
When every purchase of an upgrade costs a bit more than the last, working out how many the player can afford is not a simple division. Looping is slow for big numbers and a formula is off by one at exactly the wrong moment. Here is the calculation with the safety step that fixes the edge.
A level I made by hand has no exit or two start points
When levels are typed as text pictures, one slipped character is enough to make a level impossible, and you only notice when a player writes in. Here is a checker your AI can run over the whole pack, with messages that point at the exact level and line.
Lives should come back every half hour, even while the game is closed
A countdown that runs inside the game stops when the app closes, and a timer that restarts on every launch gives away lives or takes them. The reliable way is to not run a timer at all and work everything out from two saved values. Here is that calculation and the three traps in it.
My match-three board starts with ready-made rows that clear by themselves
A board filled at random often contains rows of three from the very first moment, so points appear before the player has moved. Re-rolling until it is clean is slow and can loop forever. Here is a way to fill the board in a single pass that avoids the problem by construction.
Chain reactions in my match game score wrong or clear tiles twice
When tiles fall and make new rows, the order of the steps matters: clear too early and a tile in two rows is counted twice, refill in a different order and results change from run to run. Here is the exact sequence of steps with a chain bonus, so the same board always gives the same score.
The board has no possible move left and the player is stuck
After enough turns a swap-and-match board can reach a state where nothing can be matched, and the game just sits there. Detecting that and fixing it is easy to get wrong: a shuffle can create matches or leave the board stuck again. Here is the complete check and a safe reshuffle.
After my update, players with old save files lose their progress
You rename one thing in the game and every existing save from before suddenly looks broken or empty. Players blame you, not the update. Here is a way to let old saves be upgraded step by step, and what to do with a save that comes from a newer version of the game.
How do I know every level of my sliding puzzle can be solved?
In a puzzle where the piece keeps sliding until something stops it, a level that looks fine can be impossible, and you will not find that by clicking around. Here is a small solver your AI can run over every level, and the one rule people get wrong about the goal.
A player bought coins and got them twice, or paid and got nothing
Purchases arrive more than once, arrive late, or come back when the player reinstalls, and the game must give each one exactly once. Here is the small ledger your AI should keep, how to treat a purchase that is still pending, and what to do on restore.
Some players never get the rare reward while others get it at once
A pure chance of one in many is fair on average and cruel for the individual: a few players wait for ages and quit. A guarantee that grows with every miss keeps the average rare and removes the worst luck. Here is a small version, plus how to work out what it does to the average wait.