| |
TWW
Registered: Jul 2009 Posts: 545 |
Diagonal Scrolling
So I figgured I'd try my hands on doing a 8 directional scroll routine. Figgured it would be pretty straight fwd. but have done attemts in the past where I got lost in the code (dual screens buffer, edge buffers etc) so build a nice framework to handle IRQ sequencing, async, events etc. and looking really good.
hen a snag I didn't enticipate. 6 directions works perfectly fine but consider this:
1 8x8 picel character, where to place the center?
Obviously at (4,4), (4,5), (5,4) or (5,5) considering coordinates from 1-8.
But with diagonal scrolling it will not meet the 'edge' for $d016 and $d011 at the same time and it's all messed up unless I cheat (which is what I'll end up doing) by setting any of the formentioned coordinates as (4.5, 4.5) and the first move is to move into one of the four coordinates depending on direction.
So before going ahead and doing this, I wondered if anyone have solved this differently?
NB. It's not freedirectional and scrollspeed is 1 pixel pr frame.
EDIT1: Ignore
EDIT2: EDIT1 is crap! |
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
http://cadaver.homeftp.net/rants/scroll.htm |
| |
cadaver
Registered: Feb 2002 Posts: 1160 |
When doing "stepped" 8-directional scrolling like you describe, I've always cheated: if necessary, adjust the char center as the scroll step begins, so that I know I will reach the char edge in a fixed number of frames. According to my tests it hasn't looked too unappealing, at least when it's a game and the player can't really pay attention to the scrolling only :)
Don't think there's a way around it if you want to shift the screen memory only once per step. |
| |
Bob
Registered: Nov 2002 Posts: 71 |
Yes its a bitch!
anyhow in double buffer you will suffer :) and prolly end up cheating with table speeds that avoids the unalignments of d016 & d011.
With a single buffer it is much simplier.. lets say having only chars for output..
then I would recommend a full copy of the data directly to the screen, and not using step scrolling.. the code is acutally much simplier and it is easier to calculate with sine... and is not dependent on anything and you can have much unalignment as you want ;)
doing this in bitmap is different... I am still figuring out this with doublebuffers...
with AGSP (Vsp + Crunchlines) it is a bit easier actually because you don't have the double buffer, (ok it is not that easy actually) , need to limit the speeds to 4 to avoind most of the problems, but then you have no alignment issue here. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
(4.5, 4.5)
actually not a bad idea. subpixel it. |
| |
Style
Registered: Jun 2004 Posts: 498 |
I dont actually understand the problem. Can someone explain? |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: I dont actually understand the problem. Can someone explain?
Just read Cadaver's rant. |
| |
Style
Registered: Jun 2004 Posts: 498 |
Oh yeh, I geddit.
Just VSP/linecrunch. |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1409 |
VSP+linecrunch comes with its own set of issues (sprite pointers, losing a a couple of rows at the top of the screen), but I was thinking that a single char of VSP combined with CSEL nuking two columns instead of one could effectively give you a 16 pixel x-scroll register (first time 38 column mode is more useful than 39 :P )
I think that means that, as long as you always take a few frames to transition from dx=1 to dx=-1 and a few frames to transition from dy=1 to dy=-1 you can then defer any coarse x movement until you've finished with the last coarse y movement
Of course, as Cadaver's rant pointed out, if you just decide every 8 frames what you're going to be doing for the next 8 then you avoid all that arsing about, and never have to do a horizontal and vertical char move in sequential frames; it's just a straight diagonal hop whenever you cross both edges at once. Should be able to engineer a push-scroll to work with the same limitation, too. |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1409 |
Question though - what do you mean by "not free directional"? How is the scrolling controlled, and what constraints can you place on it?
Also, how many cycles do you have free per frame for scrolling?
It might be a lot simpler just to chase the raster decrunching the entire screen from the tile data; should be easily under 25,000 cycles, so if you can spare 12k per frame then all you need to do is avoid the case where you clip the corner pixel of a char grid alignment for a single frame. |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
Quote:Question though - what do you mean by "not free directional"?
It can only scroll in eight directions? |
... 5 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 - Next |