This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Tclord's profile picture

graphics

Started by Tclord, 17 November 2012 - 12:29 PM
Tclord #1
Posted 17 November 2012 - 01:29 PM
Being a kid who grew up in the 80's and first learned programming with an Apple ][ computer, I can appreciate the style of these computers in computercraft. One thing I remember about the old apple ][ and programming it, though, was graphics. There was low res graphics, which is pretty much already what you have possible (playing with the paint program on an advanced computer), but there was also hi res graphics mode, and this is what really opened up the possibilities for making games and doing more interesting stuff on the apple ][. I think something similar should be implemented in computer craft. I think you would see a similar explosion of new creativity from people once such a thing exists.

It wouldn't need to be a huge resolution or anything. It could be a little blocky. Probably have pixels the size that the text is. Ok, that didn't make sense so let me try again. You should be able to reproduce text with pixels in the graphics mode. The text on computer craft computers looks like it is made up of rather big pixels so I'm thinking pixels of that apparent size would be good.

The Apple ][ hi res mode was (if I still remember correctly after all this time) 280 x 192 I think? There was like only 6 colors too, and it was tricky to work with and had limitations. Lores mode, by contrast, had 16 colors without limitations, but was only 40 x 24 resolution. Almost everyone prefered the hires mode. Goes to show the power more resolution had.

There was also full screen and mixed mode. Mixed mode had like the bottom 4 lines of text area in text mode and everything above that point in graphics mode. I was thinking maybe you could specify an overlay area to use if you want to activate graphics mode. So you could have the whole screen in graphics mode, or maybe just the right half of the screen, or even just a smaller window in the corner of the computer screen. Perhaps you would need to limit the left and right edges of the overlay area to multiples of 8. On the Apple ][ graphics memory was set up such that each bit of memory represented a pixel on the screen, except that the high order bit in each byte was a color mode bit. So a byte layout was something like ABABABAC, where C is the color mode bit, and A is one color and B is another color. Either the colors are green and purple or red and blue, depending on the color mode bit for that byte. As you can see, hires graphics was limiting and tricky to work with but still worth the effort.

I'm still not that familiar with Lua yet, but I'm thinking maybe a string to represent graphics memory might be best? Perhaps using hexidecimal values (0-9a-f), so each character in the string represents one pixel in one of sixteen colors. On the Apple ][ people generally used a vtable as it was called, which allowed you to get the start of each scanline easily. This might be easiest for people using computer craft as well, so organizing graphics memory into a table using numeric keys, which represents each scanline. Something tells me this wouldn't work, though. Gives you an idea of what I have in mind anyway.
tom2018 #2
Posted 17 November 2012 - 02:04 PM
this must be implemented!
Tiin57 #3
Posted 17 November 2012 - 02:10 PM
I am working on something similar, which I shall not say for advertising's sake. :)/>/>
On-topic:
Lua isn't powerful enough to handle this stuff. 'Nuff said.
dissy #4
Posted 17 November 2012 - 02:24 PM
I am working on something similar, which I shall not say for advertising's sake. :)/>/>
On-topic:
Lua isn't powerful enough to handle this stuff. 'Nuff said.

Lua is WAY more powerful than either integer basic or applesoft basic, which is what came with the apple//

plot x y
line x1 y1 x2 y2
etc

a// also allowed for basic shape tables, where the shape was effectively defined using similar language as turtle moves. You could then put the shape at an x/y point in a color and scale it.
Anamation was done by drawing the shape in a color, then redrawing it in black (erase), then draw it in color one pixel off, and so on.

The color scheme on the apple// was 6 color (actually 4 colors, two whites, two blacks) purely due to the ntsc signal output to TVs. In it fact had a double-high-res mode that gave 16 colors, using a pretty complex interleaving scheme.
This could be simplified down into standard plot/line commands and the standard 16 colors, since we have less limits than the apple// did.

I would love to see a version of this implimented in computercraft!
anonimo182 #5
Posted 17 November 2012 - 02:51 PM
It would be nice in Computercraft