Goal
Hostile ships sail toward your fort from X = 1000 (strait length in meters). Your fort sits at X = 0. Each game tick (about one second), your code can read the radar and order your three cannons to fire Rentaka (fast, lighter shots) or Meriam (heavy shot, cooldown). Sink ships for score; if ships reach the fort they deal damage. Survive up to 10 waves with 100 fort HP to win.
Screen and controls
- War Room (left on large screens): programming area. On small screens use Code in the header to open it, then Battle to focus on the radar.
- Visual tab: palette on the left, cannon stacks on the right — drag blocks into each cannon to build logic. That is the source of truth; the game always runs the generated script.
- Code (generated) tab: read-only preview of the JavaScript produced from your blocks—useful to learn how blocks map to real code.
- Pause / Resume stops or continues the tick loop. Reset restarts the match, fort HP, waves, and restores the default visual strategy.
- The HUD shows fort HP, score, wave progress, and per-cannon reload state. Logs appear on the radar during battle.
Visual logic (blocks)
Each cannon automatically picks the nearest living ship (by distance). After that, your stacked strategy blocks run from top to bottom. Drag blocks in the list to reorder; drag from the left palette to add; use the remove control on a block or Reset to restore the default. The palette includes If / else (strong target), For loop (×3), Meriam once, and Rentaka once — drag Meriam or Rentaka (or another container) into the Then, Else, or Loop body areas to nest your logic.
Writing code (what the generated script looks like)
Under the hood the game expects either three cannon functions cannon1, cannon2, cannon3 or a single onTick function. The visual editor always generates the three-cannon style. Each function receives radar, artillery, and command.
Which code controls what
The diagram matches the radar layout: the fort strip on the left holds three slots (top to bottom). Your functions cannon1, cannon2, and cannon3each map to one slot. In the Visual tab, "Cannon 1 / 2 / 3" lists are the same mapping. radar and artillery are shared APIs — they always refer to the whole battlefield, not a single tube; which physical cannon acts is determined by which function you are inside.
cannon1, cannon2, cannon3— each runs once per tick and only controls that slot's firing. The Visual editor has one block list per cannon for the same mapping.Player API reference
Values below match the live game rules (3-tick Meriam cooldown, etc.).
Preferred structure
Preferred: define cannon1(radar, artillery, command), cannon2(...), cannon3(...)Split your defense across three functions so each physical cannon slot runs its own logic every tick.
Radar
radar.getShips() -> [{ id, type, distance, hp, maxHp }]Returns every ship currently on radar. Filter and sort (for example by distance or HP) to choose a target.
Rentaka
artillery.fireRentaka(shipId)
// 10 damage, max 3 bullets per cannon per tickLight cannon. To fire more than once per tick from the same cannon, use a for loop in that cannon's function (the game checks the source for this pattern).
Meriam
artillery.fireMeriam(shipId)
// 50 damage, max 1 per cannon per tick,
// 3-tick cooldown (global)Heavy shot: high damage but limited rate. Plan which cannon fires Meriam so you do not waste the cooldown.
Command log
command.log("message") -> battle logPrint strings to the in-game log on the radar. Useful for debugging which branch ran.
Tips
- Reserve Meriam for Colonizer Galleons or high-HP targets; use Rentaka bursts on weaker ships.
- Use all three cannons so you are not limited by one slot being busy.
- Open the Learning guide for short examples (loops, if/else, and best practices).