Page 1 of 1
Megascroll
Posted: Sun Nov 10, 2024 9:16 pm
by desertfish
Something big that scrolls. Several images are included in this demonstration.
- scroller.png (96.27 KiB) Viewed 262 times
Is it breaking the limits of the Vera chip? Who knows
Try It Now!
Here is the source code
Re: Megascroll
Posted: Mon Nov 11, 2024 5:43 pm
by desertfish
Added the source code.
Re: Megascroll
Posted: Wed Nov 13, 2024 1:01 pm
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.
Re: Megascroll
Posted: Wed Nov 13, 2024 6:08 pm
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.
Re: Megascroll
Posted: Wed Nov 13, 2024 9:59 pm
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.
Re: Megascroll
Posted: Wed Nov 13, 2024 11:00 pm
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.