Qbasicnews.com

Full Version: Scrolling: it goes too slow. Anything I can do?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
PJ recently taught me simple scrolling. Right now what I'm doing is simply this:
Code:
FOR y=1 TO MaxY
FOR x=1 to MaxX
IF Map(x+CamX,y+CamY)="e" THEN PutSprite enemy()
IF Map(x+CamX,y+CamY)="f" THEN PutSprite floor()
'more IFs like above go here
NEXT
NEXT
My problem is that the method above is extremely slow - it doesn't even look like scrolling, because you can actually see it placing the tiles. My question is: is there any way to speed this up/not have to see it drawing itself? I can't use page flipping with screen 7,0,1,0 because I need all 256 colors of the screen 13 palette. Is there another way? Also, I can't use QB's PUT. I have to use PutSprite, which is slower.
Use a lib man. It will take problems away (speed and ease of use). Coding with libraries is easier. Get Rellib or DirectQB, those are really easy to learn.

And don't do it with IFs. Make a MAP array and just draw each tile. Read this little tut I wrote:

http://faq.qbasicnews.com/?blast=PixelBy...ingGeneral
1) I have nothing against using libs, but I'd like to learn this method. IMHO everyone should learn the method, and *then*, if they want, use a lib.
2) Yeah, but that wouldn't speed anything up.
A lib will only give you a fast PUT and a double buffer, nothing else. Btw, my little tut is for horizontal scrolling, but it is easily adaptable to multidirectional scrolling.
It's the drawing that is slow, no easy way to speed it up if you don't want to use a lib.


I made a map engine a long time ago (using Xephyrs library) that could handle maps of up to: 100*255*255 pixels, it was quite fast, almost no flickering (double buffering). I tried to do a pure QB version, but it was way to slow.
Okay, I tried that IF thing of yours Nath. It's faster, but still not...fast. My main problem now is that you can kinda see it's being drawn. If I was using SCREEN 7,0,1,0 and PCOPYing, it would be fine. Is that what Double Bufferring does?
Btw all, about the high-speed PUT, sorry - I'm stuck with my own PutSprite routine.
Then you have to code a faster Put, sorry Sad

Double buffering is just drawing stuff offscreen so it is not seen while it is drawn, and then copying all that stuff altogether to screen. It is not faster, but cleaner.
That would look better. Any tuts out there for it?
Of course, I wrote this tiny one: http://faq.qbasicnews.com/?blast=DoubleB...enThirteen Big Grin

Btw, are you using PSET in your put routine?
Yep. In fact, I just realized I should change that to the faster, direct-vid-mem method. Big Grin
How do you do that again?
Pages: 1 2