Spielerando

Fixing problems

Learning paths through this topic

A building says it needs a resource that is not in my game, probably a typo

A misspelled name in a data file does not crash anything, it just makes a building impossible to afford. This entry gives your AI a check for every reference that points nowhere, with a careful guess at what was meant and no guess when unsure.

The computer opponent plays the same opening every game and it gets boring

If every match starts the same way, players stop adapting and stop caring. This entry gives your AI a way to measure how varied the opponent really is across many games, with a fair score that does not hide openings it never uses.

A destroyed tower still reacts to events and the game slows down over time

Things that listen for events must stop listening when they are removed, or they pile up and keep acting from beyond the grave. This entry gives your AI a log reader that finds who is still listening after being destroyed and which events have gathered the most listeners.

Dragging a selection box from right to left selects nothing, and a click clears everything

Selecting units looks easy until players drag the wrong way, click a bit sloppily or hold a key to add. This entry gives your AI a selection routine that treats a tiny drag as a click, works from any corner and keeps the old group when adding.

Dragging a road over existing tiles charges me for tiles I already have

Dragging a line of tiles looks simple until it bends, runs backwards or crosses what is already built. This entry gives your AI a placement calculator that lists the tiles once each and charges only for what really changes.

I want every unit to have a counter, and no unit that is just better than another

A counter system breaks quietly: one unit that nothing can beat, or one that is worse than another in every matchup. This entry gives your AI a check on the matchup table that lists both kinds, so you see the broken spots before players do.

A farm that should make 0.4 grain a second shows zero forever

Small production rates disappear when the game rounds every tick on its own. This entry gives your AI a counter that keeps the leftover between ticks, gives exact numbers after a pause too, and avoids the odd results of decimal math.

At triple speed the game freezes for a while and then jumps ahead

Fast forward asks the game to do more work per frame, and if a frame is already slow, it falls further behind each time. This entry gives your AI a frame loop that caps the work per frame and throws away the backlog it cannot catch up on.

My bug needs forty commands to show and my AI cannot make sense of it

A recorded game with forty commands hides the three that matter. This entry gives your AI a shrinker that removes commands in chunks while the bug still appears, and ends with a list where every remaining command is needed.

The German unit name runs out of its box and nobody sees the end of it

Long words in another language break layouts that looked fine in English. This entry gives your AI a width estimator for text that checks whether a name fits, wraps it into lines, and flags single words that can never fit and need another fix.

Grain keeps disappearing: what went in and what came out do not add up

When production, use and stock do not add up, something is eating or inventing goods. This entry gives your AI a balance checker that lists which goods are off, by how much and in which direction, and ignores the harmless rounding.

The happiness meter shows NaN, or 130 percent, when a city has no parks yet

A weighted average breaks in two ways: an empty group divides by zero, and one oversized score drags the total out of range. This entry gives your AI a score that leaves out groups with nothing to measure and caps each single value first.