OS13k — An Unofficial Trophy And Music System for JS13k

Aug 20 · 5 min read

Hello everyone, I am here to share a surprise we’ve cooked up for this years JS13k. As most of you know, all JS13k games share the same local storage, which can be problematic because every game needs a unique prefix to avoid name collisions. We’ve turned that bug into a feature: a shared trophy and music system that any JS13k game can opt into! If that isn’t enough, we’ve created an entire pseudo operating system to tie it all together.

Image for post
Image for post

Welcome to OS13k

Have you’ve heard of fantasy consoles like the Pico-8? Well, the best way to explain the vision behind OS13k is a fantasy OS and tiny game engine for creative coders. The OS is simple enough for anyone to use and has some powerful features for advanced users.

  • ZzFX sound effects with support for sound seeds
  • ZzFXM music system, player, and visualizer
  • Trophy system with popups and viewer
  • Custom HTML, Dwitter, and Shadertoy programs with live editing
  • GUI with window manger, taskbar, tray and settings
  • Mobile/touch support

We have been hard at work getting this ready for the past few months, and the full source code is now available on GitHub!

One of the coolest features of OS13k is the ability to track trophies and music across all JS13k games and that’s what this post is about, so let’s get to it!

Image for post
Image for post


There’s something really fun about building a collection of trophies across many games. It gives players a sense of progress and a reason to return later with only minimal overhead.

The trophy system for OS13k mimics what you would expect to see on a modern game console though simplified. Each trophy has only 4 parts…

  • Icon — One or more characters or emojis
  • Game Name — Name of your JS13k game
  • Trophy Name — Name of the trophy
  • Message — Optional message for the trophy

To unlock a trophy in your JS13k game, simply add the following code, replaced with your trophy’s info…

localStorage[‘OS13kTrophy,Icon,Game Name,Trophy Name’] = Message

When other JS13k games unlock trophies, OS13k will automatically detect new trophies, show a popup, reads the trophy name aloud, and add it to the user’s trophy case! It will also show a popup whenever the message for a trophy changes.

This works by looking for local storage for keys that begin with OS13kTrophy. The rest key is then split at commas to get the trophy parameters. OS13k will even listen for local storage events to detect new trophies while running in the background.

A few more things to be aware of…

  • HTML tags and commas can’t be used in trophy strings
  • You can track data with trophies for unlocks or high scores
  • Don’t abuse the system, lets limit it to 10 trophies per game
Image for post
Image for post

ZzFXM Music

The music system was developed by Keith Clark and myself. It is designed specifically for size limited productions like JS13k games. You can learn more and hear a demo on GitHub.

Musical instruments are played using ZzFX sounds. I had originally developed ZzFX as a tiny sound effects tool, and used it for my 2nd place JS13k game last year. Since then I’ve added even more features, doubled the parameters, and improved the sound designer.

Combining sound effects and music into the same system with songs that zip efficiently, makes it extremely useful for JS13k games. We are working on a native sequencer that should be ready soon, so look out for that.

If you use ZzFXM for music in your game, there is a small optional step needed to register it with the user’s OS13k music library. Simply use the following code, replacing the parameters with your song…

localStorage[‘OS13kMusic,Song Name’] = JSON.stringify(song)

When the OS13k music player next loads, it will check local storage for any new music, verify if it is valid, and add it to the user’s library! Users can also manually add music by clicking the load button and pasting in the code.

User Programs

Advanced users can extend OS13k by adding custom programs. The system automatically detects if it is HTML, Dweet, or Shadertoy code. Everything is saved in local storage for when the user returns and accessible via the menu.

You can live edit user programs to experiment with creative coding, it’s a great sandbox to play around in for beginners or experts! All of OS13k’s features are available to user programs with some extra tools to help with live editing, debugging, and file management.

Image for post
Image for post

JS13k and Beyond

The focus right now is on JS13k and this is all very experimental so it will be interesting to see how things turn out. After JS13k we will continue developing OS13k and adding more apps. I already snagged www.os13k.com, it just redirects to the GitHub for now though.

Join Us

I could not have done this alone! There were many people involved, listed on the GitHub page. Right now we are focused on making tiny games to fill out the JS13k build. If you are interested in helping out and joining our group JS13k entry, join the Discord server or send me a pull request. Either way we’re looking forward to earning some fun trophies and hearing your music.

Thank you for reading, and good luck on all of your JS13k games! You can follow me on twitter for more tiny coding adventures.


Js13kGames is a JavaScript coding competition for HTML5…


Written by


Js13kGames is a JavaScript coding competition for HTML5 Game Developers. The fun part of the compo is the file size limit set to 13 kilobytes. It runs between August 13th and September 13th, online since 2012.


Written by


Js13kGames is a JavaScript coding competition for HTML5 Game Developers. The fun part of the compo is the file size limit set to 13 kilobytes. It runs between August 13th and September 13th, online since 2012.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store