Friday, January 30, 2015

Maze improvement

I couldn't stay away from the maze thing and ended up improving it a bunch.

I had been using FlashPunk's Draw for the lines and since there are thousands of them, the fps eventually dropped to just 13. So I made a very basic Wall Entity with a 1 x 10 white line png and the fps kept steady at 60.

Next, some line sets along the border were closing themselves off. The logic on this one was a bit tricky but I eventually got them to stop doing that.

The last improvement was reducing the amount of line set end points by connecting them to other line set end points that were neighbors. I had some trouble with that because I'd end up with several boxed in areas connected to a border. To resolve that, I made a rule that one line set end point could not connect to another if both of their line sets were connected to a border.

I'm not a maze person so I don't know the fundamentals of creating a maze, this just looks like one. I tried running through one of them and made it to the end pretty easily so what I've done here still needs improvement. Maybe first create large sections with only a few entrances but lead to dead ends?

I've already envisioned a way to make a game out of this. The user navigates the maze by pressing the directional keys. Each time a key is pressed, if that direction is available, a 1 x 10 line is drawn on the path. When the user back tracks, a point is added for each line segment that overlaps a previous one. The lower your points are, the better you've done.




No comments:

Post a Comment