{"id":13841491,"url":"https://github.com/KilledByAPixel/OS13k","last_synced_at":"2025-07-11T12:32:23.745Z","repository":{"id":53980162,"uuid":"266484942","full_name":"KilledByAPixel/OS13k","owner":"KilledByAPixel","description":"A Tiny OS and Mini Game Engine","archived":false,"fork":false,"pushed_at":"2022-11-22T22:39:02.000Z","size":3836,"stargazers_count":523,"open_issues_count":0,"forks_count":28,"subscribers_count":41,"default_branch":"master","last_synced_at":"2024-11-05T07:34:23.514Z","etag":null,"topics":["codegolf","dwitter","js13k","operating-system","shadertoy","tinycode"],"latest_commit_sha":null,"homepage":"https://os13k.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KilledByAPixel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-24T06:39:52.000Z","updated_at":"2024-10-21T11:41:24.000Z","dependencies_parsed_at":"2022-08-13T05:40:40.876Z","dependency_job_id":null,"html_url":"https://github.com/KilledByAPixel/OS13k","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KilledByAPixel%2FOS13k","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KilledByAPixel%2FOS13k/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KilledByAPixel%2FOS13k/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KilledByAPixel%2FOS13k/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KilledByAPixel","download_url":"https://codeload.github.com/KilledByAPixel/OS13k/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225715891,"owners_count":17512912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codegolf","dwitter","js13k","operating-system","shadertoy","tinycode"],"created_at":"2024-08-04T17:01:12.215Z","updated_at":"2024-11-21T11:31:05.220Z","avatar_url":"https://github.com/KilledByAPixel.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","JavaScript (485)"],"sub_categories":[],"readme":"# Welcome to OS13k!\nOS13k is a tiny operating system that fits in a 13 kb zip file.\n\nIt includes native support for Shadertoys, Dweets, ZzFX sounds, music, trophies, touch input, and much more.\n\n# [Live Demo](https://killedbyapixel.github.io/OS13k) -  [JS13k Submission](https://js13kgames.com/entries/os13k) - [Discord](https://discord.gg/n8vxUcZ)\n\n## What is OS13k?\n- OS13k is a tiny web based pseudo OS and game engine designed for creative coding purposes\n- The core of OS13k is around 10k zipped including all the system apps\n- OS13k can connect with other JS13k games via local storage to add music and trophies\n- Users can extend OS13k by addinng their own programs and shaders\n\n## Features\n- ZzFX sound effects with support for sound seeds\n- ZzFXM music system, player, and visualizer\n- Trophy system and viewer\n- Centralized input system\n- Custom user programs\n- Dwitter, ShaderToy, and WebGL support\n- GUI with window manger, taskbar, tray and settings\n- Mobile/touch support\n\n## Programming Info\n- OS13k stores it's list of programs in programs.js\n- For fast iteration when developing, most recent active window is opened on startup\n\nAdd an icon config to programs.js to register your program, examples...\n- [icon, src, width, height, flags, name, help, folder]\n- ['?','help.html']\n- ['✌️😄','system/systemTest.html',,,full|resize|code|sticky]\n- ['🌊','dweets/underwaterCavern.dweet.js']\n- ['☯','toys/infiniteYinYangs.shader.txt',500,500,full,'Put instructions here.']\n\n### Programs\n- OS13k can open any html file and it will work the same as if opened directly\n- Chrome is recommended, but Firefox is also supported\n- [Viewing OS13k locally may not work if it treats local files as cross-origin](https://discourse.mozilla.org/t/firefox-68-local-files-now-treated-as-cross-origin-1558299/42493/9)\n- Prefix all local storage keys with OS13kYourProgramName to prevent collisions during JS13k (use at least 2 letters)\n- When the reload button is clicked, OS13kReload is called if it exists instead of reloading the iframe\n- For development we recommend [VSCode](https://code.visualstudio.com/) with the [Live Server Plugin](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer)\n- You can also create a custom program to edit code directly in OS13k\n\n ### Trophies\n - Trophies are perhaps the most important part of OS13k and have many uses\n - Apps can register trophies for their games, the OS tracks which are unlocked\n - To unlock trophies use OS13k.Trophy(icon, gameName, trophyName, message)\n - You can pass in a value as the message, like a high score for example\n - *HTML tags and commas can not be used in trophy data*\n - When a new trophy is unlocked or the message is changed a popup will automatically appear\n - Total trophy count is shown in the taskbar and the trophy case shows all unlocked trophies\n - *You can use tophies to store data!* Use OS13k.GetTrophy to get a trophy message\n\n### Trophy Functions\n - OS13k.Trophy(game='', icon='', name='', message='') - Unlock a trophy\n - OS13k.GetTrophy(game, name) - Get most recent matching trophy, 0 if no trophy\n - OS13k.Trophies() - Get full list of trophy objects\n \n### Sound\n- ZzFx sounds are supported by default and several other audio functions are provided\n- ZzFX is open source sound effect generator with an easy to use sound designer https://zzfx.3d2k.com/\n- A seeded ZzFX sound player is available to save space with much smaller sound calls\n- OS13k.PlaySeed(seed, lengthScale=1, volume=1, randomness=.05, frequency) - Play a zzfx sound from seed\n- OS13k.PlaySamples(samples, sampleRate=44100) - Play audio samples\n- OS13k.Note(semitoneOffset=0, rootNoteFrequency=440) - Get frequency of a note on a musical scale\n- OS13k.Speak(text, language='en', stopSpeech, volume=1, rate=1, pitch=1) - Play speech of the text\n- Seeds can also be strings (will be hashed) or full ZzFX sounds\n- A custom gain node is created for every sound, use sound.gain.gain.value to change\n\n### Music\n- [ZzFXM by Keith Clark](https://github.com/keithclark/ZzFXM) is the music player\n- OS13k.PlayMusic(song) - plays the song with zzfxm\n- OS13k.GetAnalyser() - returns a 32x32 music analyser canvas\n- OS13k.GetAnalyserData(i) - returns index into a 32 length array of frequency volumes normalized between 0-1\n- OS13k.StringToMusic(string, validate) - Converts a string to a music array and checks if valid\n\n### System Calls\n- The OS13k object is set in your program after load, if you need it on load use parent.OS13k\n- zzfx also becomes available after your program loads and can be called directly\n- OS13k.CreateShader(canvas, shaderCode) - Create a shadertoy compatible webgl shader\n- OS13k.RenderShader(canvas, shaderProgram, time=0, frame=0) - Render a shader\n- OS13k.StripHTML(string) - Removes all HTML tags in a string\n- OS13k.Hash(string) - Returns numeric hash code for a string\n- OS13k.Popup(html, speak) - Shows a popup with html body and optional speech and sound\n\n### Math Library\n- OS13k.Random(max=1, min=0) - Get a seeded random value clamped between min and max\n- OS13k.randomSeed - You must set the seed before calling OS13k.Random\n- OS13k.Clamp(a, max=1, min=0) - Clamp value between max and min\n- OS13k.Percent(v, a, b) - Get clamped percent between a and b\n- OS13k.Lerp(p, a, b) - Lerp clamped percent between a and b\n\n### Dweets and Shadertoys\n- Programs with the extension .dweet.js or .shader.txt or will automatically load as Dweets or Shadertoys!\n- Dweets and Shadertoys are automatically paused when they don't have focus (after a 1 second warmup)\n- They also automatically have the show code option by default unless explictly disabled\n- Dweets can do anything that other programs can do including calling OS13k functions and ZzFX\n- Dweets and Shadertoys are automatically paused when not focused (unless awake is set)\n- Shaders support iTime, iFrame, iMouse, iResolution, and iChannel0\n- iChannel0 is an image of the previous frame, this can be used to make effects or store game logic\n\n### Input System\n- OS13k provides an easy to use input system to help eliminate redundant code\n- Call OS13k.Input(window) to get the input object\n- the object format is {x, y, keypress, keydown, mousex, mousey, mousepress, mousedown}\n- x and y is a -1 to 1 direction from WASD or direction buttons\n- mousex and mousey is the mouse position\n- wheel is the mouse wheel delta\n- keypress and mousepress are arrays, an element is 1 if that key is pressed\n- keydown and mousedown are arrays, an element is 1 if that key is down\n- *See System/Test/InputTest for an example*\n\n### Program Settings and Defaults\n- name - Display name (if absent will build nice name from camel case src filename)\n- src - Source filename\n- icon - Can contain html tags, fits about 2 emojis\n- don't close html tags, they will automatically be closed\n- width (720) and height (405) - Size of window (default is 16:9 aspect)\n- help (optional) - Help message, shows an icon on the window's titlebar (try to keep it short)\n- author (optional) - Name of creator\n- sticky (0) - Will automatically open of program on restart if it was open\n- reload (1) - Shows the reload option\n- awake (1) - Prevents window dim and and pausing dweets/shaders when not focused\n- full (1) - Enables full screen option\n- code (0) - Shows code option, defaults to true for dweets/shaders, help is shown instead if it exists\n- rezize (1) - Allows resizing the window\n- shortcut (0) - Shows shortcut icon on the desktop\n \n### User Programs\n - You can create and access custom programs in the user programs folder\n - *User programs have the same capabilities as any other program!*\n - It auto detects HTML (starts with \u003c), Shadertoy (has void mainImage), or Dweet\n - This can be used to iterate on dweets or small shaders, or to load a full program.\n - Drag and drop a file into the text box to load it\n - The screenshot button is available for Dweets and Shadertoys\n - User Dweets has loop protection to help prevent freeze ups, though it can still occur\n - Press Alt+Enter to reload when live edit is disabled\n - User programs will not run until clicked to prevent executing bad code\n\n ### Any JS13k game can add trophies and music, even if not part of OS13k!\n - *To add a trophy or music track, just save a special key to localStorage!*\n - The smallest way to add a single trophy (like for winning) is localStorage['OS13kTrophy,Icon,GameName'] = ''\n - For more control use localStorage['OS13kTrophy,Icon,Game Name,Trophy Name'] = Message\n - You can change the message to update the trophy, like a highscore for example\n - Music works the same way, use localStorage['OS13kMusic,Song Name'] = JSON.stringify(song)\n - OS13k automatically checks localStorage and display popups for new trophies and songs from other games\n - This is possible because all JS13k games share the same local storage! Pretty cool right?\n - You can test locally by pasting your trophy code into the OS13k's console app\n \n## Contribuitors\n\nMost of the OS was created by myself, but there were many other people helping out. Thank you to everyone for their efforts, I could not have done it alone!\n\n- Keith Clark - ZzFXM\n- Tomxor - Don't Fall\n- Niklas Berg - Shedding Snake\n- Pavel - Visualizer and 404\n- Rodrigo Siqueira - Sticky Note\n- Kang Seonghoon - Roadroller\n\nAdditional help by...\n\n- Katkip, Jaburns, Xem, Rebecca König, Cantelope, DaSpider, Lionleaf, Yurume, Magna, Thomas Brierley, Nicholas Ortenzio, Yuanchuan, Jani Ylikangas, Martinn Kleppe, Erik Sombroek\n\n![OS13k Image](/favicon.ico) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKilledByAPixel%2FOS13k","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKilledByAPixel%2FOS13k","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKilledByAPixel%2FOS13k/lists"}