← All podcasts
0:00
Bringing the Antagonist to Life
25.11.2026
Press play — subtitles will follow the audio
Full transcript
- Sometimes the hardest enemy is the one that doesn’t exist yet.
- There’s a drawing in the margin of a sketchbook.
- A few lines, a silhouette, a weapon, an expression on its muzzle.
- I imagine how it moves, how it reacts to danger, how it chooses the moment to attack.
- But for now, it’s only a drawing.
- To bring it to life, I’ll have to build an entire decision-making system for it.
- I love combat scenes in eighties films.
- Sharp movements, heavy blows, pauses before a collision.
- An apparent chaos that hides precise choreography.
- I want to bring that energy into GUN RAT.
- But in a film, the sequence of events is known in advance.
- In a game, the enemy has to react to the actions of a player who cannot be predicted.
- And that’s where programming begins.
- At first, the logic seems simple.
- See the player.
- Approach.
- Attack.
- Three states, a few conditions.
- Every new case creates additional transitions between states.
- Gradually, individual conditions turn into a tangled web of dependencies.
- That’s why I started developing my own framework for enemies.
- Its foundation is a general system of states, events, and priorities.
- The enemy receives information about its surroundings, evaluates the situation, and chooses an action.
- Some states can be interrupted; others must be completed.
- Some decisions depend on distance, others on time or a previous action.
- It’s not enough to determine what an enemy can do.
- You have to decide when it is allowed to do it.
- And how one action transitions into another.
- Next to the drawings appear transition diagrams, coordinate axes, and formulas.
- I calculate distances, direction vectors, acceleration, jump trajectories.
- I check collision-area overlaps, time intervals, and visibility conditions.
- Sometimes I have to learn new mathematical methods to solve a problem that takes only a fraction of a second on screen.
- Especially difficult is coordinating movement and animation.
- A character may be mathematically in the right position, but visually appear weightless.
- It may hit its target precisely, but attack too quickly, leaving the player no time to react.
- So I adjust the acceleration curves, the duration of attack phases, and the intervals between decisions.
- A few numbers can turn clumsy movement into a convincing strike.
- But math solves only part of the problem.
- I also need to make sure that several enemies don’t turn combat into meaningless chaos.
- They must react to their surroundings, account for one another’s positions, avoid interfering with their own actions, and still retain individual behavior.
- One acts aggressively.
- Another prefers to keep its distance.
- A third changes tactics depending on the situation.
- All of this has to work within a shared architecture without turning into hundreds of exceptions.
- The worst part begins when every function works correctly on its own, but together they create a bug.
- The enemy chooses an attack, but the movement system simultaneously demands a retreat.
- An animation waits for the completion of an action that has already been canceled.
- States begin switching into one another.
- I add a check.
- A new problem appears.
- I rewrite a function.
- Another behavior breaks.
- It’s three in the morning.
- The monitor illuminates sheets covered in crossed-out formulas.
- The tea went cold long ago.
- For several hours, I’ve been trying to understand why the enemy sometimes freezes before attacking.
- I check coordinates.
- Timers.
- Event priorities.
- All the values look correct.
- But in the debug log, I find a strange sequence: two states are canceling each other’s decisions in turn.
- The error isn’t in the movement math.
- The error is in the architecture.
- I remove unnecessary transitions, separate decision-making from action execution, and restructure event handling.
- Outside, dawn begins to break.
- I run the game.
- The enemy approaches, calculates distance, chooses a direction.
- I shoot.
- It interrupts its movement, dodges, changes position.
- I try to get around it.
- It holds a pause and attacks.
- I never scripted that sequence.
- It emerged from the interaction of rules that finally stopped contradicting one another.
- I run the scene again.
- Now everything happens differently.
- And for the first time that night, I stop looking at the debug values.
- I watch the fight.
- The more complex the code becomes, the less visible its work should be.
- The player doesn’t need state tables, action-selection algorithms, or movement formulas.
- They need an enemy whose behavior can be understood, but not fully predicted.
- A good antagonist doesn’t necessarily have to win.
- It has to make the player change their decisions.
- For me, programming here becomes the art of staging.
- Math determines movement.
- Logic determines behavior.
- And precise rhythm turns them into a combat scene.
- The original drawing is still in the sketchbook.
- A few rough lines.
- Now, behind them lie hundreds of conditions, calculations, and transitions.
- On the screen, the enemy moves, attacks, and sometimes retreats.
- Sometimes it does something completely different from what I expected.
- And that, perhaps, is the most interesting part.
- I wanted to teach a sprite how to move.
- Instead, I taught it how to make decisions.
- This has been Gleb Pozdeev.
- You’ve been listening to *GUN RAT NEON — LOW FREQUENCY*.
- See you on Low Frequency.
How do you teach a game enemy not just to move, but to make decisions?
In this episode of LOW FREQUENCY, Gleb Pozdeev takes us behind the scenes of the enemy behavior system for GUN RAT neon - from a rough sketch in a notebook to an antagonist that reacts, changes position, and forces the player to rethink every move.
It’s a story about late-night debugging, hidden errors in architecture, and the moment when a set of rules finally stops contradicting itself - and a sprite begins to make decisions.