Article View: rec.games.programmer
Article #101Re: smooth scrolling maps
From: Kenneth Soohoo
Date: Fri, 07 Jul 1989 17:15
Date: Fri, 07 Jul 1989 17:15
42 lines
2885 bytes
2885 bytes
In article <679@greens.UUCP> allegro@sunpix.UUCP ( SunVis) writes:
> I'm pretty much a novice programmer and I'm sure this is a technique most
>of you learned in programming 101 :^). Anyway I'm writing a program that uses
>a map 3 to 4 times the screen size and I want to be able to scroll smoothly
>around the whole map. The best technique I have come up with so far involves
>shifting the displayed map area over one grid then filling in the blank areas
>with the new data from off screen. The shift of the screen is relatively
>fast but the new data redraw is a bit slow for what I've had in mind. Any
>hints ?
Stephen,
Well, I've said a few words before about techniques closely related to what
you're trying to do (maybe I should start posting my game design tips...
Nahhh, might need the secrets some day... heheheheh)... Here's my two cents
on scrolling, redrawing, and generally performing "smooth" scrolling on the
Atari ST (note, this is works on all bit mapped screens that have the ability
to change the physcial screen base...)
Ok, to ensure that the user never see you draw (this is kinda like not having
anyone see you sweat), you want to show him a complete, unchanging screen
while you construct the new screen ("frame") behind the scenes. When you've
got the new frame built, swap it with the frame you're currently showing.
If you perform the swap while your screen isn't being drawn, the very next
displayed frame will be a clean transition from your previous to the new.
Now use your old frame to create the next new frame in.
So how about _your_ application? Yeah, well, it sounds like you're picking
a large section of the screen up and putting it down again -- try this
instead. Blit the entire new screen map into the hidden screen, and then
swap it. Write your own map blit routine in 68000 for performance, or use
the usual GEM vro_cpyfm() call to get the stuff working first! So you
keep a master map, pick screen size pieces up to construct each new frame.
Place any objects you like on top of the new screen, then swap it in.
Ok, now there seems to be all sorts of confusion when it comes to swapping
screens on the ST. My suggestion is this: install yourself as a VBlank
routine and stuff the screen's physical base yourself.
Good luck!
--
Kenneth Soohoo {ames,imagen,portal}!atari!kens
Atari Engineering
"So Atari doesn't necessarily agree with me, so what!"
Technical Details
Message-ID:
<1597@atari.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!sun-barr!newstop!sun!imagen!atari!kensReferences:
<679@greens.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!sun-barr!newstop!sun!imagen!atari!kens From: kens@atari.UUCP (Kenneth Soohoo) Newsgroups: rec.games.programmer,comp.sys.atari.st Subject: Re: smooth scrolling maps Message-ID: <1597@atari.UUCP> Date: 7 Jul 89 17:15:55 GMT References: <679@greens.UUCP> Reply-To: kens@atari.UUCP (Kenneth Soohoo) Organization: Atari (US) Corporation, Sunnyvale, California Lines: 42