Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Piorjade

Members
  • Content Count

    13
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Piorjade

  1. The most efficient way that I know of would probably be double buffering. (The reason for that being the fact that direct GPU calls like set or setForeground take a certain amount of time depending on the tier and a good double buffering API has an algorithm that minimizes the amount of GPU calls)

    On the other hand I don't know if that's actually necessary for a text editor.

  2. 6 hours ago, noahthegame said:

    yeah... you are really late i susjecst you should have read the post up to this point before you writen your post

    I'm not interested in reading up posts which consist of passive-aggressive comments from the person that created the thread as you seemed not to appreciate the help of others and just cry and complain constantly.

     

    6 hours ago, noahthegame said:

    a guy all ready showed me a buffering api witch works and witch am useing, you didn't look back before you writen this did you?

    Yes I know but the way I understood your tears that I skimmed over I thought you didn't like the fact that the library he gave you only has one buffer and you thought it was a "bug" at first that you had to reboot or something like that.

     

    6 hours ago, noahthegame said:

    i think i made my self clear....

    What? The comment you quoted doesn't really clear up or negate what I've said. My comment you've quoted is basically the answer for your quote.

     

    Anyway, you don't seem like a person someone can talk to normally. You don't seem to appreciate help from others other than using a solution but still crying about something and answering other posts that don't fit your expectations with passive-aggressive comments so I'm done with you. 

    I recommend you not to post anything on this forum if you plan on being stubborn.

  3. OC's way of limiting GPU calls, making pixel-by-pixel drawing incredibly slow, is actually kind-of realistic. (it's only more extreme to compensate for good server performance)

    One way, which was already suggested, is to buffer every pixel and only draw the changes.

    Additionally to that you'd have to create some sort of algorithm, which groups pixels together to reduce GPU calls.

     

    Soo that is the general idea of some sort of double buffered graphics library for OC.

     

    I know how you're feeling and I didn't read every comment here but it seems like you've overreacted a bit.

     

    Anyway, if you're interested in a double buffering library that allows you to create multiple buffers, I've created one a day ago with a very simple "algorithm" to group the pixels together. (Although I DO NOT only draw the changes; I might add that if I have the motivation for it.) 

    Click here my dude

    You "require" this library and create a buffer with lib.createBuffer(xpos, ypos, width, height) which returns the buffer (table) containing some methods. Almost all of the drawing methods are called the same like from the GPU component api, although I did not add any documentation which means you'll have to look through the code yourself if you don't understand something.

    To draw the buffer call buffer.draw().

     

    Be aware that this is not really optimized and I didn't test resizing the buffers (but the methods are there). The RAM usage for a 160x50 buffer is actually acceptable (I think it was 134k free of 194k on a freshly booted OpenOS computer with 2x3.5 Memory) and it draws pretty fast although I did not test very complex images (I should've done that beforehand lol).

     

    (Sorry if I jumped into this conversation too late)

     

    EDIT:

     

    I might also add that if you plan on creating a window-based desktop environment and you see that the windows don't follow your mouse as fast as you drag them, it is not the fault of slow drawing (at least if you have a good double buffering library), instead it's the fact that the computer doesn't process events as fast as CC but maybe you already know that.

  4. On 16.4.2018 at 10:51 PM, Molinko said:

    I think this is why I think a 'grouping' algorithm(if thats what it's called..) would be useful. Yes, you have to iterate every 'pixel' for its data, but you dont have to draw every pixel one by one independently. If you've heard of MineOS, it has  a pretty beefy double buffering library. If you inspect the draw method you can get an idea of how it does grouping for gpu draw calls from its internal buffer. Just a suggestion in case i haven't been clear.. 

    I think I'll first try to set up a basic Operating System (I'm trying to make something like "miniOS", so basically imitate DOS a bit) and when the basic system is working, I'll try implementing your idea, if that's okay. :)

     

    Anyway, thanks for your help!

  5. On 14.4.2018 at 12:11 PM, CptMercury said:

    @Piorjade

    What also helps to speed up screen redrawing is to update your screen dynamically, so that you are only reprinting the areas that actually changed. Also if you are moving large areas on your screen, like scrolling or dragging, make sure to use the gpu.copy method.

    Yeah, that's true, but as I said, if I wanted to have "virtual terminals" (-> "windows") and they overlap and I wanted to redraw the one in the background, I somehow need the data that was on it before, which means I have to have its pixels stored somehow.

     

    Again, my methods involving having these pixels in a table lead to the whole redrawing process being really slow, as it would call a gpu method for every pixel.

  6. That's a great idea!

    The reason I wanted to make it is that I wanted to try to make an OS myself, idk really why lol.

    Anyway, I'll take a look at that buffer library that OpenOS apparently uses for I/O.

    EDIT:

    I experimented with process metadata and your answer regarding term.internal.open and I don't get why the process doesn't have a "window" entry in the data table and after you set that as the newly created window it only THEN prints to the new window, which is why I also don't get why you used term.bind in the beginning as that apparently doesn't redirect input/output, it binds these components to the current window/terminal (which is still the original one at in that moment) (I attached some screenshots)

    output.PNG

    code.PNG

  7. Okay, thanks for the tip.

     

    Another question (it isn't directly related to the topic, so if that's not good tell me and I'll create a new topic for it)

    If I wanted to make such a system myself (a self-made term API that allows creating multiple windows), how would I have to handle redrawing the content of them? I already tried having pixels saved in a table (with information like background- and foregroundcolor and which character they contain) but that made it really slow as it iterated through the whole table and made a gpu call for every pixel.

    I need redrawing if I for example have 2 windows overlap each other and I saw something in the OpenOS code about a stream for the ttys.

  8. So I am coming from ComputerCraft and the term API there is pretty straight forward and allows us to create windows to write / redirect to.

    Anyway, in the term API wikipage of OpenComputers there is for example the method term.bind with an optional parameter "window", the problem is I can't find any information about this parameter and I assumed that this would be the same kind of "window" as in CC and I won't have to write my own API for it.

    Do you guys know something about it?

  9. net API - The most basic DNS system

    How this works:

    • The DNS server constantly broadcasts out its information every 2 seconds on the specified port
    • The client APIs have a function to search for the next DNS server (they wait for the above information) which then sets the table containing the information to net.foundServer
    • Now the client APIs have the ability to call net.setDNS(net.foundServer.address) to lock to that DNS
    • With that the client APIs can now register and delete their URLs on this DNS server
    • Every other client who has that DNS server locked on too can look up your modem's address by calling net.resolve(url) [returns true/false and the message (either an error or the address)]

    Requirements:

    DNS server:

    • A setup with color support (it logs stuff on the screen and uses colors for that too)
    • Of course a wireless network card
    • My multitasking API which should be saved as "oc_multitasking_api"
    • At best: openOS (because it uses the keyboard and event api)

    Client:

    • The api
    • A wireless network card of course
    • And maybe an idea on how you can make use of it
    • At best: openOS (because it uses the event api)

    How to set it up:

    • Build a server / computer for the DNS server (look at the requirements)
    • Buld a computer for the client(s) (look at the requirements)
    • Create a new program to use the API
      NOTE: At boot, the API doesn't have a DNS server registered, you NEED to register it using net.listenForDNS() or directly putting in an address
      local net = require("net") --This needs to be called for every program which uses the API, which is normal
      net.listenForDNS() --This wont stop until it gets a message from a DNS server
      net.setDNS(net.foundServer.address) --Set the locked DNS to the actual address of the found server

       

    Functions:

    • listenForDNS() : Waits for a DNS server to broadcast it's information
    • registerURL([STRING]): Registers an URL for your modem's address  (Returns true/false with an (error-) message)
    • removeURL([STRING]): Removes the given URL from the DNS if it's yours (Returns true/false with an (error-) message)
    • setDNS([STRING]): Set the locked DNS' address to the given one
    • getDNS(): Get the currently locked DNS' address (returns the address of the DNS server's modem)
    • getPort(): Get the port which the API looks for messages from the DNS server
    • setPort([NUMBER]): Set the port which the API looks for messages from the DNS server
    • resolve([STRING]): Try to get the modem address of the given URL (Returns true/false with the address or an error message)
    • getURL([STRING]): The reverse of the above function (Returns true/false with the URL or an error message)
    • getAll(): Returns a table with every URL and the associated address on the DNS server (key = URL, value = address)

    Download:

    DNS server:

    Pastebin

    net API:

    Pastebin

     

    NOTE:

    The DNS server does currently not save the DNS list on reboot and it looks like it stops broadcasting when the computer stays on when closing the server / game.

  10. Soo I was kinda bored doing basically nothing when I thought about making an OS for OC, which I wanted to do for a long time now. I got pretty far, considering that I'm pretty new to OC, up to the point where it is supposed to start up background "services" at the same time. I didn't know that computer.pullSignal / event.pull doesn't let a coroutine yield (I copied the event and keyboard api over to my OS because I thought I didn't need to rewrite these things on my own) so I quickly had to think of a solution and came up with this.

    Functions

    Currently I made it usable for normal OpenOS so that everyone can use it:

    createTasklist(): returns a table with premade functions which will basically contain all of your tasks

    createTask(tasklist [tasklist table], name [string], func [string], env [environment table], disableG [bool]): creates a task using the given name, sets its environment to the given one , modifies event.pull (yes you need to have the event library available) and adds a sleep([number]) function which is the same as os.sleep() but only for the task

    quit([name]): if no name is given, it stops running all the tasks. if a name is given, it stops only the specified task

    runAll(tasklist): This is the main function. It is the main loop which iterates through every task until it gets a quit signal

    tasklist:clearLog(): clears the errorLog table and the log table inside the tasklist table

    tasklist:killTask([name]): Kills the task with the given name. However, I don't recommend this one and you should use quit([name]) for that

     

    Short explanation

    Basically it modifies event.pull (and adds sleep() if you need that) so that it doesn't pull an event, but adds a filter and lets the coroutine yield until it gets an event. (or it yields until it gets the event with the given filters OR until it times out) Which allows us to quickly iterate through every coroutine over and over again.

    Coroutines which don't yield for a while get killed but while they're not yielding they are basically pausing the whole computer until they time out.

     

    Code

    Pastebin

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.