README

A blind bot is a painful problem

Drekken

Why hello Reader,

You know the feeling when you hit a wall and just want to say, “screw it, I’ll hardcode it.”

That’s me trying to get my bot to auto-place a wall regardless of the map. Querying the API for choke points, then trying to mathematically work backwards to place the buildings.

The results were terrible. It was like my bot was blind, and that’s because… it was. I was stuck until I had a discussion with another builder in the community. That conversation completely shifted my perspective and made me realize I was looking at the problem through the wrong lens.

They pointed out my core mistake: I was trying to solve a vision problem with a math solution.

Hardcoding is a symptom of bad agent perception. If you are writing spaghetti code to figure out where a wall goes, your bot is using the wrong eyes.

Navigation is fundamentally about how your agent perceives the shape of the world, not just how units walk from A to B. The base SC2 API gives you a simple pathing grid. It tells you what exists, but it doesn’t tell you what matters.

If you stop at the API floor, your bot will always be reactive. To solve complex problems, you need to understand the difference between layers and tools.

Layers are how your bot represents the world. You build these on top of the base grid:

  • Influence Maps (Value): A grid layer that smears enemy positions into zones of danger.
  • Memory Grids (Time): A layer that tracks what the bot saw before the fog of war rolled back in.
  • Feature Layers (Patterns): PySC2 natively splits the game into roughly 25 stacked grids (terrain, visibility, unit type, ownership) so a neural network can “see” the screen.

Tools are how you read those layers.

  • Raycasting (Measurement): Shooting lines through a grid to dynamically find gaps, walls, or line of sight.
  • Pathfinding (Navigation): Algorithms like A* that read the grid to plot the fastest or safest route.
  • Gradient Following (Positioning): Reading an influence map cell by cell and stepping toward the safer or higher-value neighbor.

This was my exact mistake with the wall. Instead of trying to math out choke points from a flat grid, I should have used a tool like raycasting to dynamically measure the gaps. But looking back I realized a pattern.

Navigation is at the heart of all AI behavior in games.

This matters way beyond StarCraft 2. Whether you are building bots to play other games or explore complex environments, everything your bot does assumes it can reliably move through the level.

If it can’t navigate, it tries to flank but walks into its own wall. It retreats but routes through enemy fire. Every higher behavior inherits the blindness underneath.

Understanding and expanding your bot’s perception layers and picking the right tools to read them is how you teach it to actually understand the world.

Your bot can only solve problems it can clearly see.

⌨️ Next Commit

Identify one behavior in your bot that is currently hardcoded (like wall placements, retreat paths, or reaper harass).

Look at it through a navigation lens. What perception layer is your bot missing to actually understand that space?

Commit: Drop a // TODO: comment right above that spaghetti code defining exactly which layer (e.g., Influence Map) and which tool (e.g., Raycasting) you need to build so your bot can solve it dynamically.

May the Bugs Be Ever In your Favour🪲

Email Preference:
Unsubscribe | Update your profile | 600 1st Ave, Ste 330 PMB 92768, Seattle, WA 98104-2246