Jump to content




[1.4/1.5] Pixel Manipulation


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

#1 dimitriye98

  • Members
  • 77 posts

Posted 12 August 2012 - 12:58 AM

We should be able to turn on and off certain pixels on the console monitor. Not screen pixels and no color but the actual square "dots" on the console/monitor screen. Thus I propose 6 functions to the term api:

term.getPixelSize()

Does exactly what it says, returns to variables, just like term.size(), except these are in pixels.

term.togglePixel(x, y)

Toggles the pixel at (x, y). Note that coordinates are in pixel coordinates, not text coordinates like term.setCursorPos(x, y)

term.setPixel(x, y, set)

If "set" is true then turns pixel (x, y) on, otherwise turns it off.

term.getPixel(x, y)

Returns true if pixel (x, y) is on, otherwise returns false.

term.setPixels(...)

Takes a list of tables with 2 indices, x and y, which both need to be numbers. Simultaneously turns all those pixels on, JAVA-side, so there's none of the lua delay from running a for loop.

term.clear()

Should be modified to clear pixels.

term.clearLine()

Should still work to preserve compatibility, and would clear all pixels in the text-coordinate based line.

Also, text would turn on the right pixels and it would no longer matter what the font file is, it would always be in the default font since text would be pixel based, not character based.

#2 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 12 August 2012 - 06:41 AM

Issue with that is, if just 8 people on a server attempt to do that, it might cause a massive data spike and cause a load of problems either with server speed or possible just the render speed for anyone seeing the computer.

Also, if you just want that for the font, it's not the best way to implement adaptable font. Though it would be fun (fun as in horribly brain exploding, the kind of fun a programmer usually likes) programming a method to alter pixels according to a string argument.

It would also be okay-ish for programming the monitor to draw stuff, but again, probably issues with the draw speed so unless your texture pack was a 1-pixel texture pack, things might get ugly.

The issue above all though is that it would mean changing the entire system for how monitors and computers handle things being drawn, as well as many functions.

#3 dimitriye98

  • Members
  • 77 posts

Posted 12 August 2012 - 06:58 AM

the reason I want it is custom graphics and better guis...

#4 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 12 August 2012 - 07:28 AM

View Postdimitriye98, on 12 August 2012 - 06:58 AM, said:

the reason I want it is custom graphics and better guis...

Loads of people do, but ultimately it would probably make your computer lag horribly. At any rate, the creators of the mod aren't going to do it, I've seen loads of people ask for things like this, the answer is always no. You're better off trying to contact someone non involved in the creation of CC to make an add-on for it that allows something like that.

#5 dimitriye98

  • Members
  • 77 posts

Posted 13 August 2012 - 01:54 AM

Why would it make your computer lag horribly? Practically any application for your computer does a lot more graphically intensive work than determining whether a certain grid square (since I'm not referring to true pixels, but the low-res squares that the text on the computer is made up of at the moment) should be colored black or white. They need to manage 3 values between 0 and 255, and they do this on a much higher resolution. So no, it would not make your computer lag like hell thank you very much.

#6 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 13 August 2012 - 02:15 AM

View Postdimitriye98, on 13 August 2012 - 01:54 AM, said:

Why would it make your computer lag horribly? Practically any application for your computer does a lot more graphically intensive work than determining whether a certain grid square (since I'm not referring to true pixels, but the low-res squares that the text on the computer is made up of at the moment) should be colored black or white. They need to manage 3 values between 0 and 255, and they do this on a much higher resolution. So no, it would not make your computer lag like hell thank you very much.


Mostly it would kill servers, as for single player minecraft, there's a chance that the individual drawing logic would cause a load of slow down.

What games do, they load up all their sounds and textures at one point early on in the execution of the program/level. The textures are optimised at that point so it's easy to draw objects coated in those textures, since it is essentially just copying and pasting data.
When you start to invoke complicated calculations to determine an image from individual rectangles or pixels, the computer then has to calculate those every time the screen draws, so a simple copy and paste is now a drawn out calculation. If you have enough monitors running this in normal mode alone it would add to the already noticeably existent minecraft lag.
Put it on a server and you'd be lucky to not cause exceptions or stack overflows.

So that's why it's a bad idea, it introduces a lot of extra processing in the most important event (I'm assuming lwjgl handles draw events similar to game maker and XNA. I don't see why it wouldn't, it was designed to be lightweight after all)

Despite all that, if you really want to try something like this, I believe this add-on may be up your street/alley:
http://www.computerc...__fromsearch__1

Yes, I am slightly contradicting myself, but the point of these forums are to resolve people's issues, so here you go, one resolution for you.

If you want more information into the background behind the no pixels argument, try threads like this: http://www.computerc...-color-control/

#7 dimitriye98

  • Members
  • 77 posts

Posted 13 August 2012 - 09:01 AM

View PostPharap, on 13 August 2012 - 02:15 AM, said:

Mostly it would kill servers, as for single player minecraft, there's a chance that the individual drawing logic would cause a load of slow down.

What games do, they load up all their sounds and textures at one point early on in the execution of the program/level. The textures are optimised at that point so it's easy to draw objects coated in those textures, since it is essentially just copying and pasting data.
When you start to invoke complicated calculations to determine an image from individual rectangles or pixels, the computer then has to calculate those every time the screen draws, so a simple copy and paste is now a drawn out calculation. If you have enough monitors running this in normal mode alone it would add to the already noticeably existent minecraft lag.
Put it on a server and you'd be lucky to not cause exceptions or stack overflows.

3D rendering is much more intensive then copy-pasting a small white square around the screen so I fail to see your point.

Also, this leads me to believe we have a misunderstanding, I want to change pixels as in this:

Posted Image

Not the pixels on your computer screen.

Pharap said:

Despite all that, if you really want to try something like this, I believe this add-on may be up your street/alley:
http://www.computerc...__fromsearch__1

Yes, I am slightly contradicting myself, but the point of these forums are to resolve people's issues, so here you go, one resolution for you.

If you want more information into the background behind the no pixels argument, try threads like this: http://www.computerc...-color-control/

Again, that's not what I want. Also, can anyone else give me feedback as well? Seriously, my thread has 75 views and all five of the replies are a debate between me and Pharap over weather pixel support can be efficiently implemented or not.

#8 Pinkishu

  • Members
  • 484 posts

Posted 13 August 2012 - 02:31 PM

I honestly doubt any "drawing logic" here would cause that slowdown, its not a high-resolution and doesn't even have to draw unless the GUI is opened.
And I doubt it would make server lag horribly Oo

#9 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 13 August 2012 - 05:18 PM

So are you saying to manually draw the pixels for each character using a function? Or are you saying to get the pixel x,y for the entire screen?

#10 dimitriye98

  • Members
  • 77 posts

Posted 13 August 2012 - 09:01 PM

View Postcraniumkid22, on 13 August 2012 - 05:18 PM, said:

So are you saying to manually draw the pixels for each character using a function? Or are you saying to get the pixel x,y for the entire screen?

I want to manually draw the pixels. This allows for much better GUI's and greatly expands the function of ComputerCraft graphics-wise. That doesn't mean I want the text functions removed, far from it, I simply want the addition of pixel manipulation.

#11 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 13 August 2012 - 09:24 PM

But I meant for the entire screen at a time, or just for the block normally allotted for characters?

#12 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 13 August 2012 - 09:52 PM

View Postdimitriye98, on 13 August 2012 - 09:01 PM, said:

View Postcraniumkid22, on 13 August 2012 - 05:18 PM, said:

So are you saying to manually draw the pixels for each character using a function? Or are you saying to get the pixel x,y for the entire screen?

I want to manually draw the pixels. This allows for much better GUI's and greatly expands the function of ComputerCraft graphics-wise. That doesn't mean I want the text functions removed, far from it, I simply want the addition of pixel manipulation.

So are saying you want it only for the gui that opens when you right click, or do you want it to draw on the huge monitors as well?

#13 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 13 August 2012 - 09:53 PM

^^that would cause massive lag just to get the pixel size^^

#14 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 14 August 2012 - 06:31 AM

I have read in other threads that admins were saying the reason why it will NOT be added is due to lag.
However if the code for CC was open source people would probably do that but it is NOT.
I would love to see this feature added but it sadly will not.

#15 ardera

  • Members
  • 503 posts
  • LocationGermany

Posted 14 August 2012 - 07:07 AM

I am working on something like this... Its not an extra mod, but its an modified "default.png" Image.

#16 dimitriye98

  • Members
  • 77 posts

Posted 14 August 2012 - 08:34 AM

View PostPharap, on 13 August 2012 - 09:52 PM, said:

So are saying you want it only for the gui that opens when you right click, or do you want it to draw on the huge monitors as well?

Both.


View Postcraniumkid22, on 13 August 2012 - 09:53 PM, said:

^^that would cause massive lag just to get the pixel size^^

No it wouldn't, you already have to get pixel size for displaying text on monitors.


View PostHuman0303, on 14 August 2012 - 06:31 AM, said:

I have read in other threads that admins were saying the reason why it will NOT be added is due to lag.
However if the code for CC was open source people would probably do that but it is NOT.
I would love to see this feature added but it sadly will not.

These were likely talking about different "pixel manipulation" then I am. Earlier I made an image to explain what I meant. They were likely talking about screen pixels.


View Postardera, on 14 August 2012 - 07:07 AM, said:

I am working on something like this... Its not an extra mod, but its an modified "default.png" Image.

How exactly would this work? The application of what I suggested is impossible without changes to the code.

#17 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 14 August 2012 - 09:29 AM

View Postdimitriye98, on 14 August 2012 - 08:34 AM, said:

View PostPharap, on 13 August 2012 - 09:52 PM, said:

So are saying you want it only for the gui that opens when you right click, or do you want it to draw on the huge monitors as well?

Both.


View Postcraniumkid22, on 13 August 2012 - 09:53 PM, said:

^^that would cause massive lag just to get the pixel size^^

No it wouldn't, you already have to get pixel size for displaying text on monitors.


View PostHuman0303, on 14 August 2012 - 06:31 AM, said:

I have read in other threads that admins were saying the reason why it will NOT be added is due to lag.
However if the code for CC was open source people would probably do that but it is NOT.
I would love to see this feature added but it sadly will not.

These were likely talking about different "pixel manipulation" then I am. Earlier I made an image to explain what I meant. They were likely talking about screen pixels.


View Postardera, on 14 August 2012 - 07:07 AM, said:

I am working on something like this... Its not an extra mod, but its an modified "default.png" Image.

How exactly would this work? The application of what I suggested is impossible without changes to the code.
That's what I thought.

No you don't, you get the character size. A screen can display 900 ascii characters.

Unless the average computer screen has only 5,000 pixels, they weren't (here's a hint, my laptop screen resolution is 1366x768, and has 1049088 pixels).

Yes, they are talking about the only current way to develop non-text guis. Changing the text texture file. (Yes, the text on a computercraft screen is made of rendered textures. LWJGL does not support individual pixel changing as far as I am aware. Like I said the only way to do it this far away from the central draw event is to edit textures on the fly, which will cause a fair bit of lag after about the 7th screen +/- 3)

#18 Floedekage

  • Members
  • 11 posts

Posted 14 August 2012 - 01:41 PM

I like this idea, this is exactly what I need.
However, why not make a font.png image in every computers directory containing 256 characters, then this could be edited in-game and if one character was "font.png / 16" in width and the same in height you could make 256 color graphics. You could even make Arabic and Chinese characters easily or change the font color.

I hope this is understandable.

#19 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 14 August 2012 - 04:49 PM

View PostFloedekage, on 14 August 2012 - 01:41 PM, said:

I like this idea, this is exactly what I need.
However, why not make a font.png image in every computers directory containing 256 characters, then this could be edited in-game and if one character was "font.png / 16" in width and the same in height you could make 256 color graphics. You could even make Arabic and Chinese characters easily or change the font color.

I hope this is understandable.

Because it would only change the appearance for you, since it would be your font file (like a texture pack only changes the appearance for you) which partly defeats the object. It would be an ok fix for single player, but the people in charge like to have the mod's client and server versions synced, so they will almost certainly say no.

#20 dimitriye98

  • Members
  • 77 posts

Posted 15 August 2012 - 03:01 AM

View PostPharap, on 14 August 2012 - 09:29 AM, said:

That's what I thought.

No you don't, you get the character size. A screen can display 900 ascii characters.

Unless the average computer screen has only 5,000 pixels, they weren't (here's a hint, my laptop screen resolution is 1366x768, and has 1049088 pixels).

Yes, they are talking about the only current way to develop non-text guis. Changing the text texture file. (Yes, the text on a computercraft screen is made of rendered textures. LWJGL does not support individual pixel changing as far as I am aware. Like I said the only way to do it this far away from the central draw event is to edit textures on the fly, which will cause a fair bit of lag after about the 7th screen +/- 3)

Like I keep saying look at this image I made earlier:

View Postdimitriye98, on 13 August 2012 - 09:01 AM, said:

Posted Image

Those are the "pixels" I want to change. As in, the little white squares that make up the text on the computer craft screen. These are many times bigger than the pixels you are talking about, the pixels on the actual computer screen.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users