Spielerando

Energy

Daily free attempts reset at the wrong hour or can be refilled by changing the clock

Many games give a few free tries each day. Resetting every 24 hours after the first try feels random, resetting at server time feels unfair far from home, and trusting the device clock invites cheating. Here is a day counter that is predictable and hard to abuse.

A reward fills energy past the maximum, and then the bar shrinks or stops working

Rewards that give more than a full bar are popular, but code that assumes the value is never above the maximum then does odd things: it cuts the bonus away, refuses to refill, or breaks the percent display. Here are the few rules that keep it sane.

Gear that lowers energy cost stacks until actions become free

Players love equipment that makes actions cheaper, and a few of them together can push the price to nothing, or below nothing. Here is how to combine reductions so they stay meaningful, round fairly, and never produce a free or negative action.

Spending energy restarts the refill clock, so players lose minutes for nothing

Games with a slowly refilling energy bar often calculate the refill wrongly: they reset the countdown on every spend, or keep counting while the bar is full and give a free flood later. Here is the bookkeeping that is fair and needs no running timer.

Hunger, thirst and tiredness pile up and the character suddenly crawls

Survival games track several needs at once. If each one is checked alone, the penalties jump around, stack without limit, or never warn the player in time. Here is how to combine them smoothly, and how long starving really takes.

A 2x boost that ran out while the player was away is paid for the wrong time

Boosts have a start and an end, and the player's absence has a start and an end, and they rarely line up. Here is how to count only the overlap, and what to do when two boosts run at once.

"Buy max" charges a different price than the sum of the single buys

Prices that grow with every unit owned are easy to get slightly wrong when a player buys many at once: the button shows one price and the wallet loses another, or the last affordable unit is missed. Here is the rule that always agrees.

Chests that open one after another start the next one late if the player was away

A row of timed chests where only one can open at a time seems simple, until the player returns after a night. Do the others start when the first finished, or when the player came back? Here is the timeline that answers it, with the exact moments.

A factory that turns ore into bars produces too much when the ore runs short

Chains of producers, where one eats what another makes, go wrong when the supplier is slower than the eater. The output must slow to the supply once the stock is gone. Here is the two-phase sum that gets it right, even after hours away.

Slow income of 0.3 coins a second never shows up because every frame rounds it away

When coins are whole numbers but income per frame is a tiny fraction, rounding each frame to zero means the player earns nothing at all. Here is the bookkeeping that keeps the leftovers, gives the same result at any frame rate, and stays exact.

A producer with a full storage box should stop, not save up a pile for later

A farm or mine that fills a box until the player comes to empty it needs two honest rules: it stops at the limit, and it starts again only from the moment of emptying. Here are both, plus how much was wasted.

Buying one more at a time misses the owned-count bonus that doubles income

Many idle games double a producer's output when you own enough of it. A button that always buys one, or always buys the maximum, wastes money around those thresholds. Here is how to compare the options and pick the one that pays back best.