21st November 2010
Keyhole challenge : An organic world
This is article 4 in my series on developing a tiny-screen game.
An effect which I think greatly adds to the impression a platform game gives
is to have some objects which the player (and other characters) pass behind.
Nowadays this is technically easy to do. For this game, it makes sense to just draw to an extra, transparent bitmap overlaid onto the main action. The real question is what to put on it. Game-wide effects need to pull their weight, but fortunately there are several slightly different purposes for which this layer can be used:
- cosmetic foreground
- secret passages
A brownian tree
At least for me, this is the main reason for integrating a foreground system.
The thing is not to overuse it - it is critical not to obscure the action. I want most of my foreground objects to be thin for this reason. The forground composites with the background, so this is a good opportunity to incorporate plants and other organic shapes.
As I didn't want to get overwhelmed with drawing many similar tiles, I decided to use Brownian trees, the result of diffusion limited aggregation. These are structures like the one on the right - I built a set of small trees using a variety of palettes and movement algorithms.
I slightly regret not generating every tree in the game at run-time, but I decided that it wasn't worth the extra development. Maybe next time.
Besides layering onto empty space, the foreground can be placed on solid ground.
If you have a shortage of technical space for solid item graphics, using foreground graphics instead is a quick hack to move the data from there into a different dataspace. I'm already close to my stated limit of 256, but I don't expect to need this.
However, this does open up an opportunity for tile combinations. For example, several textures could share the same set of edging tiles, or transitions between different tilesets can be created with only a few extra tiles. It's a shame that this ability to combine tiles can only be used for solid tiles with this method - at least, without looking very odd. If you do wish to create walkable combination tiles then you will have to implement a system which can draw multiple tiles behind the player.
Secret passages were a staple component of many early platformers. If you decide to use them, I suggest that you always have clues indicating their presence. These will probably need to seem really blatent to you, if they are not to be impossible to find for most players!
Of course using a foreground layer isn't a prerequisite for having secret passages, however, it does often look better for the character to go behind the scene.
I include this only for completeness, because they're generally not good design.
Traps are in a sense the opposite of secret passages - typically they appear to be handily placed platforms which the player will fall through to their death.
I hope this article has excited you with the possibilities available with a foreground layer.
Next time I hope to finish covering the world system, and post some screenshots of the game so far.