Creating the maze

I have decided to go with a regular maze, one that you would see on cereal boxes or Denny's menus.

Now the question is how to create this type of maze with code. My first idea was to create one by hand.

When creating the maze I saw that the best way to create it is by doing the same thing you would do to solve it (start from the end). But in order to start from the end I need a maze that is completely covered by walls, then I can start from the end and erase these walls.

This is what that grid would look like:

Now the first step like I said was to start from the end(E) and start erasing walls until getting to the Start(S).
This is what it would look like:
Obviously that track is not acceptable as a challenge, it does create a path but for someone playing it would be an immediate solution, therefore in order to create a diversion from the main path I randomly deleted a line from each square. But there was one rule I had when deleting a line, I would not delete a line that would open a way to the path, this way I make sure that this random deleting of walls doesn't create a straight path to the goal, also squares that are part of the path were not part of this random deletion.

Finally this is what it would look like

These simple rules seem to produce a good looking maze, unfortunately this seems like a maze that can be solved in about 5 seconds, even though the challenge doesn't say anything about the maze being hard, as a game developer I always want to challenge the player, so I have come up with a gameplay mechanic that could help turn this simple maze into an interesting challenge.

No comments:

Post a Comment