I want to randomly generate a map for a 2D sidescroller game using the following tileset:
I have found a few great articles on the bitmasking process, for example: http://www.angryfishstudios.com/2011/04/adventures-in-bitmasking/ http://www.saltgames.com/2010/a-bitwise-method-for-applying-tilemaps/
I like the idea of using a bitmask/tilemask instead of doing a huge if clause or switch statement.
However, I am having trouble visualizing the entire process and none of these articles talk about randomizing.
My tiles fit together in multiple different ways, not just one way as the tiles in the examples I linked seem to.
For example here are just a few examples:
Since my tiles fit together in many different ways I don't think an 8 bit mask will work. Therefore, I was thinking of using a larger bitmask. Something like char or char4.
If someone could please show some pseudocode/examples of how the general algorithm would look, I would greatly appreciate it.