News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Carnivius

Hero Turtles - Parallax

Started by Carnivius, 10:27, 23 June 15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Carnivius

Just something I've wondered about for a while.    How does the parallax scrolling work in the platform stages of the first Teenage Mutant Hero Turtles game on CPC?   The foreground seems to move in small chunks (I think 4 Mode 0 pixels maybe) while the background seems to move in 1 pixels.  It's very nicely done.   I'd like to know how it's achieved and what are the limitations?   It doesn't seem to parallax with the height where the background scrolls the same amount as the foreground when the screen scrolls up or down though (but that's not an issue for what I'm thinking of doing).  Also does it have to be the same small repeated tile over and over or can there be variations?

AMC did a similar thing but it seems smoother in TMHT somehow.
Favorite CPC games: Count Duckula 3, Oh Mummy Returns, RoboCop Resurrection, Tankbusters Afterlife

ervin

Yeah TMHT does it really well.

I *think* that the background is also scrolling in chunks, just like the foreground, but perhaps it's not actually scrolling.
I think it's just cycling through tiles that give the appearance of scrolling.

So it displays:
*---
then -*---
then --*-
then ---*
and then back to *--- again.

That's how I'd do it anyway.
:)

Carnivius

Hm, a deceivingly simple idea and that could be the case with TMHT and if so perhaps a little limited for large busy backdrops (as it may need about an additional 3 'sub-tiles' per every different 4x8 Mode 0 tile that makes up a parallax background.   And it explains why the parallax effect doesn't happen vertically as it would need even more then.

The levels in RoboCop:Prime that I've been thinking of having the cityscape backdrop parallax (got it working on the PC code but had pondered if it was possible on a real CPC) only scroll horizontally and doesn't use loads of different tiles anyways so it could work.  :)
Favorite CPC games: Count Duckula 3, Oh Mummy Returns, RoboCop Resurrection, Tankbusters Afterlife

arnoldemu

The tiles are stored uncompressed.

One or more tiles are rotated in place in memory. Pre-shifted versions are not stored.

When the screen is scrolled all the tiles are re-drawn; and therefore the rotated tile is also drawn giving parallax scrolling.

Notice how only the sprites overlap the backgrounds, there are no other tiles over the top.


On C64 to do parallax, they do something similar, they use a charmap mode and change the chars.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

I am slightly incorrect here.

I think there are only 2 possible tiles that can be used for parallax. Inside it's two blue brick tiles.
Outside it is the water and the darker water tile.

Each sub-level defines which two tiles are used for parallax, the graphics are taken from the source and preshifted into
another location in memory.

The level has the tile ids, some of these will be "preshift tile 1" and "preshift tile 2".

When the player moves, the appropiate preshifted version is copied into "preshift tile 1" and "preshift tile 2".
The tiles are all redrawn each time the player moves.

So the additional cpu time is to copy the appropiate preshifted tile into the "preshift tile 1" or "preshift tile 2" location.

Nice.


EDIT: Memory usage:

1. Original tile not preshifted.
2. preshift tile 1 and preshift tile 2 to hold current shifted graphics.
3. buffer to store 2x tile preshifted (so 2 tiles * x positions).
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Carnivius

Quote from: arnoldemu on 13:45, 23 June 15
I am slightly incorrect here.

I think there are only 2 possible tiles that can be used for parallax. Inside it's two blue brick tiles.
Outside it is the water and the darker water tile.

The sewers have the brick tiles.  The building interiors have a different tile which is a bit taller/wider (depending how they've done it).

Favorite CPC games: Count Duckula 3, Oh Mummy Returns, RoboCop Resurrection, Tankbusters Afterlife

arnoldemu

It also seems that if the tile can make a tiled pattern by putting it side to side then they rotate it in place in the tileset.

The water has grey tiles for the paving which is parallaxed! The water tiles rotate within themselves as a repeating tiled pattern.

The interior seems to be done a similar way to the water.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Carnivius

Hm cool.  Just trying to think how it could be done where the horizontal tiles aren't all the same.  The sub-tile 'animation' that appears to shift one tile slightly to the left or right would then somehow need to take over the next tilespace I would think to keep the background appear to be scrolling.  Maybe a data map of the background itself (relatively small for speed reasons and it could loop) that can be read to keep those tiles in check.   Oh well, it's stuff for me to think about anyways.  Thanks for the help.
Favorite CPC games: Count Duckula 3, Oh Mummy Returns, RoboCop Resurrection, Tankbusters Afterlife

zeropolis79

I'm on friendly terms with programmer Dave Perry - would you like me to ask him?

TFM

Just looked at the game, it's really well made. About the parallax scrolling: The playfield is so small (I guess a Third of the regular screen) that you can do pretty much everything in software there. So no special hard- & soft-scrolling combination. Of course you need some nice algorithm behind it to be quick enough. Well done!

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

MacDeath

#10
this sort of parallax is possible because the games has character based scrolling.
as told it is actually the same sort of paralax as AMC or more recently on Attack of the Zombie monster
I remember someone posted an engine for such paralax effect.

I think it was this :
character-based tile engine with parallax scrolling

those character based parallax can look somwhat smooth if tiles are well designed or if screen is bigger.

ervin

Yep, that was me.
;D

I had thought about using pre-shifted tiles to make the background scrolling smoother, but in the end I didn't for some reason...

Powered by SMFPacks Menu Editor Mod