15th out of 317 at js13k 2026 - Out of Office (and Rainbowball 2) postmortem

blog


The js13kGames 2026 results are out and Out of Office, the game I did together with Alfred Ferrer, finished 15th overall out of 317 entries šŸŽ‰ It also got 5th place in gameplay and 6th in audio. I’m really happy with it, my last game before these two finished outside the top 100, and this year was a record in number of entries with a very high level.

15th
OVERALL
out of 317 entries
5th
GAMEPLAY
out of 299 ranked
6th
AUDIO
out of 275 ranked
4.6
PLAYERS' RATING
out of 5, 16 votes

Besides the 1k competitions, this year I also took part in js13kGames: a whole month and 13,312 bytes (zipped) to build a game. Compared to 1k it feels like a lot of space… until you start adding music, menus and a second enemy type šŸ˜…. The theme was Unicorns and Rainbows, quite different from the usual themes, and I ended up submitting two games:

Same as with my 1k entries, there are no images, audio files or fonts. Everything is generated by code at runtime. I’ll explain how both were built, mostly Out of Office, and at the end there are the full results and some of the feedback.

Out of Office

Build setup

Both games share the same build. There’s no bundler and no imports, all the files in src/ are just concatenated in filename order into a single scope:

00_boot        canvas and context
10_core        colour, rect, clamp, PRNG
12_font        3x5 pixel font
14_audio       oscillator blips
16_music       tracker
20_data        enemies, teams, perks...
30_state       all mutable game state
...
80_draw        rendering
82_screens     title, menus, game over
90_loop        fixed-step loop and render

The number in front of each file is the load order. It is important, as top-level consts are initialised in that order. After concatenating, the code goes through Terser, then Roadroller, and then it’s zipped with advzip, which saves around 400 bytes compared to a normal zip -9.

One problem with Roadroller is that its optimize does a random search, so packing the same code twice can give 10-20 bytes of difference. When you are a few bytes away from the limit you never know if your last change really saved something or not. So I froze the parameters it found in a JSON file and now the build always gives the same result:

const RR = JSON.parse(readFileSync('tools/heatmap-params.json', 'utf8')).options;
const packer = new Packer([{ data: code, type: 'js', action: 'eval' }],
                          reopt ? { allowFreeVars: true } : { ...RR, allowFreeVars: true });

The thing that surprised me the most is that a lot of my 1k tricks didn’t work here. Hoisting constants, packing data into strings or generating patterns instead of writing them, all of that ended up bigger once zipped than just writing the plain code. Roadroller compresses repeated code really well, it’s the different code what costs bytes. So, don’t look at the minified size, always look at the zip size.

Other things I learned the hard way:

  • with allowFreeVars the decoder is smaller, but it uses single letter globals. If any element has a single letter id it breaks, so the canvas is id=cv and not id=c as I always do on 1k.
  • if all strings are ASCII you can remove the <meta charset=utf-8>, a few bytes more.

I also had a small headless test for both games running the packed build on node-canvas. It plays a match (or a minute of game), takes the screenshots for the submission, and for Out of Office there’s a bot that plays full games and prints how difficult each wave is. Quite useful after removing bytes everywhere to see that nothing was broken.

Out of Office

The grey is the office. The bosses are its supplies. The goal is to be out of it.

Out of Office title

The Grey comes out of inkwells, drains the colour from the meadow and comes for you by hundreds, up to a thousand enemies at the same time. When you kill them, the colour they were holding goes back to the ground. Every 5 waves there’s a boss and all of them are office supplies: the CENSOR, the ERASER, the STAPLER, the STAMP, the SHREDDER and, every 40 waves, THE PHOTOCOPIER.

The horde

The prism

The default weapon is the PRISM. It shoots seven bullets, one for each colour of the rainbow, and each one with a different speed. So, the further the bullets go, the more they spread into a rainbow, similar to light going through a prism. Red is the slowest one and violet the fastest:

const HUES = [355, 25, 52, 120, 195, 235, 280];

// 7 bullets, a bit spread in angle, each one faster than the previous one
for (let b = 0; b < 7; b++)
  shot(x, y, an + (b - 3) * .055,   // angle
       2.4 + b * .28,               // speed
       1,                           // damage
       HUES[b],                     // colour
       55)                          // lifetime

There are also prism pickups that change the horn to a single colour with a different weapon: REDSHIFT (a hose), RAINBOW RAIL (a beam that goes through everything), GREEN GOO (puddles), BLUE FROST (slows enemies down), YELLOW ARC (chain lightning) and ORANGE BURST (a shotgun).

The meadow

The world is a grid of 320x180 cells with different greens. Each cell has a saturation value, the grey drains it when walking over it and bullets paint it back when they die:

// add k colour around a point
function paint(x, y, rad, k) {
  const cx = x / 8 | 0, cy = y / 8 | 0;
  for (let j = cy - rad; j <= cy + rad; j++)
    for (let i = cx - rad; i <= cx + rad; i++)
      if (i >= 0 && j >= 0 && i < GW && j < GH) {
        const n = i + j * GW;
        sat[n] = Math.min(1, sat[n] + k);
      }
}

function drain(x, y, k) {
  const n = cell(x, y);
  sat[n] = Math.max(0, sat[n] - k);
  // and anything walking over a flower tramples it
  fg[n] = 0;
}

When a cell is fully drained it becomes ash. On ash you move at half speed and the grey moves a third faster, so if you let an area go grey it becomes a trap. There’s also a flower on a third of the cells that grows depending on how much colour its cell has.

This was the part people mentioned the most on the feedback, and I think it helped a lot with the gameplay score. You can’t just run in circles as in most games of this genre, you also have to keep repainting the ground.

Sprites

Sprites are just arrays of strings, one character per pixel. The palette is a function that gets the character and its position, so the mane can be the seven colours by column and the tail by row without any extra data. This is the unicorn seen from above (H horn, M mane, T tail, F hooves):

const UNI = [
  '....FF......',
  'T..BMMMB....',
  'TT.BMMMMBE..',
  'TTBBMMMMBBHH',
  'TT.BMMMMBE..',
  'T..BMMMB....',
  '......FF....']

const uniPal = (ch, i, y) =>
    ch == 'B' ? C(40, 94, 30)
  : ch == 'H' ? C(45, 62, 100)
  : ch == 'M' ? C(HUES[(i - 3) % 7], 58)   // mane, colour by column
  : ...
  : C(HUES[y % 7], 58)                     // tail, colour by row

Each sprite is drawn once into its own canvas. To get a dark outline around it, the canvas has one extra pixel on each side and, before drawing each pixel, a 3x3 dark square is drawn behind it:

x.fillStyle = C(260, 10, 30);
rows.forEach((r, y) => [...r].forEach((ch, i) => { if (ch != '.') x.fillRect(i, y, 3, 3) }))
rows.forEach((r, y) => [...r].forEach((ch, i) => {
  if (ch != '.') { x.fillStyle = pal(ch, i, y); x.fillRect(i + 1, y + 1, 1, 1) }
}))

The zoo

A thousand enemies

Having a thousand enemies on screen and checking them against every bullet is too slow, so on every tick all enemies are added to a spatial hash. The world is split into cells of 16px and each cell has a linked list of the enemies inside it. The linked list is stored in two Int32Array, one with the first enemy of each cell and another with the next enemy for each enemy, so nothing is allocated when it’s rebuilt:

const HS = 16, HH = new Int32Array(HX * HY), HN = new Int32Array(CAP + 16)

function hashAll() {
  HH.fill(-1)
  en.forEach((e, i) => {
    const c = hc(e.x, e.y)
    HN[i] = HH[c]   // the previous first one is now our next
    HH[c] = i       // and we are the first one
  })
}

// call f for every enemy around a point
function near(x, y, f) {
  const c = hc(x, y)
  for (let j = -HX; j <= HX; j += HX)
    for (let i = -1; i < 2; i++)
      for (let n = HH[c + i + j]; n >= 0; n = HN[n])
        if (f(en[n])) return
}

Now bullets, separation between enemies, the goo or the blink only have to check 9 cells instead of all the enemies. With a thousand enemies a tick takes around 1ms. I could have used a quadtree, but as all enemies are more or less the same size and they move all the time, it would have to be rebuilt on every tick anyway, so a simple grid works better here.

Bloom

Everything that shines (bullets, sparks, explosions, pickups…) is drawn a second time into another canvas. That canvas is scaled down to 1/4, 1/8 and 1/16 of the screen with smoothing enabled, which gives the blur, and then it’s drawn on top of the screen with lighter as globalCompositeOperation (as I did with the background on Butterfly Sakura):

G2X.drawImage(G1, 0, 0, W / 4, H / 4)
G3X.drawImage(G2, 0, 0, W / 8, H / 8)
G4X.drawImage(G3, 0, 0, W / 16, H / 16)

X.imageSmoothingEnabled = true
X.globalCompositeOperation = 'lighter'
X.globalAlpha = .6
X.drawImage(G2, 0, 0, W, H)
X.drawImage(G3, 0, 0, W, H)
X.globalAlpha = .4
X.drawImage(G4, 0, 0, W, H)

The enemies and the unicorn are not drawn in this layer, so they stay flat and only the colours glow.

I also had a chromatic split on the glow, with two extra copies hue-rotated and moved a few pixels when you have a big combo. It was around 70 bytes for something you only see from time to time, so it was removed at the end. Same for a zoom out when running fast: it cost bytes and the scaling made the pixel art blurry. Both are saved as patches in the repo, maybe they’ll come back in a future version.

The office

Music

The music is a small tracker with the patterns stored as strings, scheduled with WebAudio a bit ahead of time. The rhythm is a gallop (12/8, with the third kick louder, it’s a unicorn game after all) and the chords are Am F C G. There’s a pad with detuned saws, an arpeggio with a delay, and a reverb generated from a second and a half of noise. Every few waves a new instrument is added, so the music gets more intense as the game gets harder. Also, when you kill an enemy, the sound is a note in the same key as the music, which goes up with the combo.

No audio files at all, just oscillators and noise, and it got 6th place in audio. Quite happy with that one šŸ˜Ž

There are also 35 perks with different rarities, a blink with 3 charges, pickups, the WHITE LIGHT mode and 12 achievements. The final zip was 13,306 bytes, only 6 bytes under the limit.

Perks

Rainbowball 2: Brutal Unicorns

Rainbowball 2

The second one is inspired by Speedball 2, one of the Amiga classics. Five players per team, a steel ball and no referee. A goal is 10 points, and sending a player of the other team to the ambulance is also 10 points. There are seven stars on each side of the pitch, and each star you light adds one point to both. If you get all seven on one side, the pitch goes full spectrum. Between matches there’s a management screen where you can train your unicorns and see who is injured. A season has four divisions and the last match is always against the DEATH RAINBOWS.

Title

The unicorns

All players are drawn with the same unicorn() function, around fifteen rectangles. Each team has a single hue and all the other colours are calculated from it. The different types of unicorns (PIXIE, BRUISER, SPARK, PEGASUS, TANKICORN, WIZARD) just change that hue a bit and add some pixels to the horn. Training is also visible: more STR makes the horn golden, SPD the hooves, and TKL adds a saddle:

r(3, 9, 2, 3 + g, shade); r(7, 9, 2, 3 + b, shade)     // legs
r(3, 11 + g, 2, 1, hoof); r(7, 11 + b, 2, 1, hoof)     // hooves, golden with SPD
r(2, 4, 7, 5, body)                                    // body
if (q[2] > 3) r(3, 5, 4, 2, armC)                      // saddle with TKL
r(6, 1, 2, 5, mane); r(3, 3, 2, 3, mane)               // mane
r(10 + fw, -1 - A.k, 1, 2 + A.k, q[0] > 3 ? gold : hornC)   // horn, golden with STR

I wanted the sprites to have an outline and some light on top. The first version did it with a loop over the pixels, but then I changed it to use only canvas composite operations, so nothing has to be read back from the GPU. The sprite is drawn into a 24x24 canvas and then:

  • outline: draw the sprite four times, moved one pixel up, down, left and right, and fill it with a dark colour using source-in.
  • light: draw the sprite and remove a copy of itself one pixel lower with destination-out. Only the pixels on the top edge remain, fill them with semi-transparent white.
// outline
X2.drawImage(OC, 1, 0); X2.drawImage(OC, -1, 0)
X2.drawImage(OC, 0, 1); X2.drawImage(OC, 0, -1)
X2.globalCompositeOperation = 'source-in'
X2.fillStyle = '#2a143a'; X2.fillRect(0, 0, 24, 24)

// light
X3.drawImage(OC, 0, 0)
X3.globalCompositeOperation = 'destination-out'
X3.drawImage(OC, 0, 1)
X3.globalCompositeOperation = 'source-in'
X3.fillStyle = 'rgba(255,255,255,.42)'; X3.fillRect(0, 0, 24, 24)

// outline, sprite and light
X.drawImage(O2, x0, y0); X.drawImage(OC, x0, y0); X.drawImage(O3, x0, y0)

The nice thing is that it works with any shape, not only with unicorns.

Open play

Arenas

Each arena is generated from a single number: the name, the colours, the size of the pitch and the goals, where the obstacles are, hazards (electrified obstacles, moving ones and ice), night matches and, in the last division, sometimes a pitch in the sky with no side walls. Everything comes from a small xorshift random generator using that number as seed:

function genArena(n) {
  let s2 = (n + 1) * 1103515245 + 12345
  const r = () => {
    s2 ^= s2 << 13; s2 ^= s2 >>> 17; s2 ^= s2 << 5
    return ((s2 >>> 0) % 100000) / 100000
  }
  // small seeds are not very random, skip the first numbers
  for (let i = 6; i--;) r()

  const hue = (n * 97 + r() * 60) % 360
  const A = {
    n: AN1[(n * 3 + r() * 10) % 10 | 0] + ' ' + AN2[(n * 7 + r() * 10) % 10 | 0],
    len: 640 + (r() * 6 | 0) * 48,
    gw: 46 + (r() * 4 | 0) * 6,
    // more hazards on higher divisions
    zap: r() < .1 + div * .1,
    move: r() < .1 + div * .1,
    ice: r() < .24 + div * .08,
    ...
  }
  ...
}

That gives names like CLOUD KINGDOM, CANDY FACTORY or THUNDER CIRCUS. Obstacles are always added in pairs, rotated 180 degrees around the centre, so both sides of the pitch are the same:

const add = (f, y, rr) => {
  A.bumps.push({ x: FL + PW * f, y, r: rr })
  A.bumps.push({ x: FR - PW * f, y: L - y, r: rr })
}

Rainbow rails

To add something of the theme to the Speedball formula, pressing R fires a rainbow rail: a curved wall made of 9 points of a quadratic BƩzier curve:

for (let i = 0; i <= 8; i++) {
  const u = i / 8, v = 1 - u
  pts.push([v * v * bx + 2 * v * u * mx + u * u * ex,
            v * v * by + 2 * v * u * my + u * u * ey])
}

Rails don’t belong to any team. When the ball gets close to one, I find the closest point of the rail and check the ball velocity against the rail normal. If it hits at a steep angle it bounces (and goes a bit faster), and if the angle is small it rides along the rail:

const nx = -h[4], ny = h[3]                  // rail normal
const dn = b.vx * nx + b.vy * ny             // velocity on the normal
if (Math.abs(dn) > sp * .55) {               // steep, bounce
  b.vx = (b.vx - 2 * dn * nx) * 1.18
  b.vy = (b.vy - 2 * dn * ny) * 1.18
} else {                                     // small angle, ride it
  const dir = b.vx * h[3] + b.vy * h[4] > 0 ? 1 : -1
  b.vx += (h[3] * dir * s2 - b.vx) * .4
  b.vy += (h[4] * dir * s2 - b.vy) * .4
}

If the ball rides a full rail, it splits into two balls at the end and both can score. And the DEATH RAINBOWS, of course, fire rails everywhere.

Goal camera

Font and music

The font is 3x5 pixels. Each row of a glyph is 3 bits, so it fits in one octal digit, and each glyph is 5 digits in a long string:

const FK = "0123456789ABCDEFGHIJKLMNOPRSTUVWXYZ-!?.+/",
      FD = "7555726227717477171755711747177475771222757577571725755656563444365556746477464434553557557222711152556554444757755655552555265644656553421672222555575555255775552555522271247007002220271302000020272011244"

function glyph(g, x, y, s, c) {
  for (let r = 0; r < 5; r++) {
    const b = +g[r]
    for (let i = 0; i < 3; i++)
      if (b >> (2 - i) & 1) R(x + i * s, y + r * s, s, s, c)
  }
}

(no Q, I didn’t need it šŸ˜Ž)

For the music there are two small trackers of three voices, with patterns of 32 steps stored as strings of digits. One is a calm pentatonic tune for the menus and the other one is techno for the matches. The kick is not in the pattern, it’s added in code every 4 steps, so the bass can play in between. It loops over 4 bars, on bar 2 everything goes up and on bar 3 the kick and the bass stop for half a bar, which makes it sound less repetitive:

['-0-0-0-5-0-0-0-3-0-0-0-5-0-0-0-7',   // bass
 '024-024-024-027-024-024-029-027-',   // lead
 '--H---H-S-H---H---H---H-S-H---H-']   // hats & snare

Some things didn’t make it, like the funny player names (SUSAN, DAVE, CUPCAKE III…) that were removed to save bytes. The final zip was 13,302 bytes, 10 bytes under the limit.

The desk

Results

There were 317 entries this year, a new record, and 299 of them were ranked. Out of Office got 15th overall, with a score of 22.25 (the first one got 24.18). These are the ranks for both games (audio is out of 275, as not all games have sound):

Ā  Out of Office Rainbowball 2
Overall 15th 76th
Gameplay 5th 76th
Audio 6th 84th
Efficiency 32nd 107th
Controls 36th 189th
Graphics 48th 37th
Theme 74th 78th
Innovation 97th 95th
Players’ rating 4.6 / 5 (16 votes) 4.13 / 5 (15 votes)

I’m really proud of the 15th place, and of the 5th in gameplay and 6th in audio. Going from outside the top 100 with my previous game to 15th is a big jump, and even Rainbowball 2 ended up inside the top 100. Rainbowball 2 did quite well in graphics but badly in controls, and the feedback says the same thing: many people found it too difficult from the first match, and someone suggested a key closer to WASD for the rails instead of R. Some of the comments I liked the most:

ā€œThe Bitmap Brothers couldn’t have done better, great stuff!ā€ (Rainbowball 2)

ā€œA Speedball 2 demake with unicorns. What’s not to love? […] it’s cool you managed to squeeze in divisions and team management.ā€ (Rainbowball 2)

ā€œI really liked the ā€œmeadow is a resourceā€ thing; it adds this additional gameplay layer that I need to repaint things and can not just go in circles over and over.ā€ (Out of Office)

For Out of Office, most of the critiques were about the balance. The powerups you need to survive the later waves can be too rare or too random, and 35 perks might be too many. Someone also asked for auto fire, which makes sense for this kind of game. All good notes in case I do a post-compo version.

Thanks a lot to Alfred Ferrer for doing Out of Office with me, and to everyone who played the games and left feedback. Both games can be played on the js13kGames site and the source code is on GitHub, with the build tools and the tests: