Jump to content




Taskforce PREVIEW - Run multiple programs at the same time


  • You cannot reply to this topic
30 replies to this topic

#1 Jan

  • Members
  • 141 posts
  • Locationthe Netherlands

Posted 01 January 2013 - 02:01 AM

Introduction
After dropping the development of Frames a few months ago, I decided to make a successor for newer versions of computercraft. Although it has quite the same interface and functionality as Frames, it has different (and I hope better) code.

Little screenshot
Posted Image
Above: a craftOS-shell running lua
Below: the Taskforce taskbar with 3 tabs


Features
- Works on all sizes of displays, colored/non colored, even works on external monitors
- Has a windowmanager called 'tabland' that renders tabs, a taskbar and allows you to switch tabs with the TAB-key
- Has 'craftemu' which emulates the CraftOS shell, so you can run normal programs in a Taskforce tab.
- Mouse support for the taskbar

Upcoming Features

- Right-click menu for Tabs, with close and other API-programmable options.
- There will be a start-menu (letters 'tf') that works like a normal tab (Like the 'new tab' option in google chrome),
but I don't know exactly what I must put in there.
- The start-menu will have a right-click menu, so you can quickly shutdown, start a new shell Tab etc...


Instructions
- Run taskforce, press TAB to change tabs.
- Hold CRTL+T to exit Taskforce
NOTE: use "taskforce d" to enable debug labels


Download Latest version
Preview 3
http://pastebin.com/eBw7Mp2G


Changelog
- Preview 1 released
- Fixed term.clear bug in preview 2
- Added start menu, updated tabland to support mouseclicks in preview 3
API Documentation

Spoiler

License
Taskforce is public domain. This means you are free to use (parts of) the code in your own program.

Please report bugs and give me feedback, thanks :)

#2 gngz

  • Members
  • 31 posts
  • LocationPortugal

Posted 01 January 2013 - 02:10 AM

Very good.

#3 ds84182

  • Members
  • 184 posts

Posted 01 January 2013 - 02:08 PM

I love this :D
When I first released DSOS, I had something like this (pressing Home to go to shell, End to end the current program, and Page Up and Down to cycle programs)

#4 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 01 January 2013 - 04:18 PM

View Postds84182, on 01 January 2013 - 02:08 PM, said:

I love this :D/>
When I first released DSOS, I had something like this (pressing Home to go to shell, End to end the current program, and Page Up and Down to cycle programs)

I wouldn't use those exact keys. I believe some laptops lack end and home.

#5 kornichen

  • Members
  • 220 posts
  • LocationGermany

Posted 02 January 2013 - 03:36 AM

Is it real multitasking or are the not opened processes paused then?

#6 CoolisTheName007

  • Members
  • 304 posts

Posted 02 January 2013 - 05:00 AM

I think the first rendering engine is well done (ardera), might use as inspiration.

#7 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 02 January 2013 - 05:03 AM

Love this program!

I love the ability to run multiple Firewolf servers at once :D

#8 1lann

  • Members
  • 516 posts
  • LocationSeattle

Posted 02 January 2013 - 06:03 AM

This is awesome! Although for some reason it ain't work that well with firewolf :P I didn't really expect it to, though one strange problem is that the background color of firewolf becomes black :-/ Though don't get me wrong, this is reallyyy epic! :D

#9 Jan

  • Members
  • 141 posts
  • Locationthe Netherlands

Posted 02 January 2013 - 09:50 AM

View Postkornichen, on 02 January 2013 - 03:36 AM, said:

Is it real multitasking or are the not opened processes paused then?
It is real multitasking. The events are sent to each 'grab processor'. The grab processor will, in the case of craftemu, forward every event using coroutine.resume(), except when it key/mouse event and the tab isnt focussed.
Also graphics still work when the tab isnt active, because the rendering engines store the term call in an queue (voodoo), or write it in a raster (ardera).

View PostCoolisTheName007, on 02 January 2013 - 05:00 AM, said:

I think the first rendering engine is well done (ardera), might use as inspiration.
Thanks, I got the inspiration to write ardera from this program.
Though the code isnt similiar, the principle of storing the terminal in a table is.

A problem with Ardera is that rendering is very expensive. Each collumn and each row is printed individually.
Therefore I wrote Voodoo, which remembers the term commands in a queue, and 're-executes' them on rendering.
Because the queue could grow too big, it is 'rebuild' when it is larger than 3000 commands. (see code)


View PostGravityScore, on 02 January 2013 - 05:03 AM, said:

Love this program!

I love the ability to run multiple Firewolf servers at once :D

Thanks :)

View Post1lann, on 02 January 2013 - 06:03 AM, said:

This is awesome! Although for some reason it ain't work that well with firewolf :P I didn't really expect it to, though one strange problem is that the background color of firewolf becomes black :-/ Though don't get me wrong, this is reallyyy epic! :D

Hmmm, the background becoming black must be a bug indeed... I will look into it.
Thanks for the feedback!

EDIT: broken link fixed

#10 CoolisTheName007

  • Members
  • 304 posts

Posted 02 January 2013 - 10:29 AM

View PostJan, on 02 January 2013 - 09:50 AM, said:

Thanks, I got the inspiration to write ardera from this program.
Though the code isnt similiar, the principle of storing the terminal in a table is.

A problem with Ardera is that rendering is very expensive. Each collumn and each row is printed individually.
Therefore I wrote Voodoo, which remembers the term commands in a queue, and 're-executes' them on rendering.
Because the queue could grow too big, it is 'rebuild' when it is larger than 3000 commands. (see code)

term calls are the most expensive. I will try to optimize by detecting when I can do more with fewer term calls, e.g. detecting same color lines, ect.

#11 Jan

  • Members
  • 141 posts
  • Locationthe Netherlands

Posted 02 January 2013 - 10:50 AM

View PostCoolisTheName007, on 02 January 2013 - 10:29 AM, said:

View PostJan, on 02 January 2013 - 09:50 AM, said:

Thanks, I got the inspiration to write ardera from this program.
Though the code isnt similiar, the principle of storing the terminal in a table is.

A problem with Ardera is that rendering is very expensive. Each collumn and each row is printed individually.
Therefore I wrote Voodoo, which remembers the term commands in a queue, and 're-executes' them on rendering.
Because the queue could grow too big, it is 'rebuild' when it is larger than 3000 commands. (see code)

term calls are the most expensive. I will try to optimize by detecting when I can do more with fewer term calls, e.g. detecting same color lines, ect.
The voodoo.rebuild command actually does that, it renders all commands on an ardera field of cells, and then it searches for the fragments with the came front and back color, and puts it in a queue.
You can try to run 'taskforce d' , and then go to 'edit rom/programs/shell'.
When you go down you will see the queue command counter reach 3000, and then drop because of the rebuild.

Maybe the solution is to always do a rebuild before rendering?

voodoo.render = function(offx,offy,tab,target,skip)
if #tab.queue>3000 and skip==nil then
  voodoo.rebuild(tab)
end

NEWCODE:
voodoo.render = function(offx,offy,tab,target,skip)
if skip==nil then
  voodoo.rebuild(tab)
end

This would require some testing

#12 Jan

  • Members
  • 141 posts
  • Locationthe Netherlands

Posted 02 January 2013 - 11:34 AM

View PostJan, on 02 January 2013 - 09:50 AM, said:

View Post1lann, on 02 January 2013 - 06:03 AM, said:

This is awesome! Although for some reason it ain't work that well with firewolf :P I didn't really expect it to, though one strange problem is that the background color of firewolf becomes black :-/ Though don't get me wrong, this is reallyyy epic! :D

Hmmm, the background becoming black must be a bug indeed... I will look into it.
Thanks for the feedback!
The problem with the background was a bug in both rendering engines:
term.clear() resets the background and text color.
In the next release you will see this fixed

But the program is still not rendered fine, the title above is missing in some sites:
This is because the Tab is one row smaller than a default window, and therefore scrolling causes the
first line to dissappear.

There are 3 simple solutions:
- Do not render the bar at the top in Taskforce
- Do not render the bar at the bottom in Taskforce
- Do not render the taskbar temporary

What do you think is the best solution?

(a bit of off-topic question for all)
How should the start menu of Taskforce look like?

#13 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 02 January 2013 - 03:19 PM

I don't know if you've seen it before or not, but you may wish to take a quick look at the rendering function in my compositor API (a part of LyqydOS): https://github.com/l...ster/compositor

The relevant function starts at line 183. This is designed for character-bordered windows, and so must handle transparency between layers, but the final draw of the buffer to the screen may give you some ideas or inspiration.

#14 pielover88888

  • Members
  • 66 posts
  • LocationIn a library that's in a village, huddling my advanced computer as zombies bang on the door.

Posted 03 January 2013 - 02:08 PM

Anybody notice that making the taskforce program the startup completely crash Computercraft Emulator, and lag and completely kill your actual computer? xD
Thank goodness that Opera has "Open from last time" ;D

#15 CoolisTheName007

  • Members
  • 304 posts

Posted 04 January 2013 - 11:22 AM

Last time I checked, after a term.clear() font color isn't reset, so the voodoo engine makes some extra operations.

#16 kornichen

  • Members
  • 220 posts
  • LocationGermany

Posted 04 January 2013 - 10:51 PM

Maybe I can use it in KREOS to run more than one program?

#17 Jan

  • Members
  • 141 posts
  • Locationthe Netherlands

Posted 05 January 2013 - 02:15 AM

View Postkornichen, on 04 January 2013 - 10:51 PM, said:

Maybe I can use it in KREOS to run more than one program?
Sure, you may use (parts of) my code if you want :)

#18 kornichen

  • Members
  • 220 posts
  • LocationGermany

Posted 05 January 2013 - 02:26 AM

View PostJan, on 05 January 2013 - 02:15 AM, said:

View Postkornichen, on 04 January 2013 - 10:51 PM, said:

Maybe I can use it in KREOS to run more than one program?
Sure, you may use (parts of) my code if you want :)

Thank you!

#19 Jan

  • Members
  • 141 posts
  • Locationthe Netherlands

Posted 07 January 2013 - 08:37 AM

Update: in preview 3 you can click on the letters 'tf' to open a start menu :D
It is very primitive, but it works. Also you can click on other Tabs to focus them.

#20 seal6000

  • Members
  • 9 posts
  • LocationEdinburgh, Scotland

Posted 07 January 2013 - 09:04 AM

I found a bug.

The tab all say MISSINGNO

Posted Image

The other thing I want to point out is that you should make it so you cant run taskforce inside a taskforce tab, creating "taskception"





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users