Spielerando

State machines

Two build sites claim the same tiles, or a failed claim leaves ghost tiles behind

A builder game must decide who owns each tile the moment a site is placed. The classic bug is a rejected placement that still blocks half of its tiles forever, or a moved building that collides with itself. Here is the claim logic that avoids both.

Cancelling a build should refund the right amount, once

Players cancel buildings all the time, and every wrong refund becomes a money trick or a feeling of being cheated. This entry shows what the refund must depend on, which cancel clicks must give nothing, and how to keep the books honest.

A zone fought over by two teams jitters or flips to the wrong owner

When both sides stand in the zone, who gets the progress? And what should happen when it is empty or when the owner is partly pushed out? This entry settles those cases so a capture zone behaves the way players expect.

A capture point that must be neutralised first and freezes when contested

A flag that flips the moment one soldier steps on it makes every fight a game of tag. Good capture points need a tug of war with a neutral middle, a stop when both sides are present and a sensible way back when everybody leaves. This entry has all three.

A house is torn down and its people must find a new home, but nobody else should move

Rebuild the housing and the simplest code reassigns every citizen from scratch, so the whole town changes address and the people who were happy suddenly walk across the map. This entry shows how to move only those who must, in a way that repeats exactly.

A click while a door is still opening gets lost or runs twice

Objects that play an animation, like doors, chests and levers, either ignore clicks in the middle or pile them up into a mess. This entry shows a small rule for what should happen with the click, and when an old click must be thrown away.

Timers differ between players because their clocks disagree

A countdown ends at different moments on different screens, because every device has its own idea of the time. This entry shows how to estimate the difference to the host well enough, and how to apply a correction without time ever jumping backwards.

Taxes and wages are skipped when fast forward jumps over midnight

Cities pay and collect at the end of a day or a month. When the game runs fast, or comes back from sleep, one step can cover several of those moments, and a check for exactly the right instant misses them. Here is how to never lose one or count one twice.

Letting the treasury go into debt without breaking the game

Upkeep keeps charging even when the money is gone. Blocking all spending is harsh, allowing endless debt is silly. This entry shows a middle road with three money states, interest that bites, a way back, and an end that does not come out of nowhere.

Tearing down a building with workers inside, and clicking demolish twice

Demolishing sounds like deleting an object, but there are people inside, a refund to pay and an impatient player who clicks twice. This entry gives the order in which things must happen so nobody is lost and nothing is paid twice.

Diplomacy states: no war during a truce, no instant peace after a surprise attack

Relations between two powers are a small set of states, and the interesting part is not which states exist but which changes are forbidden and for how long. Without those pauses, players declare and end wars every turn. Here is a full table with real waiting times.

The same account joins twice and both copies fight over one hero

Someone opens the game on their phone while it is still running on the laptop, or their connection retries at a bad moment, and now two sessions control one character. This entry shows who gets kicked and why they never kick each other.