Learn with GameBuilder™
See how your game works.
The bots write real code. Find out how they think, then take a game apart and change it yourself.
Everything here is free to try. No sign-up.
How the bots build it
An AI model writes your game one piece at a time. Nine stops show how, each with something to try.
The idea: a bigger model holds more of a change at once, and costs more for every piece.
Take it apart
Every game is the same few parts. Tap one and its lines light up.
The values at the topLines 4 to 10
Numbers, colours and words with names, set before anything else runs. The code below uses the names, so changing a value here changes it everywhere the name is used. A good place to start.
const FRUITS = [ { color: '#ff5d5d', points: 10, r: 15 }, { color: '#ffb347', points: 10, r: 15 }, { color: '#ffe15d', points: 20, r: 11 },];const BASKET_Y = 585;const BASKET_W = 74;initthe start of a roundLines 13 to 15
Runs once when a round starts. It hands back the state: everything the game has to remember while you play, the score included.
init(api) { return { score: 0, caught: 0, combo: 0, best: 0, x: api.width / 2, items: [], pops: [], next: 0.6, shake: 0 }; },updatethe rulesLines 17 to 70
Runs 120 times a second, and each run is called a tick. It reads where your finger is, moves everything on a tiny step and decides what happens: a hit, a miss, a point. It is the only part that changes the state.
update(state, input, api) { // The basket glides toward the finger; arrow keys work too. let target = input.down ? input.x : state.x; if (input.pad & 4) target = state.x - 8; if (input.pad & 8) target = state.x + 8; state.x = api.clamp(state.x + (target - state.x) * 0.3, BASKET_W / 2, api.width - BASKET_W / 2); // Drops come quicker as the clock runs, and never straight onto the basket: catching means moving.46 more lines
drawthe pictureLines 72 to 106
Paints the screen every frame from what the state says. It only paints and never changes the game, so a new colour here changes the look and nothing else.
draw(ctx, state, api) { if (state.shake > 0) ctx.translate(api.range(-4, 4) * state.shake * 3, 0); ctx.fillStyle = '#1f6b3a'; ctx.fillRect(0, api.height - 30, api.width, 30); for (const it of state.items) { const r = it.bomb ? 14 : FRUITS[it.kind].r; ctx.fillStyle = it.bomb ? (api.tick % 20 < 10 ? '#ffe15d' : '#ff8a3d') : '#5fd068'; ctx.fillRect(it.x - 2, it.y - r - 6, 4, 7);27 more lines
hudthe small numbersLines 108 to 110
Hands HiScore up to three small stats to show under the clock, like COMBO. The score is already there, so these are the extras.
hud(state) { return [{ label: 'COMBO', value: 'x' + Math.min(state.combo, 5) }, { label: 'CAUGHT', value: state.caught }]; },detailthe line on the boardLines 112 to 114
Writes one short line to sit beside the score on the board. It sums up the round in a few words.
detail(state) { return state.caught + ' caught · best combo x' + Math.min(state.best, 5); },demothe bot that playsLines 117 to 124
A bot written into the game. Every tick it says where a finger would be, and the game plays itself with that. It plays every preview, and one of the test rounds when you save.
demo(state, api) { let target = null; for (const it of state.items) if (!it.bomb && (!target || it.y > target.y)) target = it; if (!target) return { x: state.x, y: 560, down: false }; let x = target.x; for (const it of state.items) if (it.bomb && it.y > 420 && Math.abs(it.x - x) < BASKET_W) x += it.x < x ? 40 : -40; return { x, y: 560, down: true }; },Check what you know
Which part runs 120 times a second?
The idea: update is the game loop. Every game, and every app with something moving in it, has one.
Change it yourself
A glowing value is a dial. Turn one and the game starts again with your change in it.
Glowing values are dials
const FRUITS = [ { color: '#ff5d5d', points: 10, r: 15 }, { color: '#ffb347', points: 10, r: 15 }, { color: '#ffe15d', points: 20, r: 11 },];const BASKET_Y = 585;const BASKET_W = 74;Turn a dial. The game starts again with your change in it.
Check what you know
You change a colour inside draw and save. What happens to how the game plays?
The idea: a value has a name, so changing it once changes every line that uses the name.
Try to break it
Every save plays three test rounds first. Guess which of these changes gets saved.
Make the basket wider
const BASKET_W = 74;const BASKET_W = 120;Will it be saved?
- The demo
- Random taps
- Nobody playing
Move the basket off the screen
const BASKET_Y = 585;const BASKET_Y = 1170;Will it be saved?
- The demo
- Random taps
- Nobody playing
Make the red fruit blue
{ color: '#ff5d5d', points: 10, r: 15 },{ color: '#3355ff', points: 10, r: 15 },Will it be saved?
- The demo
- Random taps
- Nobody playing
The idea: code that tests code. Software teams run thousands of tests like these.
Watch it all in a minute
Fruit Fall taken apart, changed by hand, checked and played, then asked about out loud.
A short illustration, made from the Code view’s own screens and words on a real game: the code, the dials, the change and the check are real, and the bots’ answer is written to show what they do. Download the video
Questions
Do I need to know how to code?
No. Every part is explained in plain words, and every change is a dial you turn. You learn the code by changing it and seeing what happens.
Can I type my own code?
Not yet. You change the values that are safe to change. For something new, say it in Build and the bots write it; then open Code and see how they did it.
What uses GameBuilder tokens?
Building: every change the bots make uses GameBuilder tokens, by what the model used, and so does asking the bots a question in Code. The rest is free: this page, the tour, the dials, saving and playing. New accounts start with 250 GameBuilder tokens.
Where do I find it?
Open a game the bots wrote from scratch: Code is the fourth tab on a phone, or under the game on a computer. The model that builds it, the bot’s brain, is picked in Settings.
Can a class use it?
Yes. Everyone builds a game, then changes it by hand and explains what their change did. The questions check what they understood.
How old do you have to be?
Accounts, and so building, are for 13 and up. Anyone can play, with no sign-up. For a younger builder, build together on your account.
Build a game. Then open its code.
Say an idea, play what the bots build, then tap Code and find out how it works.