Saturday, September 22, 2012

Platform Generation

I've been toying with different ideas for platform generation between homework assignments this weekend, and I came up with one I really like. My first few tries of just randomly placing platforms or placing one per height value looked either too random or you could easily see the pattern. What I came up with loops from the top of the map downward and at each step generates platforms left to right and right to left. It looks for a change from cave wall to empty space, then has a ~75% chance to place down a platform. That platform has a randomly generated size which terminates early if it hits another wall or the edge of the map.

Enough talk, here are some pictures.
'X' = cave wall
' ' = empty space
'-' = platform


No comments:

Post a Comment