Here is a technique that I have been wanting to use in my projects for a while: Bitwise Tile Generation. It’s usefull to add some flavor to your world/level.
Basically you use a full tileset for the grass or platformer tiles in your game and you calculate if there are similair tiles next to each other to change the sprites. If you don’t have to calculate corners you just have to check 4 tiles each time for 16 different combinations.
If you only have a tile on top you will use sprite 1 in the middle. But it you have a tile to the right and on the bottom you would use sprite 6. There are 16 different combinations from no tiles (0) to all tiles(15).
The reason why this technique is called Bitwise is because you’re basically using bits to check if there is a tile or not. 0000 translates to 0 or no tiles. And 0001 would be a tile on the top and so on.
But what if you would like to check the corner tiles as well?
Wel you just need to use more bits to check every possible combination. With corners you will have a full byte with 256 possible combinations from 00000000 to 11111111.
It’s a very usefull technique to use and it saves you a lot of time compared to building the world manually!
Source/Extra links:
Saltgames blog: http://www.saltgames.com/2010/a-bitwise-method-for-applying-tilemaps/Flashpunk Forum post: http://developers.useflashpunk.net/t/flixel-compatible-tilemap-autoset/1736