Live data from Hacker News

A game where you're an OS and have to manage processes, memory and I/O events

github.com

71–80 of 85 posts

Re: A game where you're an OS and have to manage processes, memory and I/O events

#71
The game got too tedious to play by hand, so I wrote a script to play it automatically. It handles CPU, I/O, and processes quite well - but doesn't recognize a crown on a process and doesn't handle memory management at all.

I found that even on the easy level, the number of processes keeps growing slowly, and there isn't enough CPU time to keep all processes satisfied. I feel like the game is inherently setting you up for failure. Here is the script if anyone wants to play with it:

  // ==UserScript==
  // @name     Auto-play "You're the OS!" game
  // @include  https://plbrault.github.io/youre-the-os/
  // ==/UserScript==

  (async function() {
      const IO_EVENTS = {x: 160, y: 25};
      const CPUS = 4;
      const CPU1 = {x: 50+46, y: 50+42};
      const SQUARE = {w: 64+5, h: 64+5};
      const PROCESS = {x: 50+46, y: 155+42};
      const PROCESS_ROWS = 6;
      const PROCESS_COLS = 7;
      
      let cnv = document.querySelector("body > canvas");
      while (cnv.width != 1280 || cnv.height != 720)
          await new Promise(res => setTimeout(res, 100));
      
      while (true) {
          const pixels = new Uint32Array(cnv.getContext("2d").getImageData(0, 0, cnv.width, cnv.height).data.buffer);
          function getPixel(x, y) { return pixels[y * cnv.width + x]; }
          
          if (getPixel(IO_EVENTS.x, IO_EVENTS.y) == 0xFF808000);
              await pressKey("Space");
          let cpuStatuses = [];
          for (let i = 0; i = 3)
                      processStatuses.push({r, c, status: s});
              }
          }
          
          processStatuses.sort((a, b) => a.status - b.status);
          for (let i = 0; i = 2)
                  await pressKey("Digit" + "1234567890".charAt(i));
              const p = processStatuses.pop();
              if (p !== undefined)
                  await clickMouse(PROCESS.x + SQUARE.w * p.c, PROCESS.y + SQUARE.h * p.r);
          }
          
          await new Promise(res => setTimeout(res, 300));
      }
      
      async function clickMouse(x, y) {
          const rect = cnv.getBoundingClientRect();
          const opts = {
              bubbles: true,
              clientX: rect.left + x * rect.width / 1280,
              clientY: rect.top + y * rect.height / 720,
          };
          cnv.dispatchEvent(new MouseEvent("mousemove", {...opts, buttons: 0}));
          cnv.dispatchEvent(new MouseEvent("mousedown", {...opts, buttons: 1}));
          cnv.dispatchEvent(new MouseEvent("mouseup", {...opts, buttons: 0}));
          await new Promise(res => requestAnimationFrame(res));
      }
      
      async function pressKey(code) {
          cnv.dispatchEvent(new KeyboardEvent("keydown", {code, bubbles: true}));
          cnv.dispatchEvent(new KeyboardEvent("keyup", {code, bubbles: true}));
          await new Promise(res => requestAnimationFrame(res));
      }
  })();

Re: A game where you're an OS and have to manage processes, memory and I/O events

#72

Earlier quoted context omitted.

Also consider RTS elements, like assigning certain schedulers to handle workloads which are swappable and tuneable, maybe with some skill tree unlocks.

unlimited possibilities to expand the game scope through a tech tree: - Hyperthreading - interrupts - compressed main memory - L3 caches - TLB caches - CFS - cgroups - TSO/GSO - performance / efficiency cores - dynamic clock speed - thermals - PCI bandwidth / lanes - ... Game could start with a single CPU and 2-3 processes and then all this comes on top step by step and you can automate it away through tech tree.

Severe Running direct process scheduling keyboard control game mechanic!

https://www.youtube.com/watch?v=lrUWFo2D1Xs

Re: A game where you're an OS and have to manage processes, memory and I/O events

#73
post #30

This would be huge if it was « rogue like », where you could buy new more performant components that allow you to reach further into the game. The game makes you naturally lose, and there are milestones that you can reach (bosses, or loot that stays throughout sessions). For instance you could unlock GPUs, docker containers, another SSD, antiviruses…

Also consider RTS elements, like assigning certain schedulers to handle workloads which are swappable and tuneable, maybe with some skill tree unlocks.

[deleted]

Re: A game where you're an OS and have to manage processes, memory and I/O events

#74
post #3

Rebooting could be a mini-game where you dodge the user's BIOS keystrokes a few times before they give up

The absolute bane of my existence, I had a time a week ago repairing my bootloader after I (stupidly) did 3 months of windows updates after running a bunch of disk repairs and other recovery based things after I (again, stupidly) fell for a fake repo for deepseek tui and infected myself

Oh man, you've had a week from hell my friend. Uploading virtual platonic data-free hugs

Re: A game where you're an OS and have to manage processes, memory and I/O events

#79
Education is the space that I'm hoping AI with unearth, and games like this could become a common part of the education. I totally see kids playing something similar for hours, learning core CS concepts and benefiting. Perhaps making a shooter would be awesome too: reclaiming memory, collecting cycles and energy and resources to train the model.

Another hope I have that we could learn math/physics that way. Having a better more visual and intuitive understanding of some math concepts would be great. Perhaps having a truck go through the plot of a function and learning about limits and maxima and minima would be great etc. Same story: playing something like this for several hours could burn in kid's/adult's mind a pattern of undersatnding calculus that would last a lifetime.

Post reply on HN