Jump to content
IGNORED

IntyBASIC Parallax Scroll Technique?


First Spear

Recommended Posts

Space Patrol achieves its effect entirely with precomputed graphic tiles that it loads into GRAM periodically. I do not use the hardware scroll registers, since they only work for scrolling the entire screen as a single unit.

 

The parallax-scrolled graphics form a repeating loop (4x2 or 8x1). That means I only need to keep track of my position modulo the repeat interval. (32px or 64px.)

 

For each layer, I keep track of where that layer is fractionally relative to the other layers. Moving 1px at the front moves by less than 1px in the mid-distance, and even less than that for the really distant stuff. (It looks like the scale factors I used are 0.28125 and 0.15625.) So, I take my current pixel offset from the origin for the foreground layer, multiply it by the scale factor, keep the integer portion, and mask that with either 31 or 63.

 

Now here comes the fun part: I only store 8 copies of each background graphic, one for each pixel offset within a tile. But, my offsets go from 0..31 or 0..63, not 0..7. There are two main options of how to handle this.

  1. Load one of the 8 graphic sets based on the 3 LSBs of the computed offset, and then rewrite BACKTAB based on the upper bits.
  2. Load one of the 8 graphic sets based on the 3 LSBs of the computed offset, but rotate them in GRAM so that you don't need to muck with BACKTAB.

Space Patrol does the second one.

 

To keep up 60 fps with all that GRAM reloading, I had to massively unroll my interrupt handler. (See ENGINE1.) Also, I had to pull some tricks: I only load graphics for the background layers if they moved by a full pixel. If both the parallax layers moved in the same frame, I delay updating one of them, since I can only afford to update one layer per frame. I'm updating ~22 cards per frame in Space Patrol. (8 for the parallax background, 12 for the rocks and craters, 1 for the spinner, and ~1 split across the moon buggy's wheels, the moon buggy's horizontal bullet, and the topmost row of the orange regolith.)

 

BTW, the full Space Patrol source is available as part of recent jzIntv downloads, if you're curious about how it works.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

How would this be done? I am thinking of the effect in Space Patrol where the distant mountains move a little but the close terrain moves a lot, with "holes" in the closer stuff showing-through the distant stuff on occasion. Some kind of BACKTAB cycling and SCROLL trick?

 

I guess I should finish part 2 of "What Can an Intellivison do?"

Not doing anywhere near what Space Patrol does, but the effect is the same

post-38229-0-09858900-1517279141.gif

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...