It is currently Sun Dec 17, 2017 1:18 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: GBjam Pirate Pop
PostPosted: Tue Aug 25, 2015 5:10 pm 
Offline

Joined: Mon Sep 27, 2004 2:57 pm
Posts: 1248
For chr-ram parallax scrolling, vertical positioning is free because you just change which byte offset you copy from. Horizontal positioning is free every 8th increment, because again, you just change which byte offset you copy from. From here, you have two choices. One choice is to store 8 versions of the original background, each offset horizontally by one pixel, and the other is to shift the pixels in software. For a 64x64 pixel graphic, the worst case scenario is to shift 4 pixels (Instead of shifting 5 pixels, you move to the next byte (effectively shifting 8 pixels) and shift 3 pixels in the opposite direction), which would equate to 4 (shifts) * 8 (bytes per row) * 8 (rows per tile) * 8 (rows of tiles) * 2 (bits per pixel) = 4096 shifts.

A compromise between shift and CPU effort is to store two copies of the 64x64 graphic, with one copy offset by 4 pixels. Here, the worst case scenario is 2 shifts (for 3 shifts, you move to the other table (effectively shifting 4 pixels) and shift once in the opposite direction). Instead of 8 copies of the 64x64 graphic, you only have 2, and instead of a maximum shift of 4 pixels, it's now a max of 2.

I'm not sure how comfortable I'd personally be with a subroutine that burns a variable amount of operations between 0 and 2048 depending on the screen's scroll position, but if it can be proven to not negatively impact the game, then this would be a feasible solution.


Top
 Profile  
 
 Post subject: Re: GBjam Pirate Pop
PostPosted: Tue Aug 25, 2015 6:22 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19353
Location: NE Indiana, USA (NTSC)
Try this: Store half the pattern offset by 4 pixels (or by 2 in the compromise version). Then the number of shift operations is constant no matter what the offset is: 0+4, 1+3, or 2+2.

I'm about to split the discussion of Toki Tori's scrolling.


Top
 Profile  
 
 Post subject: Re: GBjam Pirate Pop
PostPosted: Tue Aug 25, 2015 7:28 pm 
Offline

Joined: Thu Aug 12, 2010 3:43 am
Posts: 1589
Drag wrote:
For chr-ram parallax scrolling, vertical positioning is free because you just change which byte offset you copy from.

This is what I thought at first, but then I remembered that the DMA addresses (both source and destination) have to be aligned to 16 bytes (the size of a tile). So the vertical granurality is as bad as the horizontal one (i.e. steps of 8 pixels).

Still, worst case would be 64 different copies, i.e. 64KB. Given the ROM size being mentioned before, that doesn't sound as bad as it may seem at first.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group