Steps done in generation:
Previsouly direction was chosen randomly. If not yet in list of directions: Add to list of directions.
This has been changed to get the same level each time you start. But they are still generated. So no random function, only iteration over some seed-data
- Check if there is an empty spot in the direction
- Check if there are no position taken within a radius of 3 tiles
- When new spot .. Direction list will be emptied.
- This will make one path.
- if random == x : extra paths generated on those spots where direction changed
- All paths get inverted. A shape is formed where the edges of the shape are calculated
- Using the Marching Squares : http://devblog.phillipspiess.com/better%20know%20an%20algorithm/2010/02/23/better-know-marching-squares.html
- During the marching squares routine we count the number of positions on the edge. If there are more than 60 it is a candidate for 3D generation.
- The data is send to the 3D generator that makes Linear Extrusion of this data to form a Mesh that occupies all the edges.
- Count all neighbours of a tile. When there are 3 : we are on a dead end
- Select (maximum of 3) random selected dead-ends and put treasure on it (BeachBall)
- Starting player position is always 1 row, 1 col