Tunnel vision
After mucking about with views for a while I knocked up the following prototype:
A world of problems
- Having the portals in the middle of the screen drastically limited the play-space. Although GameMaker supports sprite depth, views themselves override this. Even if the sprite depth for all of the cyan platforms is set so that they appear in front of the yellow ones, the viewport itself takes precedence and completely covers everything behind it.
- It's ugly. Having the viewports overlap each other minimizes the total area they take up, while giving us the 'tunneling' effect of going into the screen as they expand. Unfortunately it just doesn't look good with those hard edges. We could have had clever bordering artwork to smooth the transition, but a hole in the world is a hole in the world.
A fresh perspective
The final breakdown for the portal heights had the main port taking 5/8ths of the window height, the next port with 2/8ths (1/4) and the last one with 1/8th. These are roughly the same proportions as the mock-up.
The only downside to this approach was that it made transitions more complicated: I now had to morph not only the viewports but the areas they represented too. Here's what happens when the player shifts:
- The main viewport slides down off the screen.*
- The next viewport slides down, expands vertically and zooms in to replace it.
- The last viewport slides down, expands vertically and zooms in to replace that.
- A temporary fourth view slides in from the top.* Once the transition is complete, the temporary view is disabled and what was the main view now takes last place.
In much the same way that GameMaker doesn't allow viewports to be larger than the window, it also doesn't allow them to occupy space outside the window. A 'sliding' viewport is actually vertically shrinking or expanding while zooming in or out. This is functionally similar to the expansion zoom trick from earlier. As one of my lecturers likes to say: in graphics programming, everything is a hack.
The last thing I'll say about the viewports is that whenever you shift you're actually discarding that world and generating a new one at the top. Having a temporary fourth lane was too much hassle for a jam game, so once the transition is complete you can actually see the new world pop in over the old one at the top. Since the backgrounds are detailed and the player isn't focusing on the top of the window at that time, I think we get away with it. Look out for it in the videos below.