Poxels splash screen + animation

Basic and Machine Language

Moderator: Moderators

pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Poxels splash screen + animation

Post by pallas »

Hello!
What's the best workflow to convert a graphic file (on PC, possibly Linux) to petscii (poxels) basic drawing code?
I'd like to make a compact "graphical" splash screen.
Last edited by pallas on Thu Mar 14, 2013 5:04 am, edited 1 time in total.
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Post by Witzo »

For my 'poxelshow' (http://raoulm.home.xs4all.nl/products/) I did the following:
Opened the picture in the Gimp, used Threshold, or Image/Mode -> indexed with only black and white.
Reduced size to 44x42 pixels. Made some edits by hand. Saved as gif.

Then I used the Imagemagick unix tool (I got it through Macports, use your package manager of choice - but I don't know if there's a Windows version.)

This instruction turned it into a list of coordinates for all the poxels that need to be made black:

Code: Select all

> convert HipsterLoesportret.gif txt: | grep 'black' > HipsterLoesportret.txt
Remove everything in the text file that is not needed for your coordinate list on the vic.
Copypasted the coordinates in the text editor I use, in the data section of my assembly listing.
But you could copypaste the text into VICE as well.

(My avatar pic is one of the pics I made this way, from a photo of my cat.)
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

Thanks for the advice.
Is there a tool to convert the coordinates to basic v2 code?
User avatar
darkatx
Vic 20 Afficionado
Posts: 471
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Post by darkatx »

This is what I wanted!!! I'm off to give this a whirl to update my instructions intro screen... :)
Learning all the time... :)
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Post by Witzo »

Here's the Basic program I made to plot coordinates using the block graphic keys.
In stead of lines 100-500 you should put a routine reading the X and Y data, and put the data somewhere in a list of data statements.

something in the form of

FOR V=1TO[number of points]
READ P,Q
X=P:Y=Q:GOSUB600
NEXT V
DATA 12,14,3,18,27,15, etc (X,Y coordinate pairs).
This is where you paste the list of coordinates from Imagemagick. VICE lets you copypaste from a text editor into the VICE screen.

http://raoulm.home.xs4all.nl/products/P ... C20.D64.gz
Poxeldemo:

Code: Select all

10 dim a(15)
20 a(0)=32 : a(1)=124
30 a(2)=126 : a(3)=226
40 a(4)=108 : a(5)=225
50 a(6)=127 : a(7)=251
60 a(8)=123 : a(9)=255
70 a(10)=97 : a(11)=236
80 a(12)=98 : a(13)=254
90 a(14)=252 : a(15)=160

100 printchr$(14):printchr$(8):print"SP";
110 print"HI!Ware 301111"
115 a=0:t=1:k=-1
120 forj=0to43
125 k=k+0.4
130 b=int((sin(k)*8)+.5)+20
140 x=a:y=b:gosub600
145 a=a+1
150 next j
490 geta$:ifa$="" then 490
500 printchr$(9):end

600 if x<0 or x>44 then return
610 if y<0 or y>46 then return
620 lr=1:ob=0
630 if(x and 1)=1 thenlr=0:x=x-1
640 if(y and 1)=1 thenob=1:y=y-1
650 x=x/2:y=y/2
700 sc=7680:b=22:h=23:sk=38400
710 ou=peek(sc+(b*y)+x)
750 sy=-1: for i = 0 to 15
760 if ou = a(i) thensy=i
770 next i
780 if sy=-1 then return
800 if lr=0 and ob = 0 then ad=1
810 if lr=1 and ob = 0 then ad=2
820 if lr=0 and ob = 1 then ad=4
830 if lr=1 and ob = 1 then ad=8
840 ift=1then ni=sy  or ad
850 ift=0then ni=sy  and not ad
900 su=a(ni)
910 poke sc+(b*y)+x,su
920 poke sk+(b*y)+x,4
1000 return
(SP being clr/home and black)
Of course this could be improved upon, so Mike made this fairly fast Mandelbrot generator:

http://sleepingelephant.com/ipw-web/bul ... 3735#63735
User avatar
darkatx
Vic 20 Afficionado
Posts: 471
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Post by darkatx »

OMG - I was going to do exactly that - make a basic proggy to do the translating for me.
Awesome and thanks for all the effort! :)
Learning all the time... :)
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Why this intermediate step with a list of pixel co-ordinates?

You can convert the B/W image directly to a BASIC program which consists solely of PRINT statements (and two POKEs into screen and colour RAM for the bottom-right character), which is much more efficient speed- and memory-wise.
pallas
Vic 20 Devotee
Posts: 212
Joined: Mon Dec 24, 2012 2:38 am

Post by pallas »

Mike wrote:You can convert the B/W image directly to a BASIC program which consists solely of PRINT statements (and two POKEs into screen and colour RAM for the bottom-right character), which is much more efficient speed- and memory-wise.
That's what I want to do. I think I'll write a little (perl?) script that creates basic lines from the coordinates.
My problem is how to write the petscii chars and rvson/rvsoff, so that they paste correctly into vice or basedit.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

pallas wrote:[...] a little (perl?) script that creates basic lines from the coordinates. My problem is how to write the petscii chars and rvson/rvsoff, so that they paste correctly into vice or basedit.
As I wrote elsewhere, the copy&paste facility of VICE is just unusable beyond simple text I/O.

Again, why bother with two extra files of the co-ordinate list and the PETSCII representation of the program?

You only need the 44x46 pixel image in *.pgm format as input, and the result is a tokenized BASIC program as *.prg file. The converter itself could be written in maybe two dozen lines of CBM BASIC.
PhilRanger
Vic 20 Hobbyist
Posts: 143
Joined: Thu Aug 25, 2011 10:04 am

Post by PhilRanger »

Hi,

This thread got me thinking...

If we think about poxels in general, for black and white there are 16 possible combinations, which already exist in the VIC.

Let's say we make a custom defined char set in multi-color so our poxels can now be 4 colors instead of two (background, frame, auxiliary + character color). Let's keep the character color the same for the full screen for simplicity's sake. We would then need a hi-res charset of 256 characters. Works but a bit memory heavy. The data is then all combinations of

10 data 0,5,10,15,80,85,90,95,160,165,170,175,240,245,250,255

We can then take any picture of up to 44X43 pixels in 4 colors as a splash screen. The screen coul also be expanded to remove the frame, allowing a 8-16? poxels more horizontally and vertically.

A streamlined conversion tool from a bmp could be designed, opening the door to easy splash screen for everyone.
Phil Ranger
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

PhilRanger wrote:Works but a bit memory heavy.
This method takes away 2K just for a constant definition of the character set, and then you still have to add in the screen data.

IMO, using a bitmap (like MINIGRAFIK/MINIPAINT) or doing 'sparse' hires displays (like Ghislain does in his splash screens) makes better use of the RAM and gives much nicer results in the end.

'Poxels'/chunky pixels still can be used to advantage in programs like MINIPAINT, where they provide a 'hardware-accelerated' 4x zoom with little software overhead.
opening the door to easy splash screen for everyone
The tools are already out there. :roll:

It just take a little bit time to acquaint oneself with them, and you can always ask questions if something is unclear. And please don't give me that interjection, that these tools are for expanded VIC-20 only. Everyone concerned has access to RAM expansions nowadays.
PhilRanger
Vic 20 Hobbyist
Posts: 143
Joined: Thu Aug 25, 2011 10:04 am

Post by PhilRanger »

Mike wrote:This method takes away 2K just for a constant definition of the character set, and then you still have to add in the screen data.
Not a problem with memory extension and if not one load for the splash screen then one load for the game.
IMO, using a bitmap (like MINIGRAFIK/MINIPAINT) or doing 'sparse' hires displays (like Ghislain does in his splash screens) makes better use of the RAM and gives much nicer results in the end.
Agreed. But integrating minipaint/magigrafik in a game isn't trivial to me.
And if done, how much memory is then needed?
The tools are already out there. :roll:.
It doens't look easy to me but I'll try looking at it again if needed. My post was just a "what if" without any thinking about denigratin tools that exist and are probably way better than anything I could do anyway.
It just take a little bit time to acquaint oneself with them, and you can always ask questions if something is unclear. And please don't give me that interjection, that these tools are for expanded VIC-20 only. Everyone concerned has access to RAM expansions nowadays.
Phil Ranger
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

Just do your own thing. Use whatever tools you want, however you want, with whatever VIC configuration you want. Be creative. Have fun.

Don't let anyone tell you their way is the only way, the best way, or that if you're not doing it their way you're wrong, or doing it wrong.

Remember the mantra: The Friendly Computer. Don't let a rolling-eye animation put you off. :)
User avatar
darkatx
Vic 20 Afficionado
Posts: 471
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Post by darkatx »

PhilRanger wrote:Agreed. But integrating minipaint/magigrafik in a game isn't trivial to me.
And if done, how much memory is then needed?
Well with the splash screen intro you would need 8K minimum.
...It doens't look easy to me...
It's actually not that bad at all. I was able to incorporate my splash screen fairly easily after I played with it a bit. I also asked Mike a question or two.
FD22 wrote: Just do your own thing...Be creative. Have fun.
Agreed. :)

Now let's deal with the Elephant in the Room here.

There seems to be varying levels of skill sets here and that's cool. The main problem is intimidation.

If not of some of the subject matter (mostly being over the heads of the average layperson - hell like myself) - it is the tools and the fear of failure. Not feeling smart enough to pull it off. Or just plain fear of asking a question that might come across as (well dare I say it)...stupid! :roll:

Do your own thing for sure but don't let fear be the deciding factor. Vic-20 is the Friendly computer but Denial is the friendliest forum. Sure we are all not as brilliant as guys like Jeff-20, Ghislain, Mike, Tokra, Kweepa or FD22 but not one of them are not willing to set aside the time to answer ANY questions you might have. They are the most approachable people I've ever interacted with online.

It takes a lot to try something out of your comfort zone...I know it's tough...but it's also rewarding. Either way, I am looking forward to whatever you produce. Denial can never have enough programmers in its ranks irregardless of their level of expertise.

:D
Learning all the time... :)
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Post by Witzo »

Well said, Darkatx and FD22. Sometimes I have an inkling of an answer to a question on the forum and post it, but I am fully aware that there are shorter/cleaner/faster ways to do it.
Reading the refinements of others on my own code is very educational. I had a good experience there just last week when my entry for the one-liner compo was improved upon.
Post Reply