Giter Site home page Giter Site logo

plbrault / youre-the-os Goto Github PK

View Code? Open in Web Editor NEW
1.7K 9.0 60.0 5.21 MB

A game where you are a computer's OS and you have to manage processes, memory and I/O events.

Home Page: https://plbrault.github.io/youre-the-os/

License: GNU General Public License v3.0

Python 100.00%
game os pygame python webassembly

youre-the-os's Introduction

You're the OS!

This is a game where you are the operating system of a computer. As such, you have to manage processes, memory and I/O events. Make sure not to leave processes idling for too long, or the user will get really impatient and reboot you!

You can play the game here: https://plbrault.github.io/youre-the-os

Also available on itch.io.

In-game screenshot

Prerequisites

  • Python 3.11
  • pipenv
  • An empty .venv directory at the root of the project

Usage

Install dependencies:

pipenv sync --dev

Run as a desktop app:

pipenv run desktop

Run web version:

pipenv run web

Run with an automated script:

(Implemented by @Wiguwbe)

pipenv run auto <script.py> [args]
# to get all the available options
pipenv run auto --help

See automated_example.py for more info on API.

Build web version without running:

pipenv run web build

Create web.zip archive for itch.io:

pipenv run web archive

Run linter:

pipenv run pylint

License

Copyright (c) 2023 Pier-Luc Brault [email protected]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Asset Licenses

youre-the-os's People

Contributors

kenakofer avatar nonepork avatar plbrault avatar wiguwbe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youre-the-os's Issues

[Feature Request] Prevent OOM

Hello, I'm writing an "automatic" version of this game: let the program play itself.

But it seems like that the amount of processes will keep increasing, leading to the "Out of Memory" problem: both RAM and swap space are filled with pages, making any page swapping impossible and causing user ragequits.

In real OS, the system kills some processes to prevent this, so I think the "OOM" problem is unintended and should be fixed.

I have a dirty solution:

# /src/game_objects/pages_manager.py
    def is_oom(self):
        for ram_slot in self._ram_slots:
            if not ram_slot.has_page:
                return False
        for swap_slot in self._swap_slots:
            if not swap_slot.has_page:
                return False
        return True

# /src/game_objects/process.py

    def update(self, current_time, events):
    # ...
        if not self.has_ended:
    # ...
            if self._has_cpu and self._page_manager.is_oom():
                self._terminate_gracefully()

If you think it's a good idea, I can open a Pull Request.


EDIT: My solution will cause a UI bug in the "automatic" version.

highscores/scoring

Some questions about scores:

1 .Some way to keep track of (personal) high scores?
Either stored client-side (web storage), or on itch.io / server?

  1. Another thing is, that I get way higher score on EASY (500k, 10 minutes) than on NORMAL (150k, 4 minutes), it could be nice to give higher rewards on harder difficulties, to incentivize the harder difficulties?

  2. Bonus points when you gracefully terminate a process? Gives some incentive to focus more on processes with lower id, also clears out RAM more efficiently that way. Maybe even visualize the progress of a process somehow.

Hope to improve official multilingual support as soon as possible to avoid (potential) conflict

In fact, this Issue is not to ask the author for anything, but a reminder for those who want to do multilingual translation in the future, let him/her/they know that someone is already doing translation work in a certain language, because I have seen that there is no Issue about multi-language support, so I plan to translate directly and submit a PR initially.

However, before start to translate, I took a glance at the currently active forks... It's amazing, there are already two forks working at the Chinese(Simplified) at the same time:

Content comparison by @Steve-xmh vs Content Comparison by @justjavac

Finally, I think I should point out that I'm just a passer-by, so while I hope that if possible any developer looking to translate "youre-the-os" can reply here which language that he/she/they want to add, my advocacy has nothing to do with the original author and does not represent the opinions of plbrault


其实这个Issue并不是为了向作者请求什么,因为我看了一下没有任何一个Issue是关于多语言支持的,因此我就打算直接动手翻译然后交一个PR

不过,在开做之前,看了一下目前活跃的fork……不得了,已经有甲乙两队在同时施工了

@Steve-xmh内容对比@justjavac内容对比,都是添加中文(简体)的多语言支持

(因此我保留了这段中文Issue文本,希望下一个想要翻译它的人不要再发明一次轮子,感觉本项目在短时间内获得的关注与中文编程社区内的快速传播有密切关系)

Hyperthreading

Each CPU can handle 2 processes but performance does not become 200% because of the random competition of cache. And processes are not assigned to CPU that already has a process, unless no CPU is empty.

bug: time keeps on counting when paused

Pausing the game by clicking the Menu button, the time counter is actually not stopped, only visually. Upon closing the menu, resuming the game, the time jumps like it was counting on during pause.

keyboard support

Thank you for making a creative and fun game.

It could be nice to have some key bindings, like:

  • numeric keys could correspond to the CPU no
  • i/o event button bound to some other key

i'm not sure what would be a good way to bind the processes, however.

More gamification needed

When I play the game, I get frustrated over time that I can't manage the game anymore and the time reward is not enough. I'd be happy if there was something like tetris levels. I could track my progress that I can sustain for example level 6 indefinitely and on level 7 I can last only 2 minutes or so. Further "level up" cues would be awesome too.

Also for my purposes, I'd like to have the option to make the tiles smaller. I'm having troubles with my mouse accuracy and would like to improve it in this game.

Add disincentive to spam spacebar

Since key bindings have been introduced, the player can constantly spam the spacebar instead of handling I/O events when they come in. I would like to introduce a consequence when pressing the spacebar / clicking the I/O events button in absence of events. The consequence(s) remain to be determined. Here are a few ideas:

  • Remove points
  • Make it longer for active processes to become green
  • Add some kind of cooldown

If the solution could make sense on an OS theory point of view, that would be even better.

Suggestions are welcome!

Suggest implementing level mode?

  1. The process of alternating tension and relaxation

  2. Stage victories at levels

Can bring more satisfaction

  1. It seems like an infinite mode now

I know some people may like this, but it can provide a more popular and impressive way: for example, persisting for 5 minutes and 10 minutes each will bring a certain level of celebration animation

It's a very moving, thought-provoking game

This game is so hard, and now I understand my os deeply.
I would never reboot my os no matter how laggy it is.
Im gonna shut down all user processes and let it have a good rest.
And i will go to sleep too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.