Megascroll

For Scene Demos that display animations, graphics, and music. Also for tech demos of graphics capability of VERA or the audio capabilities of the PSG, FM, or PCM audio channels.
Post Reply
User avatar
desertfish
Posts: 1094
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Megascroll

Post by desertfish »

Something big that scrolls. Several images are included in this demonstration.
scroller.png
scroller.png (96.27 KiB) Viewed 263 times

Is it breaking the limits of the Vera chip? Who knows :D

Try It Now!

Here is the source code
megascroll.p8.txt
(5.93 KiB) Downloaded 20 times
Attachments
megascroll.zip
(1.15 MiB) Downloaded 43 times
User avatar
desertfish
Posts: 1094
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Megascroll

Post by desertfish »

Added the source code.
User avatar
Daedalus
Posts: 229
Joined: Fri Nov 11, 2022 3:03 am

Re: Megascroll

Post by Daedalus »

This is interesting, it would be useful as a game scene transition mechanic.

It appears that the image is repackaged as a "sideways" bitmap with the left side of the image as the top and the right as the bottom, then is scrolled in by streaming pixels from the bottom of the file using a "just in time" mechanic in the read_next_strip() sub routine.

But my cursory look at the code wasn't able to figure out whether you're reordering the tiles, or using the tile display's inherent looping mechanic and loading the new data into the as yet "undiscovered" tiles to the right of the screen. (Yeah, this must be how it works, that way any "undiscovered" tiles would still be black if they needed to be seen on the left.)

And of course, the viewable tile area is reduced to 38 x 26 to keep the total tiles under 1000.
User avatar
desertfish
Posts: 1094
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Megascroll

Post by desertfish »

Yeah it makes use of a 40x25 visible 8x8 tiles matrix. Which makes it 1000 tiles which is just below the 1024 tile limit, so every tile in the matrix can have its own distinct image so we effectively have a 320x200 "bitmap" image.

The scrolling uses the automatic scroll wrap-around.
It draws new columns on the right hand side of the screen as required (every 8 pixels). The tile data for the tiles that make up the new column (always 25 ascending tiles) is loaded from disk.

Actually after a nudge on the discord, I tried making a SPRITE based version as well.
I didn't fully finish it but it actually was simpler to write than this tile based one.
DragWx
Posts: 341
Joined: Tue Mar 07, 2023 9:07 pm

Re: Megascroll

Post by DragWx »

desertfish wrote: Wed Nov 13, 2024 6:08 pmActually after a nudge on the discord, I tried making a SPRITE based version as well.
I didn't fully finish it but it actually was simpler to write than this tile based one.
I was drafting up a game idea, and being able to use a sprite as a bitmap canvas seems like it'd be really powerful. I was going to use it to draw a minimap/radar.
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: Megascroll

Post by ahenry3068 »

DragWx wrote: Wed Nov 13, 2024 9:59 pm
desertfish wrote: Wed Nov 13, 2024 6:08 pmActually after a nudge on the discord, I tried making a SPRITE based version as well.
I didn't fully finish it but it actually was simpler to write than this tile based one.
I was drafting up a game idea, and being able to use a sprite as a bitmap canvas seems like it'd be really powerful. I was going to use it to draw a minimap/radar.
If you've checked out my Audio Book Manager I use a routine that converts a BMX file to 25 sprites to display it. I use the following layout for a full 320x240 8bpp bitmap

Row 1 5 64x64 sprites Row 2 5 64x64 sprites Row 3 5 64x64 sprites Row 4 5 64x32 sprites Row 5 5 64x16 sprites.

I load the BMX file to the normal graphics buffer to carve it up. I save each sprite to a disc file to do this. After all the sprites are saved I reload them back to the Graphics buffer but rearranged as sprites. I then save the graphics buffer as a whole and the palette to files that can be reloaded next time. I only have to do the carve up once per BMX. If the BMX is not full screen I just zero the rest of the graphics buffer and center the image. I still save 25 sprites but those filled with 0's will be transparent. After the conversion process is completed I just scratch the temporary sprite files as I have one main sprite file that has all 25 sprites for the next load.
Post Reply