▚ BATTLE CODE ARENA // PLAYER'S GUIDE PLAY ▶

The debugger

Stepping through your program during a practice battle: every line it ran, and every value it saw and set. With the subscription.

When your vehicle does something you didn't expect, the debugger shows you why. Stop a practice battle at the moment it went wrong, open the debugger, and step through your program there, a line at a time, forwards or backwards. You see which way each if went, what every variable held, what each function call gave back, and the orders your program gave.

The debugger: the battle, the controls, and the program with the line being run marked
The debugger: the battle, the controls, and the program with the line being run marked

Opening it

  1. Fight a practice battle in the ARENA.
  2. Go to the moment you want to look at: drag along the timeline, or tap an event in the report.
  3. Press DEBUG, under the arena or on the report.

The debugger opens at that moment. CLOSE goes back to the arena.

It works on battles fought on your device: practice battles, and the battles of the league's trial. Battles always go the same way, so the debugger fights the battle again with your program traced, and it comes out exactly as you watched it. It can't open league battles, which are fought on our servers, and it never shows a house vehicle's program. If you fight one of your own vehicles against another, it steps through the one you have open.

Moving through the battle

ButtonGoes
LINE ▶, ◀ LINEOne line of your program on, or back
UPDATE ▶, ◀ UPDATEOne update on or back: a tenth of a second, a whole run of your program
HIT ▶, ◀ HITOn to the next breakpoint, or back to the last one

The arena above follows along. The line under the buttons gives the tick and how many OPERATIONS the update used (against your class's limit), and, on a line with an if, which way it's about to go: THIS IF: TAKEN, NOTHING TAKEN, or which branch. If the update failed, it says FAULT AT LINE and why.

What you can see

Breakpoints

A breakpoint stops the battle at the moment something happens, so you needn't step there by hand. HIT ▶ goes to the next one. The tag shows how many times the breakpoints are hit in the whole battle.

Each breakpoint is listed with a ✕ to remove it.

Example: your vehicle never seems to fire. Put a breakpoint on WHEN IT FIRES. If HIT ▶ finds none, step through the line with missiles.fire() and look at the if above it. Is missiles.ready() false in CALLS, or is the turret not yet on target?