Game Ai Mostly Cheats, and That Is Fine

Game Ai Mostly Cheats, and That Is Fine

November 17, 2026 Off By Tobias Lindqvist

Everyone thinks that learning how AI opponents are built means studying deep learning or complex neural networks that mimic human cognition. They see a high-budget trailer and assume there’s some god-tier math making that boss fight feel “alive.” Honestly? That’s mostly marketing fluff. In my experience—both as a modder and while struggling through my own solo project—the most “intelligent” feeling enemies aren’t the ones with the most complex algorithms; they are the ones with the best decision-making loops. If you try to out-math the player, you usually just end up creating a glorified cheat engine that feels unfair, rather than a meaningful challenge.

I’m not here to give you a lecture on academic machine learning or sell you on the hype. Instead, I want to pull back the curtain on the actual logic gates and state machines that make a fight feel tense rather than tedious. I’ll show you how AI is less about “thinking” and more about predictable patterns that allow a player to feel smart for overcoming them. We’re going to talk about the intentionality behind the code, so you can stop building enemies that just stand there and start building systems that actually force your players to make a choice.

Table of Contents

Finite State Machines the Sentence of Predictable Behavior

Finite State Machines the Sentence of Predictable Behavior

Most people think of AI as this nebulous, thinking entity, but when you’re actually sitting in your IDE, it’s usually just a Finite State Machine (FSM). Think of an FSM as a flowchart where the NPC is trapped in a loop of “if this, then that.” It’s a series of discrete states—Idle, Patrol, Chase, Attack—and the logic is just the bridge between them. When you implement finite state machines in gaming, you aren’t creating a brain; you’re creating a set of rigid boundaries. The NPC isn’t “deciding” to hunt you; it’s simply responding to a trigger that flipped a boolean from false to true.

The problem is that FSMs are incredibly easy to read, which makes them incredibly easy to exploit. If a player realizes that a guard always enters the “Alert” state the second they hear a footstep, the game stops being a tense encounter and becomes a rhythm game. You’ve written a sentence that says, “If X happens, I will always do Y,” and the player will spend the next hour finding the exact loophole in that logic. It’s not that the math is wrong; it’s that the predictability becomes a mechanical ceiling that prevents any real tension from building.

Pathfinding Algorithms When Npcs Get Lost in Your Intent

Pathfinding Algorithms When Npcs Get Lost in Your Intent

If Finite State Machines are the “what” of an NPC’s brain, then pathfinding is the “how” of their physical presence in your world. When you implement pathfinding algorithms for NPCs, you aren’t just solving a math problem about the shortest distance between point A and point B; you are defining the boundaries of your game’s reality. If a mob gets stuck behind a pebble or walks into a wall for three seconds before realizing it’s trapped, the illusion of a living world doesn’t just crack—it shatters. You’ve just told the player that the “enemy” is actually just a collection of poorly optimized coordinates.

The real danger here is that bad pathfinding becomes a sentence about player helplessness. When an enemy can’t navigate a simple staircase, the player stops feeling like a hero and starts feeling like they’re playing a broken simulation. You might think you’re just fixing a navigation mesh, but you’re actually fighting to maintain the integrity of the combat loop. If the NPC can’t reach the player, the combat isn’t “challenging”—it’s just broken.

The Designer’s Cheat Sheet: How to stop your AI from lying to the player

  • Stop optimizing for “smart” and start optimizing for “readable.” If a player can’t look at an enemy and intuitively understand its next move, you haven’t built an opponent; you’ve built a random number generator that happens to have a sword.
  • Remember that every AI decision is competing with the player’s dopamine loop. If your AI spends ten seconds “calculating” a flanking maneuver while the player is standing still, you aren’t showing off complex logic—you’re just giving them a reason to check their phone.
  • Build “fail states” into your logic. A perfect AI is a boring AI. Sometimes, the most important thing you can code is an enemy that misses a swing or hesitates, because that’s the sentence that tells the player, “You actually have a chance here.”
  • Don’t let your pathfinding dictate your combat design. If your AI is technically capable of taking the most efficient route but that route involves clipping through a table or getting stuck on a pebble, the player won’t see a “complex algorithm”—they’ll see a broken game.
  • Test your AI against the “unintended player.” Most devs build AI to fight a hero; real players play like chaotic gremlins. If your entire combat loop falls apart because a player found a way to jump-spam a corner, your AI isn’t actually playing the game you designed.

The Ghost in the Machine

Coding AI: The Ghost in the Machine.

At the end of the day, building an AI opponent isn’t just about perfecting a Finite State Machine or debugging a pathfinding script so a mob doesn’t walk into a wall. It’s about understanding that every line of logic is a conversation with the player. When the logic is tight, the NPC feels like a living threat; when it’s broken, it’s just a series of frustrating interruptions that compete with the actual gameplay for the player’s patience. You aren’t just coding movement and decision trees; you are deciding exactly how much agency you want to grant the person on the other side of the screen. If your AI is too predictable, you’re telling them the game is a chore. If it’s too broken, you’re telling them their time doesn’t matter.

As someone building a game in my spare time, I’ve learned that the most “intelligent” AI isn’t always the one with the most complex math. Often, the best AI is the one that knows how to fail gracefully. It’s the one that creates tension without causing a rage-quit. Don’t get so lost in the pursuit of a perfect digital brain that you forget you’re actually building an experience. Aim to write sentences that make your players feel challenged, respected, and—most importantly—engaged. Because if the AI doesn’t serve the player’s journey, it’s just expensive noise.

Frequently Asked Questions

If FSMs are so predictable, how do developers stop players from just "solving" the combat loop like a math equation?

You stop them by breaking the pattern, not by adding complexity. If an FSM is a predictable sentence, you need to introduce punctuation—interruptions. Developers use “utility-based AI” or “goal-oriented action planning” to let the NPC weigh options on the fly. Instead of just Attack -> Retreat, the NPC thinks, “My health is low, and the player is mid-animation; should I dodge or use a potion?” You aren’t just coding logic; you’re forcing the player to react to a choice, not a loop.

At what point does "smart" pathfinding stop being a feature and start becoming a way to punish players for playing the game naturally?

It stops being a feature the second the pathfinding starts prioritizing “mathematical perfection” over “player agency.” If an NPC uses a perfect A* algorithm to cut off your retreat every single time, you haven’t built a smart enemy; you’ve built a wall. You’re telling the player, “Your tactical positioning doesn’t matter because the math is always one step ahead.” When the AI stops reacting to the world and starts punishing the player for basic movement, you’ve stopped making a game and started making an obstacle course.

How do you balance the cost of complex AI logic against the player's actual attention span—is a smarter enemy worth more than a better loot table?

It’s a trap to think they’re competing. A smarter enemy and a better loot table are both just different ways of asking for the player’s time. If your AI is brilliant but the loot is garbage, the player feels like they’re working a high-skill job for zero pay. You don’t balance the cost; you balance the payoff. If you’re going to demand the cognitive load of a complex fight, the reward has to justify the mental exhaustion.

About Tobias Lindqvist

Every system in a game is a sentence about what the designer wants you to do. Grind is a sentence. So is a queue timer, a loot table, a guild bank permission screen. I write about what those sentences actually say, and why so many of them say something the designer did not intend. I build a game alone, badly and slowly, which means I have made most of these mistakes myself and can tell you what they cost.