Compile & Defend is a single-player strategy and simulation game that redefines tower defense on PC. Instead of clicking to target enemies, players write code that runs on every tower each tick. The result is a defense system that improves only when the underlying scripts do.
Gameplay
The core loop centers on scripting behavior for each tower. A tower sees enemies through properties like me.enemies_in_range and acts with commands such as me.shoot(target). Simple scripts that always fire at the nearest foe serve as a starting point, yet they fail against mixed waves that require prioritization.
Ten towers each expose a distinct API. Arrow and Sniper towers deliver direct damage, while Cannon and Mortar handle area effects. Tesla and Chain towers manage clustered targets through lightning. Frost and Venom apply slowing or damage-over-time effects. Support towers buff nearby units, and Detect towers reveal camouflaged threats for the rest of the field.
Eight enemy types test different aspects of the code. Fast Runners demand quick reaction, Flyers bypass ground-focused setups, and armored Brutes require concentrated fire. Camo Shades stay hidden until revealed, Spawnlings and Broods multiply rapidly, and the Titan boss arrives with layered defenses that must be peeled away in sequence.
Everything runs deterministically. A working script produces identical results on every run, which removes randomness from testing and lets players focus on refining logic rather than hoping for favorable outcomes.
Game Modes
The campaign consists of 13 maps divided into three tiers. A seven-stage tutorial introduces mechanics one at a time, pairing each new threat with the tower or coding technique needed to counter it. Players progress from basic shoot commands to full for-loop swarm management.
Each map supports Easy, Normal, and Hard difficulties. Harder settings increase enemy count and duration, eventually directing players toward scaled freeplay segments to earn medals. Up to three stars are available per map, with one star tied to a specific coding challenge that rewards algorithmic improvement over simple resource accumulation.
Sandbox mode grants infinite resources and instant access to every enemy type. Players can hot-swap code while waves are active, allowing rapid iteration on controllers without restarting the map.
A built-in level editor lets users draw paths, define wave compositions, and export complete levels as copy-paste code. An auto-balancer checks that each submitted map remains beatable and requires code rather than manual intervention before it becomes available for others.
Programming Integration
Scripts are written in a supported subset of Python, JavaScript, C++, C#, Rust, Zig, or Lua. All languages compile to the same runtime, so switching only changes syntax. Clear, line-numbered error reporting appears directly in the interface when a script fails.
The interpreter runs safely inside the game engine, preventing any external access while still executing real control flow. Conditional statements, loops, and data structures become the primary tools for routing threats to the correct towers at the right moments.
Is It Worth Playing?
Compile & Defend targets players who already enjoy both tower defense and programming. Its appeal lies in replacing repetitive clicking with the satisfaction of writing and debugging functional scripts that scale across increasingly complex maps.
The teaching campaign provides a structured path from first script to advanced swarm control, while sandbox and editor tools support open-ended experimentation. A demo is available ahead of the July 2026 release, giving interested players a direct way to test whether the code-first approach matches their preferences.
Those who prefer micromanagement or visual placement will find the absence of click-to-shoot mechanics limiting. Players comfortable with basic programming concepts, however, gain a defense system that grows more capable through better logic rather than additional towers or upgrades.