Jump to content




LyqydOS Beta/Development



189 replies to this topic

#101 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,464 posts

Posted 15 December 2013 - 02:47 PM

Yep! That allows me to optimize screen writes by finding the largest contiguously colored chunk of the current line and write it all at once. Between that and not redrawing unchanged portions of the screen, the upshot is that there are usually very few writes that need to be made on each yield, which saves bandwidth and helps to reduce flicker and slowness.

#102 Symmetryc

  • Members
  • 434 posts

Posted 15 December 2013 - 02:57 PM

View PostLyqyd, on 15 December 2013 - 02:47 PM, said:

Yep! That allows me to optimize screen writes by finding the largest contiguously colored chunk of the current line and write it all at once. Between that and not redrawing unchanged portions of the screen, the upshot is that there are usually very few writes that need to be made on each yield, which saves bandwidth and helps to reduce flicker and slowness.
I see what benefits it has, but couldn't the same benefits be exercised if you simply stored the color as a string of the number rather than a hex code? Ex: tostring(colors.black). That way you wouldn't lose efficiency when you have to convert the hex code into decimal and then raise 2 to the power of it (which, correct me if I'm wrong, takes a good bit of processing power, especially if 2 is being raised to 10, 11, 12, etc.) because you could just use tonumber(color).

Edit: So like you would have "512 512 512 8 1 " rather than "fffab23"

Edited by Symmetryc, 15 December 2013 - 03:42 PM.


#103 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,464 posts

Posted 15 December 2013 - 03:43 PM

That would either require a change to tables of tables of characters (as opposed to the current table of lines), or it would require a lot more work on the parts of the code that put the tables together, since I couldn't then overwrite the strings on a character-by-character replacement basis, I'd have to parse out where each color identifier was and handle it separately. Exponentiation doesn't seem to me to be terribly slow, so doing two of those operations per write isn't too hard on things. I think it would be slower to try to walk the table to find the length of the largest contiguous chunk, and I think it would be slower to have to parse out a string of numbers to try to find where to overwrite it. If I were simply overwriting the entire screen on every yield, it might be easier to use a table of tables of characters/numbers, of course.

#104 Symmetryc

  • Members
  • 434 posts

Posted 15 December 2013 - 04:51 PM

View PostLyqyd, on 15 December 2013 - 03:43 PM, said:

That would either require a change to tables of tables of characters (as opposed to the current table of lines), or it would require a lot more work on the parts of the code that put the tables together, since I couldn't then overwrite the strings on a character-by-character replacement basis, I'd have to parse out where each color identifier was and handle it separately. Exponentiation doesn't seem to me to be terribly slow, so doing two of those operations per write isn't too hard on things. I think it would be slower to try to walk the table to find the length of the largest contiguous chunk, and I think it would be slower to have to parse out a string of numbers to try to find where to overwrite it. If I were simply overwriting the entire screen on every yield, it might be easier to use a table of tables of characters/numbers, of course.
Ah, I see. Thanks for clearing that bit up for me :).

#105 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 23 December 2013 - 04:33 AM

View PostSymmetryc, on 15 December 2013 - 02:57 PM, said:

That way you wouldn't lose efficiency when you have to convert the hex code into decimal and then raise 2 to the power of it (which, correct me if I'm wrong, takes a good bit of processing power, especially if 2 is being raised to 10, 11, 12, etc.) because you could just use tonumber(color).

Edit: So like you would have "512 512 512 8 1 " rather than "fffab23"

Raising something to a power is easy for a computer. It's just a simple bit shift, which is probably one of the quickest function a computer could perform. You do need a basic understanding of binary to get this though. Tonnes of stuff on the web for that.

Say you want to raise 2 to the power of 8:
2 in binary is 0010. When you perform a bit shift, all you're doing is moving all the 1s in the binary number to the left a certain number of places. So if we do a bit shift of 1 on the number 2, we get 0100 (see how the 1 moved 1 place to the left?), which in decimal happens to be 4. A bit shift of 2 results in 1000, which happens to be 8. Bit shift of 3 is 0001 0000, which is 16, 0010 0000 is 64, 0100 0000 is 128. See the pattern? So to raise 2 to the power of 8, we just perform a bit shift of 7, giving us 0001 0000 0000, or 256. You can use a bit shift in CC Lua using the bit API. Just bit.blshift(2, 7) (which gives 256) or bit.brshift(256, 7) (which gives 2) for left and right shifts respectively.

Edited by GravityScore, 23 December 2013 - 01:04 PM.


#106 Symmetryc

  • Members
  • 434 posts

Posted 23 December 2013 - 09:53 AM

View PostGravityScore, on 23 December 2013 - 04:33 AM, said:

View PostSymmetryc, on 15 December 2013 - 02:57 PM, said:

That way you wouldn't lose efficiency when you have to convert the hex code into decimal and then raise 2 to the power of it (which, correct me if I'm wrong, takes a good bit of processing power, especially if 2 is being raised to 10, 11, 12, etc.) because you could just use tonumber(color).

Edit: So like you would have "512 512 512 8 1 " rather than "fffab23"

Raising something to a power is easy for a computer. It's just a simple bit shift, which is probably one of the quickest function a computer could perform. You do need a basic understanding of binary to get this though. Tonnes of stuff on the web for that.

Say you want to raise 2 to the power of 8:
2 in binary is 0010. When you perform a bit shift, all you're doing is moving all the 1s in the binary number to the left a certain number of places. So if we do a bit shift of 1 on the number 2, we get 0100 (see how the 1 moved 1 place to the left?), which in decimal happens to be 4. A bit shift of 2 results in 1000, which happens to be 8. Bit shift of 3 is 0001 0000, which is 16, 0010 0000 is 64, 0100 0000 is 128. See the pattern? So to raise 2 to the power of 8, we just perform a bit shift of 7, giving us 0001 0000 0000, or 256. You can perform a bit shift in lua using the operator << for a left bit shift (moving the 1s to the left), and >> for a right bit shift (moving the 1s to the right). You can use a bit shift in CC Lua using the bit API. Just bit.blshift(2, 7) (which gives 256) or bit.brshift(256, 7) (which gives 2) for left and right shifts respectively.
Haha, yeah I'm rather familiar with binary logic, but to raise something other than 2 to a number is more complicated, so I completely disregarded the fact that the base was 2 in this situation :P, thanks for the heads up :).

#107 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 23 December 2013 - 12:59 PM

View PostGravityScore, on 23 December 2013 - 04:33 AM, said:

View PostSymmetryc, on 15 December 2013 - 02:57 PM, said:

That way you wouldn't lose efficiency when you have to convert the hex code into decimal and then raise 2 to the power of it (which, correct me if I'm wrong, takes a good bit of processing power, especially if 2 is being raised to 10, 11, 12, etc.) because you could just use tonumber(color).

Edit: So like you would have "512 512 512 8 1 " rather than "fffab23"

Raising something to a power is easy for a computer. It's just a simple bit shift, which is probably one of the quickest function a computer could perform. You do need a basic understanding of binary to get this though. Tonnes of stuff on the web for that.

Say you want to raise 2 to the power of 8:
2 in binary is 0010. When you perform a bit shift, all you're doing is moving all the 1s in the binary number to the left a certain number of places. So if we do a bit shift of 1 on the number 2, we get 0100 (see how the 1 moved 1 place to the left?), which in decimal happens to be 4. A bit shift of 2 results in 1000, which happens to be 8. Bit shift of 3 is 0001 0000, which is 16, 0010 0000 is 64, 0100 0000 is 128. See the pattern? So to raise 2 to the power of 8, we just perform a bit shift of 7, giving us 0001 0000 0000, or 256. You can perform a bit shift in lua using the operator << for a left bit shift (moving the 1s to the left), and >> for a right bit shift (moving the 1s to the right). You can use a bit shift in CC Lua using the bit API. Just bit.blshift(2, 7) (which gives 256) or bit.brshift(256, 7) (which gives 2) for left and right shifts respectively.

Don't you mean Java?

#108 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 23 December 2013 - 01:04 PM

View PostMudkipTheEpic, on 23 December 2013 - 12:59 PM, said:

Don't you mean Java?

Whoops :P I wrote that sentence then double checked, and found I had to use the bit API instead of those operators. Forgot to remove the original sentence. Yeah, most languages support the >> and << operator, including Java, C, and C++.

Edited by GravityScore, 23 December 2013 - 01:04 PM.


#109 Conan1981m

  • Members
  • 28 posts

Posted 28 December 2013 - 11:30 AM

This is awesome !
Kinda hard to see how much code it takes to make that runnin while it looks so simple using it ... :wacko:

I suggest you might add another menu point in the rightclick menu to add sort of start menu
or an icon on the desk like

Quote

-------------
| Progname |
-------------
or with different bg color,



-would be nice if it would safe the open program list like ... hard to explain ... lets say the firefox tabs are saved for next launch maybe ...
Im really noobish with coding, especially lua but as far as i can see, it might be possible to add some lines to procman and adding some sort of .ini file that open processes are saved in
while lws needs to clear the tabs then when closed maybe

I think this would be a step to an actual OS, like you stated its more like a window manager so far
and its pretty much using shell all the time with the chance to switch the window and run more tasks at once ..

ps: sorry for my bad english, i hope you get the meaning :P

Edited by Conan1981m, 28 December 2013 - 11:39 AM.


#110 logsys

  • Members
  • 171 posts

Posted 05 April 2014 - 05:06 PM

I have a suggestion:

How about a startup file that starts the programs inside your OS?
PS: I know computercraft 1.6 does that, but versions below don't. And 1.6 is not windowed

#111 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 18 April 2014 - 06:53 AM

Hello ! I've got a question for you, lyqyd : I want to study how you did all the multitasks things bit i'm a bit lost on the github ^^. Do you mind to guide me ? :)

#112 apemanzilla

  • Members
  • 1,421 posts

Posted 18 April 2014 - 11:57 AM

View Postbjornir90, on 18 April 2014 - 06:53 AM, said:

Hello ! I've got a question for you, lyqyd : I want to study how you did all the multitasks things bit i'm a bit lost on the github ^^. Do you mind to guide me ? :)/>
He used the coroutine API to let two different threads run in parallel.

#113 Symmetryc

  • Members
  • 434 posts

Posted 18 April 2014 - 02:54 PM

View Postapemanzilla, on 18 April 2014 - 11:57 AM, said:

View Postbjornir90, on 18 April 2014 - 06:53 AM, said:

Hello ! I've got a question for you, lyqyd : I want to study how you did all the multitasks things bit i'm a bit lost on the github ^^. Do you mind to guide me ? :)/>
He used the coroutine API to let two different threads run in parallel.
Except for the fact that they don't actually run in parallel.

#114 apemanzilla

  • Members
  • 1,421 posts

Posted 18 April 2014 - 03:16 PM

View PostSymmetryc, on 18 April 2014 - 02:54 PM, said:

View Postapemanzilla, on 18 April 2014 - 11:57 AM, said:

View Postbjornir90, on 18 April 2014 - 06:53 AM, said:

Hello ! I've got a question for you, lyqyd : I want to study how you did all the multitasks things bit i'm a bit lost on the github ^^. Do you mind to guide me ? :)/>/>
He used the coroutine API to let two different threads run in parallel.
Except for the fact that they don't actually run in parallel.
Eh, it's simpler than saying that they rely on collaborative control-switching to simulate multi-threading :P

#115 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,464 posts

Posted 18 April 2014 - 04:43 PM

View Postbjornir90, on 18 April 2014 - 06:53 AM, said:

Hello ! I've got a question for you, lyqyd : I want to study how you did all the multitasks things bit i'm a bit lost on the github ^^. Do you mind to guide me ? :)

So, procman is the process manager. It contains the coroutine manager, which receives events from the system and distributes them among the processes running in LyqydOS. When a program is started, either in the desktop program via the Run Program dialog, or via the start program, a coroutine is created and added to the process list. Some events are hooked by system processes (for instance, lws hooks all three mouse events), so the actual event distribution logic for those events is within those programs. Currently, the three programs with event hooks are lws, desktop, and lrnd.

That should get you started on your explorations.

#116 cdel

  • Banned
  • 496 posts
  • LocationMelbourne, Australia

Posted 02 May 2014 - 02:16 PM

hey Lyqyd, looks like a great os with some awesome features. However when I try to install I come across the following: /Users/redacted/Desktop/Screen Shot 2014-05-03 at 12.14.16 am.png

#117 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,464 posts

Posted 02 May 2014 - 02:59 PM

You'll have to actually upload the screenshot somewhere, I can't see it from your computer.

#118 cdel

  • Banned
  • 496 posts
  • LocationMelbourne, Australia

Posted 03 May 2014 - 05:50 AM

Oops sorry, thought I could just link it. here you go:

http://imgur.com/8dm9IN5

#119 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,464 posts

Posted 03 May 2014 - 06:54 AM

Looks like the emulator you're using doesn't like downloading things from github, either because it's too new and github isn't whitelisted, or because it's too old and can't handle https. You might try it in-game, ideally using one of the more recent versions of ComputerCraft.

#120 cdel

  • Banned
  • 496 posts
  • LocationMelbourne, Australia

Posted 03 May 2014 - 09:42 AM

Tried installing on a computer (minecraft 1.6.4, ComputerCraft 1.63) Worked fine, just had to tweak the http whitelisting! :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users