Falco Girgis wrote:Oh shit, I completely missed that somehow!
So tell me if I'm understanding your layering correctly. From back to front:
1) background image
2) background tiles ontop of the background image for animating certain regions of the background
3) main layer the player interacts with
4) foreground layer for things like trees that are rendered in front of the player and the main layer
Then there are two levels of speeds for parallaxing:
slower: layers 1 and 2
faster: layers 3 and 4
There are a total of seven layers (going back to front) and 3 speeds of scrolling:
1) parallax image - slower scroll - single image for the background
2) parallax tile layer - slower scroll - tiles laid on top of the parallax image
3) background layer - normal scroll - tiles that appear behind Rad, but scroll with the collision layer
4) collision layer - normal scroll - yeah, that stuff you walk on
5) entity layer - normal scroll - stores interactive items, such as enemies, power ups, ladders, etc.
6) front layer - normal scroll - tiles that appear in front of Rad, but scroll with the collision layer
7) foreground layer - faster scroll - for things like columns and trees in the foreground
Falco Girgis wrote:
Assuming that I am anywhere near correct here, I have some back-end and front-end questions.
Back-End
Is your layer "size" smaller for the background, since it scrolls slower and can technically fill the same area as the two foreground layers with a much smaller region? If your layers are static structures, are you actually allocating a smaller area region by using the map size from the upper layers and the speed of the parallaxing?
Each layer is only alllocating what it needs. In the editor, a new map has each layer as a 1x1 array. The layers are then redimensioned as tiles are dropped in. But, for example, say you have a huge map with only 1 entity, the collision layer may be 1000x1000 where the entity layer only has to be 20x20 -- does that make sense?
Falco Girgis wrote:
Front-End
So does your level editor's map placement window actually render the background layer as it would be in-game? If the user were to scroll over the main view, would they see the in-game parallax effect? Can we see screenshots?
Yes, if you scroll over in the editor, it matches the same in-game parallax effect. We didn't do this at first, but it caused mass confusion. Basically I can go in and out of "Preview Mode", and the map looks the same. The output of the editor is just 7 text files, exporting the 2D array of tile names. (pretty rude and crude, I know, but its all a compiled resource in the 360 build.)
EDIT:
Here's a look at the parallax layers in the editor:
http://i50.tinypic.com/sw4u4l.png
...and in-game:
http://i48.tinypic.com/244a2pi.png
You'll also notice that the in-game screenshot has a more pixelated look. This is just a transparent layer that I render over the entire game to give it the retro look.
Falco Girgis wrote:
That's very clever for background animations, btw. Sounds like an efficient and elegant solution.
Thanks, I was proud! :D This allowed us to have gunman firing in the background of the first level, and it really added some depth and feeling of being a "live" environment.
Falco Girgis wrote:
I'm asking all of these parallax questions, because I have been considering allowing the level designer to "toggle" the upper layers in our maps as parallax layers in ES. I have a very good idea for how I would implement the back-end in our engine, but not so much for how I would handle this in our Toolkit.
That'd be sweet! Having the ability to specify a layer as being parallax and then setting the scroll speed in the editor should give you all of the flexibility that you need. I got away with 3 speeds essentially - slow backgrounds, normal collision, and faster foreground - but, I could totally see needing varying levels of parallax for different maps.