smooth scrolling problem

Started by
4 comments, last by Roam 22 years, 2 months ago
I''m doing a 2D side scroller, and when I move the screen 1 pixel at a time it is very smooth,(duh?!) but, it''s slow unless you have a vvvvvvery fast computer. so I''ve set the scroll offset at 10 pixels, now we are rocking, but when I limit the number of refresh cycles the scrolling is jerky, if I don''t limit the refresh, the scrolling rocks but it is blurred. I know many are looking to create a motion blur effect, I have I just don''t want it. so how do I keep a fast scrolling speed, smooth and able to run on a pentium 2 266MHz? (: I am what I am, more or less
I am what I am, more or less :)and my site rockswww.geocities.com/roam_fireI think
Advertisement
If you are using directdraw, make a surface larger than nessesary and blit a portion of that surface to the screen, moving the coords each iteration. That way you only have do perform a complete redraw when you reach the end of your larger surface.
Look up TileMap scrolling tutorials for more info.

Also make sure you have your AI/Movement code in a timed segment and your drawing code in a untimed segment to max FPS.


,Jay
Let''s see...

Make sure your surfaces are in display memory by default.
Write your own clipper.
Try to blit as little offscreen tiles as possible.
Dirty Rectangles(only update what''s been changed on the screen).
Use d3d(there''s an article on using 2d tiles in 3d in the
reference section).

Oh, and yeah, I''m just assuming you''re using DirectX.

-Hyatus
"da da da"
the drawing code has its own thread and is working at full throttle (save for a couple of millis each frame).
any way, I''m redrawing the whole thing at the moment, which works fine even on my old P2.

What I really don''t understand is why so I get a motion blur when I scroll more then 2 pixels at a frame?

anyway you can download a sample from:

http://www.geocities.com/roam_fire/DemoFiles/scroll.zip

cheers

(: I am what I am, more or less
I am what I am, more or less :)and my site rockswww.geocities.com/roam_fireI think
Seems to run alright(minus the no tile problem when the y
scrolling hits the "bottom" of so many tiles).

I didn''t notice any motion blurring...

-Hyatus
"da da da"
I have found the problem,
a simple over doing, after reading the docs, I noticed that by default
when flipping the surface it waits for the vertical blank signal, and I was waiting as well, so here is the app minus 1 line of code:

http://www.geocities.com/roam_fire/DemoFiles/scrollSmooth.zip

...

(: I am what I am, more or less
I am what I am, more or less :)and my site rockswww.geocities.com/roam_fireI think

This topic is closed to new replies.

Advertisement