Space Jam (JS13k 2021)
This is an overview of my entry for the JS13k competition in 2021. The aim of the competition is to build a browser-based game in under 13kb of compressed source code.
Space Jam is a spatial rhythm game. The gameplay involves placing instruments on a map in order to earn the in-game currency, called "notes". Instruments play sounds when nearby oscillators strike them. When sounds are played, notes are earned, allowing the player to purchase additional sounds for sequencing as the gameplay unfolds.

My primary goal this year was to validate this idea I'd had in my head for a while: that musical instruments could be used to build a settlement of sorts. Similar to how a player would build up their farm in a game like Stardew Valley. So I stayed focused on implementing the bare minimum that would allow me to validate the idea. If I did a good job executing the core aspects of the game, and players thought it was fun, then I would consider the idea validated.
Notable Features
Some interesting features I managed to squeeze in this year:
- Generative artwork: The backdrop of the game is generative and slightly different every time the page is loaded.
- Audio-reactive artwork: the game's audio runs through an
AnalserNode
, where the total volume is used to animate the rings around the map. - Canvas2D Game Entities: All game entities were designed with Canvas2D. I focused on keeping the designs simple and geometric. Interestingly, I released this right before Squid Game came out and was amazed to see that both projects used the same shapes (circle, triangle, square) and a very similar shade of pink for their primary visual motif.

- Spatial audio: as the player moves the map, each instrument responds by adjusting its output between the L/R channels, as well as applying additional reverb and volume attenuation depending on how "far" it is from the player.
- Additive Synthesis: Using the WebAudio API, I built a
Sound
class capable of synthesizing all of the in-game sounds. Various oscillators and effects are combined in a chain to create unique synthesizers. - Twelve Synthesized Sounds: using the
Sound
base class, I built 12 synths mainly using trial and error and my prior knowledge of audio design. By abstracting the core synthesis function, I was able to keep each of these synths down to just a few lines of code. For example:
class OrganSound extends SynthSound { harmonics: number[]; constructor(args: ConstructorParameters<typeof Sound>[0] = {}) { super(args); this.harmonics = [1, 2, 4, 8]; this.envelopes = { amplitude: [ { time: 0, value: 0 }, { time: 0.05, value: 1 }, { time: 0.35, value: 0 } ], lpFilter: [{ time: 0.35, value: 0.001, exp: true }] }; this.effectOptions.baseReverb = 0.2; this.effects = { filters: [ { type: "lowpass", frequency: 2500, q: 0.71 }, { type: "highpass", frequency: 120, q: 0.71 } ] }; } }
Gameplay
Check out the gameplay preview below, or play the game for yourself over at https://js13kgames.com/games/space-jam/index.html
Outcome
Ranking
- Overall: 13 / 223
- Innovation 1 / 223
- Audio 5 / 223
Now we're talking. Placing #1 in the innovation category was a nice achievement for me, as I knew I was taking a significant risk with this type of game. I also had a much more balanced game in terms of gameplay, controls, and entertainment value. I think that came across in my #13 ranking overall. Needless to say, I'm happy with these results. But I do aim to crack the top 10 next year!
Ultimately my goal this year was to validate my novel game idea and to see if people thought it would be fun. Based on the feedback I got below I think it was a success. The outcome may someday inspire me to expand on this concept.
Select feedback from players:
- "Interesting take on the theme. Loved the concept and played for quite a bit. You get quite absorbed into trying to make a nice tune!" -dosaki
- "A really fun game, with a cool mechanic which is executed well." -XavierCooney
- "A fun experimental music/rhythm game. Maybe a x2 speed modifier would be good, or a square that once hit by a beat changes toggles between states." - picosonic
- "Super fun to tinker with, love abstract experiments like this! Great work!" -dbraddbrad
- "I took this entry personally since I wanted to make a strategic game or a rhythm game and then decided to make a rhythm game. Thank you for making me see how it's possible with music, I will never forget that." -michaelprimo
- "This is genuinely the best JS13K game I've ever played, the sound design is lovely, the graphics are so cute and it's just so relaxing and fun! Very very impressive work" -anonymous
- "This was a blast to play around with. I would have liked a way to the change the notes produced by musical blocks" -Rybar
- "Very unique and original, I loved it, very pleasing and creative!" -gagamoto
- "Neat! I love algorithmic music. I unlocked all of the instruments. The result has a very pleasant sound. Awesome execution." -codyebberson
- "Wow. It's a pity it's not really a game, but as an experience it's one of the best concepts in this years JS13k. I'd love to see it evolving into a full clicker-like idle game. Good job!" -michalbe
- "I absolutely love this. 10/10. The spatial audio blew my mind, I'm so gonna study the code :)" -mvasilkov
- "I really enjoyed this! Especially once you start building out your base/synth beyond the start area and you can pan around to mix between different sounds." -jaburns
- "Excellent! This game is so polished. With enough skill you could make some really cool beats." -kaseyhinton
- "This is really soothing, I love it" -BenjaminWFox