/building · 2018

Spacecode

javascript · block-randomized study

A game that teaches JavaScript by handing you a spaceship and a small vocabulary of functions, refined over a decade of block-randomized studies.

A Spacecode level where a ship is programmed to defend a mothership from an alien bomber

Spacecode teaches JavaScript by giving you a ship, a mission objective, and a small vocabulary of functions. forward(200), left(90), fire(), mine(), detonate(), delay(750). You write a program, you run it, and the spacecraft carries out the instructions.

A Spacecode level where a ship lays mines to destroy alien spaceships
A Spacecode level where a ship defends a mothership from an alien bomber
A Spacecode level where a ship destroys a group of alien fighters
A Spacecode level where a ship holds a position against incoming ships
Examples of missions which encourage repeated application of core concepts.

I wrote the first version of this game in 2015. There is no separate editor pane and no mental translation between where you typed and what moved. Programs are short and their consequences are immediate and visible, which is the only version of a feedback loop a beginner will actually stay in.

Block-randomized studies#

Spacecode has been through several iterations over the past decade, each one shaped by a block-randomized study: players are assigned to variants, and the game records what they do at a much finer grain than whether they finished a level.

That data is unsentimental about design. A level you are proud of can turn out to be the point where players stop, and the cause is as often the wording of the mission as the difficulty of the puzzle. Blind spots surface the same way: where everybody hesitates is usually where the game assumed a concept it never taught.

It is a slightly unusual amount of rigor to apply to a game about space, and it is the reason the current version is better than the first one rather than just different.

cd /building